tristandeleu / pytorch-maml-rl

Reinforcement Learning with Model-Agnostic Meta-Learning in Pytorch
MIT License
827 stars 158 forks source link

TypeError: list indices must be integers or slices, not str #56

Open GeorgeDUT opened 3 years ago

GeorgeDUT commented 3 years ago

I run: python train.py --config configs/maml/bandit/bandit-k5-n10.yaml --output-folder bandit/bandit-k5-n10/ --seed 1 --num-workers 8 but fail: Process SamplerWorker-1: Process SamplerWorker-2: Process SamplerWorker-3: Traceback (most recent call last): Traceback (most recent call last): File "/gpfs/share/home/.conda/envs/spinningup/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap self.run() File "/gpfs/share/home/MetaRLSAS/maml_rl/samplers/multi_task_sampler.py", line 333, in run self.sample(index, kwargs) File "/gpfs/share/home/.conda/envs/spinningup/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap self.run() File "/gpfs/share/home/MetaRLSAS/maml_rl/samplers/multi_task_sampler.py", line 263, in sample device=device) File "/gpfs/share/home/MetaRLSAS/maml_rl/samplers/multi_task_sampler.py", line 333, in run self.sample(index, kwargs) File "/gpfs/share/home/MetaRLSAS/maml_rl/samplers/multi_task_sampler.py", line 298, in create_episodes for item in self.sample_trajectories(params=params): File "/gpfs/share/home/MetaRLSAS/maml_rl/samplers/multi_task_sampler.py", line 263, in sample device=device) File "/gpfs/share/home/MetaRLSAS/maml_rl/samplers/multi_task_sampler.py", line 318, in sample_trajectories batch_ids = infos['batch_ids'] File "/gpfs/share/home/MetaRLSAS/maml_rl/samplers/multi_task_sampler.py", line 298, in create_episodes for item in self.sample_trajectories(params=params): File "/gpfs/share/home/MetaRLSAS/maml_rl/samplers/multi_task_sampler.py", line 318, in sample_trajectories batch_ids = infos['batch_ids'] TypeError: list indices must be integers or slices, not str TypeError: list indices must be integers or slices, not str

what's wrong with this?

tristandeleu commented 3 years ago

I am not able to reproduce this error. The script is running on my end with the command you give, with the latest version of the code. Did you change anything in the code, or are you running it straight from master? This error should not happen, because infos is not a list but a dict https://github.com/tristandeleu/pytorch-maml-rl/blob/21d4ba1ccd300a403928e6db553c9529bcc3fbdf/maml_rl/envs/utils/sync_vector_env.py#L60-L61