question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Local Mode - TypeError: unhashable type: 'list'

See original GitHub issue

I’m training an A3C trainer with Pytorch and tune.run().

     tune.run(a3c.A3CTrainer, local_dir=".", stop={"episode_reward_mean": 0.5}, 
     resources_per_trial={"cpu":1, "gpu":1},
     config={"env": "my_env",  
                             "use_pytorch": True,
                             "model": {"custom_model": "my_model"},
                             "num_workers": 1,
                             "train_batch_size": 32,
                             "sample_batch_size": 16,
                             "num_envs_per_worker": 1,
            })

I’m getting the error File "/mnt/miniconda/envs/proteus_rl_env/lib/python3.6/site-packages/ray/rllib/optimizers/async_gradients_optimizer.py", line 43, in step pending_gradients[future] = e TypeError: unhashable type: 'list'

The same code with another trainer, i.e, PGTrainer is working:

     tune.run(pg.PGTrainer, local_dir=".", stop={"episode_reward_mean": 0.5}, 
     resources_per_trial={"cpu":1, "gpu":1},
     config={"env": "my_env",  
                             "use_pytorch": True,
                             "model": {"custom_model": "my_model"},
                            "num_workers": 1,
                             "train_batch_size": 32,
                             "sample_batch_size": 16,
                             "num_envs_per_worker": 1,
                             })

Are there some specific changes to be done while running the A3C trainer?

Any leads will be appreciated!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
richardliawcommented, Aug 6, 2019

OK this should be fixed in the release; closing for now but reopen if needed.

0reactions
richardliawcommented, Aug 3, 2019

I think this is fixed in the upcoming release (0.7.3). If you need the feature now, you can install the latest snapshot of master (https://ray.readthedocs.io/en/latest/installation.html#trying-snapshots-from-master)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python: TypeError: unhashable type: 'list' - Net-Informations.Com
This error shows that the my_dict key [1,2,3] is List and List is not a hashable type in Python . Dictionary keys must...
Read more >
How to overcome TypeError: unhashable type: 'list' [duplicate]
The solution to avoid this error is to restructure the list to have nested tuples instead of lists. Share.
Read more >
How to Handle Unhashable Type List Exceptions in Python
The Python TypeError: Unhashable Type: 'list' happens when a mutable list, instead of an immutable tuple, is used as a hash argument.
Read more >
You have any idea, how fix TypeError: unhashable type: 'list'
Now this is just a guess, but I would guess that a list is not a hashable entity. ... Quote: Most of Python's...
Read more >
TypeError: unhashable type: 'dict' - Discussions on Python.org
When I looked at your code again I think you first need to do some simpler exercises with the basic data types (...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found