o
    `Û·iƒ  ã                   @   s>  d Z ddlZddlZdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zeeeeeee	e
eedœ
Zdddddddddd d!d"œZd#ed$efd%d&„Zi d'd(“d)d(“d*d+“d,d-“d.d/“d0d1“d2d3“d4d5“d6d5“d7d8“d9d:“d;d:“d<d=“d>d?“d@dA“dBdC“dDdC“dEdFi¥ZdGefdHdI„ZdJefdKdL„ZdS )Mz;Registry of algorithm names for tune.Tuner(trainable=[..]).é    Nc                  C   ó(   dd l m  m  m}  | j| j ¡ fS ©Nr   )Úray.rllib.algorithms.appoÚrllibÚ
algorithmsÚappoÚAPPOÚget_default_config)r   © r
   úS/home/ubuntu/vllm_env/lib/python3.10/site-packages/ray/rllib/algorithms/registry.pyÚ_import_appo   ó   r   c                  C   r   r   )Úray.rllib.algorithms.bcr   r   ÚbcÚBCr	   )r   r
   r
   r   Ú
_import_bc   r   r   c                  C   r   r   )Úray.rllib.algorithms.cqlr   r   ÚcqlÚCQLr	   )r   r
   r
   r   Ú_import_cql   r   r   c                  C   r   r   )Úray.rllib.algorithms.dqnr   r   ÚdqnÚDQNr	   )r   r
   r
   r   Ú_import_dqn   r   r   c                  C   r   r   )Úray.rllib.algorithms.dreamerv3r   r   Ú	dreamerv3Ú	DreamerV3r	   )r   r
   r
   r   Ú_import_dreamerv3   r   r   c                  C   r   r   )Úray.rllib.algorithms.impalar   r   ÚimpalaÚIMPALAr	   )r   r
   r
   r   Ú_import_impala%   r   r!   c                  C   r   r   )Úray.rllib.algorithms.iqlr   r   ÚiqlÚIQLr	   )r#   r
   r
   r   Ú_import_iql+   r   r%   c                  C   r   r   )Úray.rllib.algorithms.marwilr   r   ÚmarwilÚMARWILr	   )r'   r
   r
   r   Ú_import_marwil1   r   r)   c                  C   r   r   )Úray.rllib.algorithms.ppor   r   ÚppoÚPPOr	   )r+   r
   r
   r   Ú_import_ppo7   r   r-   c                  C   r   r   )Úray.rllib.algorithms.sacr   r   ÚsacÚSACr	   )r/   r
   r
   r   Ú_import_sac=   r   r1   )
r   r   r   r   r   r    r$   r(   r,   r0   r   r   r   r   r   r    r$   r(   r,   r0   )r   r   r   r   r   ÚImpalar$   r    r(   r,   r0   ÚalgÚreturnc                 C   s†   | t v rt |  ƒ d S | dkrddlm} |jS | dkr$ddlm} |S | dkr0ddlm} |S | dkr<dd	lm} |S td
 	| ¡ƒ‚)Nr   Úscript)Úscript_runnerÚ__fake)Ú_MockTrainerÚ__sigmoid_fake_data)Ú_SigmoidFakeDataÚ__parameter_tuning)Ú_ParameterTuningTrainerzUnknown algorithm {}.)
Ú
ALGORITHMSÚray.tuner6   ÚScriptRunnerÚray.rllib.algorithms.mockr8   r:   r<   Ú	ExceptionÚformat)r3   r6   r8   r:   r<   r
   r
   r   Ú_get_algorithm_class`   s   rC   ÚAPPOTF1Policyzappo.appo_tf_policyÚAPPOTF2PolicyÚAPPOTorchPolicyzappo.appo_torch_policyÚCQLTFPolicyzcql.cql_tf_policyÚCQLTorchPolicyzcql.cql_torch_policyÚDQNTFPolicyzdqn.dqn_tf_policyÚDQNTorchPolicyzdqn.dqn_torch_policyÚImpalaTF1Policyzimpala.impala_tf_policyÚImpalaTF2PolicyÚImpalaTorchPolicyzimpala.impala_torch_policyÚMARWILTF1Policyzmarwil.marwil_tf_policyÚMARWILTF2PolicyÚMARWILTorchPolicyzmarwil.marwil_torch_policyÚSACTFPolicyzsac.sac_tf_policyÚSACTorchPolicyzsac.sac_torch_policyÚPPOTF1Policyzppo.ppo_tf_policyÚPPOTF2PolicyÚPPOTorchPolicyzppo.ppo_torch_policyÚpolicy_classc                 C   s    t  dd| j¡}|tv r|S dS )zäReturns a string name for the provided policy class.

    Args:
        policy_class: RLlib policy class, e.g. A3CTorchPolicy, DQNTFPolicy, etc.

    Returns:
        A string name uniquely mapped to the given policy class.
    z_traced$Ú N)ÚreÚsubÚ__name__ÚPOLICIES)rV   Únamer
   r
   r   Úget_policy_class_name’   s   r]   r\   c                 C   s:   | t vrdS t |  }t d| ¡}t|| ƒsdS t|| ƒS )z±Return an actual policy class given the string name.

    Args:
        name: string name of the policy class.

    Returns:
        Actual policy class for the given name.
    Nzray.rllib.algorithms.)r[   Ú	importlibÚimport_moduleÚhasattrÚgetattr)r\   ÚpathÚmoduler
   r
   r   Úget_policy_class§   s   	

rd   )Ú__doc__r^   rX   r   r   r   r   r   r!   r%   r)   r-   r1   r=   ÚALGORITHMS_CLASS_TO_NAMEÚstrÚtyperC   r[   r]   rd   r
   r
   r
   r   Ú<module>   s˜    öõÿþýüûúùø	÷
öõôóòñðïî