Eclectic-Sheep / sheeprl

Distributed Reinforcement Learning accelerated by Lightning Fabric
https://eclecticsheep.ai
Apache License 2.0
313 stars 33 forks source link

[Error] Can't run "python sheeprl/available_agents.py", error message "KeyError: 'sheeprl.algos.a2c'" #192

Closed LYK-love closed 9 months ago

LYK-love commented 9 months ago

My env:

When I run:

KeyError: 'sheeprl.algos.a2c'

I got error:

/home/lyk/miniconda3/envs/sheeprl/lib/python3.9/site-packages/lightning/fabric/__init__.py:40: Deprecated call to `pkg_resources.declare_namespace('li
ghtning.fabric')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/e
n/latest/references/keywords.html#keyword-namespace-packages
/home/lyk/miniconda3/envs/sheeprl/lib/python3.9/site-packages/pkg_resources/__init__.py:2350: DeprecationWarning: Deprecated call to `pkg_resources.de
clare_namespace('lightning')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/e
n/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(parent)
/home/lyk/miniconda3/envs/sheeprl/lib/python3.9/site-packages/lightning/pytorch/__init__.py:37: Deprecated call to `pkg_resources.declare_namespace('l
ightning.pytorch')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/e
n/latest/references/keywords.html#keyword-namespace-packages
/home/lyk/miniconda3/envs/sheeprl/lib/python3.9/site-packages/pkg_resources/__init__.py:2350: DeprecationWarning: Deprecated call to `pkg_resources.de
clare_namespace('lightning')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/e
n/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(parent)
/home/lyk/miniconda3/envs/sheeprl/lib/python3.9/site-packages/lightning_fabric/__init__.py:40: Deprecated call to `pkg_resources.declare_namespace('li
ghtning_fabric')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/e
n/latest/references/keywords.html#keyword-namespace-packages
/home/lyk/miniconda3/envs/sheeprl/lib/python3.9/site-packages/pytorch_lightning/__init__.py:37: Deprecated call to `pkg_resources.declare_namespace('p
ytorch_lightning')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/e
n/latest/references/keywords.html#keyword-namespace-packages
Traceback (most recent call last):
  File "/home/lyk/Projects/sheeprl/sheeprl/available_agents.py", line 17, in <module>
    for evaluation in evaluation_registry[module]:
KeyError: 'sheeprl.algos.a2c'

Debugging of sheeprl/available_agents.py shows that the dict evaluation_entrypoint doesn't have the object 'sheeprl.algos.a2c':

image

However, the dict algorithm_registry has the object 'sheeprl.algos.a2c':

image
belerico commented 9 months ago

Hi @LYK-love, thank you for reporting this. Can you try out this branch please?

LYK-love commented 9 months ago

Hi @LYK-love, thank you for reporting this. Can you try out this branch please?

I tried it. That worked. The output (in my terminal)

$ python sheeprl/available_agents.py  
/home/lyk/miniconda3/envs/sheeprl/lib/python3.9/site-packages/lightning/fabric/__init__.py:40: Deprecated call to `pkg_resources.declare_namespace('lightning.fabric')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
/home/lyk/miniconda3/envs/sheeprl/lib/python3.9/site-packages/pkg_resources/__init__.py:2350: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('lightning')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(parent)
/home/lyk/miniconda3/envs/sheeprl/lib/python3.9/site-packages/lightning/pytorch/__init__.py:37: Deprecated call to `pkg_resources.declare_namespace('lightning.pytorch')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
/home/lyk/miniconda3/envs/sheeprl/lib/python3.9/site-packages/pkg_resources/__init__.py:2350: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('lightning')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(parent)
/home/lyk/miniconda3/envs/sheeprl/lib/python3.9/site-packages/lightning_fabric/__init__.py:40: Deprecated call to `pkg_resources.declare_namespace('lightning_fabric')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
/home/lyk/miniconda3/envs/sheeprl/lib/python3.9/site-packages/pytorch_lightning/__init__.py:37: Deprecated call to `pkg_resources.declare_namespace('pytorch_lightning')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
                                                          SheepRL Agents                                                          
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Module                      ┃ Algorithm           ┃ Entrypoint ┃ Decoupled ┃ Evaluated by                                      ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ sheeprl.algos.a2c           │ a2c                 │ main       │ False     │ sheeprl.algos.a2c.evaluate.evaluate_a2c           │
│ sheeprl.algos.dreamer_v1    │ dreamer_v1          │ main       │ False     │ sheeprl.algos.dreamer_v1.evaluate.evaluate        │
│ sheeprl.algos.dreamer_v2    │ dreamer_v2          │ main       │ False     │ sheeprl.algos.dreamer_v2.evaluate.evaluate        │
│ sheeprl.algos.dreamer_v3    │ dreamer_v3          │ main       │ False     │ sheeprl.algos.dreamer_v3.evaluate.evaluate        │
│ sheeprl.algos.sac           │ sac                 │ main       │ False     │ sheeprl.algos.sac.evaluate.evaluate               │
│ sheeprl.algos.sac           │ sac_decoupled       │ main       │ True      │ sheeprl.algos.sac.evaluate.evaluate               │
│ sheeprl.algos.droq          │ droq                │ main       │ False     │ sheeprl.algos.droq.evaluate.evaluate              │
│ sheeprl.algos.p2e_dv1       │ p2e_dv1_exploration │ main       │ False     │ sheeprl.algos.p2e_dv1.evaluate.evaluate           │
│ sheeprl.algos.p2e_dv1       │ p2e_dv1_finetuning  │ main       │ False     │ sheeprl.algos.p2e_dv1.evaluate.evaluate           │
│ sheeprl.algos.p2e_dv2       │ p2e_dv2_exploration │ main       │ False     │ sheeprl.algos.p2e_dv2.evaluate.evaluate           │
│ sheeprl.algos.p2e_dv2       │ p2e_dv2_finetuning  │ main       │ False     │ sheeprl.algos.p2e_dv2.evaluate.evaluate           │
│ sheeprl.algos.p2e_dv3       │ p2e_dv3_exploration │ main       │ False     │ sheeprl.algos.p2e_dv3.evaluate.evaluate           │
│ sheeprl.algos.p2e_dv3       │ p2e_dv3_finetuning  │ main       │ False     │ sheeprl.algos.p2e_dv3.evaluate.evaluate           │
│ sheeprl.algos.ppo           │ ppo                 │ main       │ False     │ sheeprl.algos.ppo.evaluate.evaluate_ppo           │
│ sheeprl.algos.ppo           │ ppo_decoupled       │ main       │ True      │ sheeprl.algos.ppo.evaluate.evaluate_ppo_decoupled │
│ sheeprl.algos.ppo_recurrent │ ppo_recurrent       │ main       │ False     │ sheeprl.algos.ppo_recurrent.evaluate.evaluate     │
│ sheeprl.algos.sac_ae        │ sac_ae              │ main       │ False     │ sheeprl.algos.sac_ae.evaluate.evaluate            │
└─────────────────────────────┴─────────────────────┴────────────┴───────────┴───────────────────────────────────────────────────┘

Hope this branch will be merged soon. Btw, the warning message is annoying. Is there anyway to remove them?

belerico commented 9 months ago

Btw, the warning message is annoying. Is there anyway to remove them?

This is something related to the Lightning package and they're already on it (Lightning-AI/pytorch-lightning#16756)