ray.init()
env_config = {
“config_file”: trainer_config_file
}
config ={
“env”: ScimEnv,
“env_config”: env_config,
“num_gpus”: 0,
“num_workers”: 1,
“lr”: 1e-3,
“framework”: “torch”
}
results = tune.run(“DQN”, stop={“episode_reward_mean”: 20}, config=config)
df = results.results_df
ray.shutdown()
Here is my code. Ideally my environment has two inputs, one for the config file and another dictionary. However, from my understanding env_config specifically works with only the config directory in the dictionary. Is there any way to add to env_config?
@Yared_Kokeb,
welcome to the forum. I have a similar setup where I pass configurations via the env_config
. I define my __init__()
to be
class MyEnv(gym.Env):
def __init__(self, env_config=None):
super(MyEnv, self).__init__()
self.config = env_config or {}
...
If you want to pass configuration parameters to your model (I see a trainer_config_file
there) you can use in the config
you defined above for example
config={
"env_config": {
"my_env_parameter": 10,
},
"model": {
"max_seq_len": 1,
# Or if you have a custom model or policy:
#"custom_model_config": {
# "my_custom_model_parameter": 8,
#}
}
}
Hope this helps.
Simon