Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ToyText env #488

Open
3 tasks done
ace-han opened this issue Oct 19, 2024 · 0 comments
Open
3 tasks done

Support ToyText env #488

ace-han opened this issue Oct 19, 2024 · 0 comments

Comments

@ace-han
Copy link

ace-han commented Oct 19, 2024

Problem Description

Launching via python cleanrl/ppo.py --seed 1 --env-id FrozenLake-v1 will failed.

Since ToyText envs are extremely simple and easy to learn, it's better to support them.

Checklist

Current Behavior

python cleanrl/ppo.py --seed 1 --env-id FrozenLake-v1 will yield below

/Users/ace/Library/Caches/pypoetry/virtualenvs/cleanrl-TlZg4FDS-py3.10/lib/python3.10/site-packages/tyro/_fields.py:307: UserWarning: The field wandb_entity is annotated with type <class 'str'>, but the default value None has type <class 'NoneType'>. We'll try to handle this gracefully, but it may cause unexpected behavior.
  warnings.warn(
/Users/ace/Library/Caches/pypoetry/virtualenvs/cleanrl-TlZg4FDS-py3.10/lib/python3.10/site-packages/tyro/_fields.py:307: UserWarning: The field target_kl is annotated with type <class 'float'>, but the default value None has type <class 'NoneType'>. We'll try to handle this gracefully, but it may cause unexpected behavior.
  warnings.warn(
Traceback (most recent call last):
  File "/Users/ace/workspace/ace/cleanrl/cleanrl/ppo.py", line 167, in <module>
    agent = Agent(envs).to(device)
  File "/Users/ace/workspace/ace/cleanrl/cleanrl/ppo.py", line 104, in __init__
    layer_init(nn.Linear(np.array(envs.single_observation_space.shape).prod(), 64)),
  File "/Users/ace/Library/Caches/pypoetry/virtualenvs/cleanrl-TlZg4FDS-py3.10/lib/python3.10/site-packages/torch/nn/modules/linear.py", line 99, in __init__
    self.weight = Parameter(torch.empty((out_features, in_features), **factory_kwargs))
TypeError: empty(): argument 'size' failed to unpack the object at pos 2 with error "type must be tuple of ints,but got numpy.float64"
(cleanrl-TlZg4FDS-py3.10

Expected Behavior

The program proceeds without exceptions

Possible Solution

It looks like nn.Linear(np.array(envs.single_observation_space.shape).prod(), 64) not working well with Discret space

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant