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

'Rating' object is not subscriptable #58

Open
trangml opened this issue Nov 24, 2023 · 0 comments
Open

'Rating' object is not subscriptable #58

trangml opened this issue Nov 24, 2023 · 0 comments

Comments

@trangml
Copy link

trangml commented Nov 24, 2023

Found an issue with the OpenSkillRating which causes Wandb logging to fail in the policy ranker.

Problem is here

f"skillrank/{wandb_policy}/mu": rating['mu'],

Exception has occurred: TypeError       (note: full exception trace is shown but execution is paused at: _run_module_as_main)
'Rating' object is not subscriptable
  File "/home/mtrang/anaconda3/envs/nmmo/lib/python3.9/site-packages/pufferlib/policy_ranker.py", line 90, in update_ranks
    f"skillrank/{wandb_policy}/mu": rating["mu"],
  File "/home/mtrang/Documents/rl/neural_mmo/baselines/reinforcement_learning/clean_pufferl.py", line 394, in evaluate
    self.policy_ranker.update_ranks(
  File "/home/mtrang/anaconda3/envs/nmmo/lib/python3.9/site-packages/pufferlib/utils.py", line 223, in wrapper
    result = func(*args, **kwargs)
  File "/home/mtrang/Documents/rl/neural_mmo/baselines/train_optuna.py", line 66, in objective
    _, stats, infos = trainer.evaluate()
  ...
TypeError: 'Rating' object is not subscriptable``

Simple fix of

                wandb.log({
                    f"skillrank/{wandb_policy}/mu": rating.mu,
                    f"skillrank/{wandb_policy}/sigma": rating.sigma,
                    f"skillrank/{wandb_policy}/score": scores[wandb_policy],
                    "agent_steps": step,
                    "global_step": step,
                })

worked for me.

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

1 participant