o
    1 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   )Zray.rllib.algorithms.appoÚrllibÚ
algorithmsÚappoÚAPPOÚget_default_config)r   © r	   úi/home/app/PaddleOCR-VL-test/.venv_paddleocr/lib/python3.10/site-packages/ray/rllib/algorithms/registry.pyÚ_import_appo   ó   r   c                  C   r   r   )Zray.rllib.algorithms.bcr   r   ÚbcÚBCr   )r   r	   r	   r
   Ú
_import_bc   r   r   c                  C   r   r   )Zray.rllib.algorithms.cqlr   r   ÚcqlÚCQLr   )r   r	   r	   r
   Ú_import_cql   r   r   c                  C   r   r   )Zray.rllib.algorithms.dqnr   r   ÚdqnÚDQNr   )r   r	   r	   r
   Ú_import_dqn   r   r   c                  C   r   r   )Zray.rllib.algorithms.dreamerv3r   r   Ú	dreamerv3Ú	DreamerV3r   )r   r	   r	   r
   Ú_import_dreamerv3   r   r   c                  C   r   r   )Zray.rllib.algorithms.impalar   r   ÚimpalaÚIMPALAr   )r   r	   r	   r
   Ú_import_impala%   r   r   c                  C   r   r   )Zray.rllib.algorithms.iqlr   r   ÚiqlÚIQLr   )r   r	   r	   r
   Ú_import_iql+   r   r   c                  C   r   r   )Zray.rllib.algorithms.marwilr   r   ÚmarwilÚMARWILr   )r   r	   r	   r
   Ú_import_marwil1   r   r!   c                  C   r   r   )Zray.rllib.algorithms.ppor   r   ÚppoÚPPOr   )r"   r	   r	   r
   Ú_import_ppo7   r   r$   c                  C   r   r   )Zray.rllib.algorithms.sacr   r   ÚsacÚSACr   )r%   r	   r	   r
   Ú_import_sac=   r   r'   )
r   r   r   r   r   r   r   r    r#   r&   r   r   r   r   r   r   r   r    r#   r&   )r   r   r   r   r   ZImpalar   r   r    r#   r&   Ú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_runnerZ__fake)Ú_MockTrainerZ__sigmoid_fake_data)Ú_SigmoidFakeDataZ__parameter_tuning)Ú_ParameterTuningTrainerzUnknown algorithm {}.)
Ú
ALGORITHMSZray.tuner+   ZScriptRunnerZray.rllib.algorithms.mockr,   r-   r.   Ú	ExceptionÚformat)r(   r+   r,   r-   r.   r	   r	   r
   Ú_get_algorithm_class`   s   r2   ZAPPOTF1Policyzappo.appo_tf_policyZAPPOTF2PolicyZAPPOTorchPolicyzappo.appo_torch_policyZCQLTFPolicyzcql.cql_tf_policyZCQLTorchPolicyzcql.cql_torch_policyZDQNTFPolicyzdqn.dqn_tf_policyZDQNTorchPolicyzdqn.dqn_torch_policyZImpalaTF1Policyzimpala.impala_tf_policyZImpalaTF2PolicyZImpalaTorchPolicyzimpala.impala_torch_policyZMARWILTF1Policyzmarwil.marwil_tf_policyZMARWILTF2PolicyZMARWILTorchPolicyzmarwil.marwil_torch_policyZSACTFPolicyzsac.sac_tf_policyZSACTorchPolicyzsac.sac_torch_policyZPPOTF1Policyzppo.ppo_tf_policyZPPOTF2PolicyZ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)r3   Únamer	   r	   r
   Úget_policy_class_name’   s   r:   r9   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.)r8   Ú	importlibÚimport_moduleÚhasattrÚgetattr)r9   ÚpathÚmoduler	   r	   r
   Úget_policy_class§   s   	

rA   )Ú__doc__r;   r5   r   r   r   r   r   r   r   r!   r$   r'   r/   ZALGORITHMS_CLASS_TO_NAMEÚstrÚtyper2   r8   r:   rA   r	   r	   r	   r
   Ú<module>   s˜    öõÿþýüûúùø	÷
öõôóòñðïî