o
    ˜à·iX  ã                   @   s,   d dl mZmZ d dlZG dd„ deƒZdS )é    )ÚABCÚabstractmethodNc                   @   sV   e Zd Zee	ddejdededededejdB deejejejf fd	d
„ƒƒZ	dS )ÚAbstractEplbPolicyNÚweightÚnum_replicasÚ
num_groupsÚ	num_nodesÚ	num_ranksÚold_global_expert_indicesÚreturnc                 C   s   t ‚)a   
        Entry point for expert-parallelism load balancer.

        Parameters:
            weight: [layers, num_logical_experts], the load statistics
                for all logical experts
            num_replicas: number of physical experts, must be a multiple of
                `num_ranks`
            num_groups: number of expert groups
            num_nodes: number of server nodes
            num_ranks: number of ranks, must be a multiple of `num_nodes`
            old_global_expert_indices: [layers, num_logical_experts], the old global
                expert indices. Used to avoid unnecessary weight copying
                for experts moving within one rank.
        Returns:
            physical_to_logical_map: [layers, num_replicas], the expert
                index of each replica
            logical_to_physical_map: [layers, num_logical_experts, X],
                the replica indices for each expert
            expert_count: [layers, num_logical_experts], number of
                physical replicas for each logical expert
        )ÚNotImplementedError)Úclsr   r   r   r   r	   r
   © r   ú[/home/ubuntu/vllm_env/lib/python3.10/site-packages/vllm/distributed/eplb/policy/abstract.pyÚrebalance_experts
   s   !z$AbstractEplbPolicy.rebalance_experts)N)
Ú__name__Ú
__module__Ú__qualname__Úclassmethodr   ÚtorchÚTensorÚintÚtupler   r   r   r   r   r   	   s&    ùþýüûúùør   )Úabcr   r   r   r   r   r   r   r   Ú<module>   s   