Hi! I’m trying to restore an QMix Algorithm.
This is my code:
# the libraries needed are imported
from ray.tune import register_env
from ray.rllib.algorithms.qmix import QMix
from GENERAL_QMIX_ep_gym_env_evaluation import EnergyPlusEnvWithGroupedAgents_v0
# own environment is registered (with the same name that it was used during training)
register_env(
"EPEnv",
lambda args: EnergyPlusEnvWithGroupedAgents_v0(args)
)
# checqpoint Path to trained algorithm
checkpoint_path = "C:/Users/grhen/ray_results/ajuste_modelo_general_QMIX_5/QMIX_EPEnv_24cb3_00005_5_gamma=0.9900,lr=0.0100,mixing_embed_dim=32_2023-09-17_09-38-46/checkpoint_001400"
# restoring the algorithm
algo = QMix.from_checkpoint(checkpoint_path)
# evaluating the trained algorithm
print(algo.evaluate())
The following is the terminal message where an AttributeError appears:
2023-09-20 16:38:27,907 WARNING env.py:56 -- Skipping env checking for this experiment
running EnergyPlus with args: ['-w', 'C:/Users/grhen/Documents/GitHub/EP_RLlib/EP_Wheater_Configuration/Zapala_Neuquen-hour.epw', '-d', 'C:\\Users\\grhen\\AppData\\Local\\Temp\\tmpy2vl1lvvQMIX/episode-00000000-04280', 'C:/Users/grhen/Documents/models/model-00000000-04280.epJSON']
2023-09-20 16:38:28,187 INFO policy.py:1294 -- Policy (worker=local) running on CPU.
2023-09-20 16:38:28,187 INFO torch_policy.py:185 -- Found 0 visible cuda devices.
2023-09-20 16:38:28,195 INFO util.py:118 -- Using connectors:
2023-09-20 16:38:28,196 INFO util.py:119 -- AgentConnectorPipeline
ObsPreprocessorConnector
StateBufferConnector
ViewRequirementAgentConnector
2023-09-20 16:38:28,197 INFO util.py:120 -- ActionConnectorPipeline
ConvertToNumpyConnector
NormalizeActionsConnector
ImmutableActionsConnector
2023-09-20 16:38:28,197 INFO rollout_worker.py:1742 -- Built policy map: <PolicyMap lru-caching-capacity=100 policy-IDs=['default_policy']>
2023-09-20 16:38:28,197 INFO rollout_worker.py:1743 -- Built preprocessor map: {'default_policy': None}
2023-09-20 16:38:28,197 INFO rollout_worker.py:550 -- Built filter map: defaultdict(<class 'ray.rllib.utils.filter.NoFilter'>, {})
2023-09-20 16:38:32,161 INFO worker.py:1612 -- Started a local Ray instance. View the dashboard at 127.0.0.1:8266
Traceback (most recent call last):
File "c:\Users\grhen\Documents\GitHub\EP_RLlib\GENERAL_QMIX_init_evaluation.py", line 36, in <module>
algo = QMix.from_checkpoint(checkpoint_path)
File "C:\Users\grhen\anaconda3\envs\dwelling_DRL\lib\site-packages\ray\rllib\algorithms\algorithm.py", line 345, in from_checkpoint
return Algorithm.from_state(state)
File "C:\Users\grhen\anaconda3\envs\dwelling_DRL\lib\site-packages\ray\rllib\algorithms\algorithm.py", line 375, in from_state
new_algo.__setstate__(state)
File "C:\Users\grhen\anaconda3\envs\dwelling_DRL\lib\site-packages\ray\util\tracing\tracing_helper.py", line 464, in _resume_span
return method(self, *_args, **_kwargs)
File "C:\Users\grhen\anaconda3\envs\dwelling_DRL\lib\site-packages\ray\rllib\algorithms\algorithm.py", line 2600, in __setstate__
remote_state = ray.put(state["worker"])
File "C:\Users\grhen\anaconda3\envs\dwelling_DRL\lib\site-packages\ray\_private\auto_init_hook.py", line 23, in auto_init_wrapper
auto_init_ray()
File "C:\Users\grhen\anaconda3\envs\dwelling_DRL\lib\site-packages\ray\_private\auto_init_hook.py", line 16, in auto_init_ray
ray.init()
File "C:\Users\grhen\anaconda3\envs\dwelling_DRL\lib\site-packages\ray\_private\client_mode_hook.py", line 103, in wrapper
return func(*args, **kwargs)
File "C:\Users\grhen\anaconda3\envs\dwelling_DRL\lib\site-packages\ray\_private\worker.py", line 1623, in init
connect(
File "C:\Users\grhen\anaconda3\envs\dwelling_DRL\lib\site-packages\ray\_private\worker.py", line 2104, in connect
faulthandler.enable(all_threads=False)
AttributeError: 'Tee' object has no attribute 'fileno'
I don’t know how to solve this error and why appears. Any help is welcome, thanks!