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

[RLlib][Windows] error in custom_env.py #30525

Closed
XA23i opened this issue Nov 21, 2022 · 5 comments
Closed

[RLlib][Windows] error in custom_env.py #30525

XA23i opened this issue Nov 21, 2022 · 5 comments
Labels
question Just a question :) windows

Comments

@XA23i
Copy link

XA23i commented Nov 21, 2022

What happened + What you expected to happen

when i install raylib and run my first rayrl code(example "custom_env.py"), i come across an error,
(rllib2) C:\Users\Raymond\Desktop\rayRL>python custom_env.py --framework torch
Running with following CLI options: Namespace(as_test=False, framework='torch', local_mode=False, no_tune=False, run='PPO', stop_iters=50, stop_reward=0.1, stop_timesteps=100000)
2022-11-21 20:41:05,424 INFO worker.py:1528 -- Started a local Ray instance.
Traceback (most recent call last):
File "custom_env.py", line 161, in
get_trainable_cls(args.run)
AttributeError: 'dict' object has no attribute 'environment'
I am very consusing .

Versions / Dependencies

install as instruction

Reproduction script

python custom_env.py

Issue Severity

No response

@XA23i XA23i added bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component) labels Nov 21, 2022
@XA23i XA23i changed the title [<Ray component: Core|RLlib|etc...>] error in custom_env.py Nov 21, 2022
@XA23i
Copy link
Author

XA23i commented Nov 21, 2022

seems work when use ray-3.0 Howeveer no instruction tell me that

@XA23i
Copy link
Author

XA23i commented Nov 21, 2022

btw I am windows

@samo133
Copy link

samo133 commented Nov 21, 2022

The same error is generated while running the custom model/ custom environment example
operating system: Ubuntu 20.04
Ray version:2.1.0

@samo133
Copy link

samo133 commented Nov 22, 2022

The solution that works for me:
from ray.rllib.algorithms.ppo import PPOConfig
config = (
PPOConfig()
.environment(SimpleCorridor, env_config={"corridor_length": 5})
.framework(args.framework)
.rollouts(num_rollout_workers=1)
.training(
model={
"custom_model": "my_model",
"vf_share_layers": True,
}
)
# Use GPUs iff RLLIB_NUM_GPUS env var set to > 0.
.resources(num_gpus=int(os.environ.get("RLLIB_NUM_GPUS", "1")))
)

@wuisawesome wuisawesome changed the title error in custom_env.py [runtime_env][windows] error in custom_env.py Nov 22, 2022
@sven1977 sven1977 added P2 Important issue, but not time-critical and removed triage Needs triage (eg: priority, bug/not-bug, and owning component) labels Nov 23, 2022
@sven1977
Copy link
Contributor

I can confirm it's working on master (3.0) on Windows as well as 2.1.

This script is part of our CI testing suite, so it's constantly checked.

+--------------------------------+------------+-----------------+--------+------------------+-------+----------+----------------------+----------------------+--------------------+
| Trial name                     | status     | loc             |   iter |   total time (s) |    ts |   reward |   episode_reward_max |   episode_reward_min |   episode_len_mean |
|--------------------------------+------------+-----------------+--------+------------------+-------+----------+----------------------+----------------------+--------------------|
| PPO_SimpleCorridor_fb9cf_00000 | TERMINATED | 127.0.0.1:36436 |      3 |          34.8335 | 12000 | 0.157853 |              1.59751 |             -2.09562 |            9.27972 |
+--------------------------------+------------+-----------------+--------+------------------+-------+----------+----------------------+----------------------+--------------------+

@sven1977 sven1977 added question Just a question :) and removed bug Something that is supposed to be working; but isn't P2 Important issue, but not time-critical labels Nov 23, 2022
@sven1977 sven1977 changed the title [runtime_env][windows] error in custom_env.py [RLlib][Windows] error in custom_env.py Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Just a question :) windows
Projects
None yet
Development

No branches or pull requests

4 participants