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

AssertionError: Missing evaluation key. Patch RLlib as per the installation guide #6

Open
forrestneo opened this issue Apr 25, 2022 · 4 comments

Comments

@forrestneo
Copy link

Failure # 1 (occurred at 2022-04-25_11-36-54)
Traceback (most recent call last):
File "/home/zsd/anaconda3/envs/nmmo/lib/python3.9/site-packages/ray/tune/trial_runner.py", line 893, in _process_trial
results = self.trial_executor.fetch_result(trial)
File "/home/zsd/anaconda3/envs/nmmo/lib/python3.9/site-packages/ray/tune/ray_trial_executor.py", line 707, in fetch_result
result = ray.get(trial_future[0], timeout=DEFAULT_GET_TIMEOUT)
File "/home/zsd/anaconda3/envs/nmmo/lib/python3.9/site-packages/ray/_private/client_mode_hook.py", line 105, in wrapper
return func(*args, **kwargs)
File "/home/zsd/anaconda3/envs/nmmo/lib/python3.9/site-packages/ray/worker.py", line 1733, in get
raise value.as_instanceof_cause()
ray.exceptions.RayTaskError(AssertionError): �[36mray::PPO.train()�[39m (pid=449, ip=172.22.54.224, repr=PPO)
File "/home/zsd/nmmo/baselines/rllib_wrapper.py", line 243, in train
stats = super().train()
File "/home/zsd/anaconda3/envs/nmmo/lib/python3.9/site-packages/ray/tune/trainable.py", line 315, in train
result = self.step()
File "/home/zsd/anaconda3/envs/nmmo/lib/python3.9/site-packages/ray/rllib/agents/trainer.py", line 982, in step
raise e
File "/home/zsd/anaconda3/envs/nmmo/lib/python3.9/site-packages/ray/rllib/agents/trainer.py", line 963, in step
step_attempt_results = self.step_attempt()
File "/home/zsd/anaconda3/envs/nmmo/lib/python3.9/site-packages/ray/rllib/agents/trainer.py", line 1066, in step_attempt
step_results.update(self.evaluate())
File "/home/zsd/nmmo/baselines/rllib_wrapper.py", line 253, in evaluate
assert 'Raw_Policy_IDs' in stats, err
AssertionError: Missing evaluation key. Patch RLlib as per the installation guide

@forrestneo
Copy link
Author

@jsuarez5341

@TheCrazyT
Copy link

@forrestneo https://neuralmmo.github.io/build/html/rst/landing.html#icon-installation

Required RLlib patch: 

Add 

 custom_metrics[k] = v_list;

continue after line 193 (175 pre-master) in your RLlib metrics file (usually ~/anaconda3/lib/python3.8/site-packages/ray/rllib/evaluation/metrics.py)

@forrestneo
Copy link
Author

@TheCrazyT I have a try ,did not work.

@TheCrazyT
Copy link

@forrestneo

Well I did not patch it as mentioned on that page, i placed the patch at the end of the loop:

for k, v_list in custom_metrics.copy().items():
        filt = [v for v in v_list if not np.any(np.isnan(v))]
        custom_metrics[k + "_mean"] = np.mean(filt)
        if filt:
            custom_metrics[k + "_min"] = np.min(filt)
            custom_metrics[k + "_max"] = np.max(filt)
        else:
            custom_metrics[k + "_min"] = float("nan")
            custom_metrics[k + "_max"] = float("nan")
        del custom_metrics[k]
        custom_metrics[k] = v_list

But it probably depends on the version.

jsuarez5341 pushed a commit that referenced this issue May 16, 2023
add Prioritized Level Replay (PLR) paper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants