I am tryin to use tune with ppo. My env loads a csv file but when I am using tune it gives the following error. I think the problem is in loading a csv file to each environment. Can some please tell me how can I resolve this problem.
ERROR worker.py:409 – Exception raised in creation task: The actor died because of an error raised in its creation task, ray::PPO.init() (pid=9584, ip=192.168.0.28)
FileNotFoundError: [Errno 2] No such file or directory:
(pid=15400) Windows fatal exception: access violation
(pid=15400)
(pid=13004) Windows fatal exception: access violation
(pid=13004)
(pid=13900) Windows fatal exception: access violation
FileNotFoundError: [Errno 2] No such file or directory:
If you can upload your code, that’d be helpful in spotting any possible issue. Can you explain how the env loads a csv file?
However, based on your error log shown here, I think it’s just a relative path error. This stackoverflow post explains it: python - FileNotFoundError: [Errno 2] No such file or directory - Stack Overflow.
You can try giving the absolute path to your csv file as part of env_config
dictionary into the config
parameter for tune.run
as shown below:
import gym, ray
from ray.tune.registry import register_env
# I imagine you made your custom environment with gym.Env API.
# Even that is not the case, this overall idea should work.
class YourCustomSimulator(gym.Env):
def __init__(self, env_config):
path_to_csv = env_config['abs_path_csv']
csv_file = open(path_to_csv)
# Use your csv file.
# Other usual Gym-related settings
self.action_space = <gym.Space>
self.observation_space = <gym.Space>
def reset(self):
return <obs>
def step(self, action):
return <obs>, <reward: float>, <done: bool>, <info: dict>
def env_creator(env_config):
return YourCustomSimulator(...) # return an env instance
register_env("your_custom_simulator", env_creator)
config = {
"env": "your_custom_simulator",
"env_config": {
'abs_path_csv': "PATH/TO/CSV.csv"
},
# Other training related hyper-parameters
}
tune.run(
"PPO",
config=config,
# Other Tune related settings
)
I hope this helps. If not, please let me know.