You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I am trying to resume training from a saved agent, I am getting some errors. The saved agent however is working properly with evaluate function
How to reproduce
import re
import copy
import grid2op
from grid2op.Reward import LinesCapacityReward # or any other rewards
from grid2op.Chronics import MultifolderWithCache # highly recommended
from lightsim2grid import LightSimBackend # highly recommended for training !
from l2rpn_baselines.PPO_SB3 import train, evaluate
env_name = "l2rpn_case14_sandbox"
obs_attr_to_keep = ["day_of_week", "hour_of_day", "minute_of_hour", "prod_p", "prod_v", "load_p", "load_q",
"actual_dispatch", "target_dispatch", "topo_vect", "time_before_cooldown_line",
"time_before_cooldown_sub", "rho", "timestep_overflow", "line_status",
"storage_power", "storage_charge"]
act_attr_to_keep = ["redispatch"]
env = grid2op.make(env_name,
reward_class=LinesCapacityReward,
backend=LightSimBackend(),
chronics_class=MultifolderWithCache)
env.chronics_handler.real_data.set_filter(lambda x: re.match(".*00$", x) is not None)
env.chronics_handler.real_data.reset()
train(env,
iterations=1000, # any number of iterations you want
logs_dir="./logs/PPO_SB3_test", # where the tensorboard logs will be put
save_path="./saved_model/PPO_SB3_test", # where the NN weights will be saved
name="Reload_test", # name of the baseline
net_arch=[200, 200, 200], # architecture of the NN
obs_attr_to_keep=copy.deepcopy(obs_attr_to_keep),
act_attr_to_keep=copy.deepcopy(act_attr_to_keep),
normalize_obs=True,
)
evaluate(env,
nb_episode=3,
load_path="./saved_model/PPO_SB3_test/", # should be the same as what has been called in the train function !
name="Reload_test", # should be the same as what has been called in the train function !
logs_path = "./logs/PPO_SB3/",
nb_process=1,
verbose=True,
)
train(env,
iterations=1000, # any number of iterations you want
logs_dir="./logs/PPO_SB3_test", # where the tensorboard logs will be put
load_path="./saved_model/PPO_SB3_test/Reload_test",
save_path="./saved_model/PPO_SB3_test", # where the NN weights will be saved
name="Reload_test.zip", # name of the baseline
obs_attr_to_keep=copy.deepcopy(obs_attr_to_keep),
act_attr_to_keep=copy.deepcopy(act_attr_to_keep),
normalize_obs=True,
)
Current output
I am getting the following error message
/Users/paula/Desktop/Projects/venvs/L2PRN/lib/python3.10/site-packages/grid2op/gym_compat/box_gym_obsspace.py:765: UserWarning: The normalization of attribute "[False False False False False False]" cannot be performed entirely as there are some non finite value, or `high == `low` for some components.
warnings.warn(f"The normalization of attribute \"{both_finite}\" cannot be performed entirely as "
/Users/paula/Desktop/Projects/venvs/L2PRN/lib/python3.10/site-packages/grid2op/gym_compat/box_gym_obsspace.py:765: UserWarning: The normalization of attribute "[False False False False False False False False False False False]" cannot be performed entirely as there are some non finite value, or `high == `low` for some components.
warnings.warn(f"The normalization of attribute \"{both_finite}\" cannot be performed entirely as "
/Users/paula/Desktop/Projects/venvs/L2PRN/lib/python3.10/site-packages/grid2op/gym_compat/box_gym_obsspace.py:765: UserWarning: The normalization of attribute "[False False False False False False False False False False False False
False False False False False False False False]" cannot be performed entirely as there are some non finite value, or `high == `low` for some components.
warnings.warn(f"The normalization of attribute \"{both_finite}\" cannot be performed entirely as "
Traceback (most recent call last):
File "/Users/paula/Desktop/Projects/RL Practice/L2RPN Aspen/Demo Notebooks/PPO_SB3_train_reload.py", line 45, in <module>
train(env,
File "/............../L2PRN/lib/python3.10/site-packages/l2rpn_baselines/PPO_SB3/train.py", line 305, in train
agent.nn_model.learn(total_timesteps=iterations,
File "/............../L2PRN/lib/python3.10/site-packages/stable_baselines3/ppo/ppo.py", line 307, in learn
return super().learn(
File "/............../L2PRN/lib/python3.10/site-packages/stable_baselines3/common/on_policy_algorithm.py", line 236, in learn
total_timesteps, callback = self._setup_learn(
File "/............../L2PRN/lib/python3.10/site-packages/stable_baselines3/common/base_class.py", line 408, in _setup_learn
self._last_obs = self.env.reset() # pytype: disable=annotation-type-mismatch
AttributeError: 'NoneType' object has no attribute 'reset'
The text was updated successfully, but these errors were encountered:
System information
1.8.1
0.6.0.post1
mac osx
1.7.0
PPO_SB3
Bug description
When I am trying to resume training from a saved agent, I am getting some errors. The saved agent however is working properly with evaluate function
How to reproduce
Current output
I am getting the following error message
The text was updated successfully, but these errors were encountered: