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

AttributeError: 'list' object has no attribute 'keys' #41

Open
rishabh004-ai opened this issue Nov 15, 2021 · 9 comments
Open

AttributeError: 'list' object has no attribute 'keys' #41

rishabh004-ai opened this issue Nov 15, 2021 · 9 comments

Comments

@rishabh004-ai
Copy link

rishabh004-ai commented Nov 15, 2021

Traceback (most recent call last):
  File "train_maml_system.py", line 14, in <module>
    maml_system = ExperimentBuilder(model=model, data=data, args=args, device=device)
  File "/workspace/assign_3/HowToTrainYourMAMLPytorch/experiment_builder.py", line 53, in __init__
    self.data = data(args=args, current_iter=self.state['current_iter'])
  File "/workspace/assign_3/HowToTrainYourMAMLPytorch/data.py", line 569, in __init__
    self.dataset = FewShotLearningDatasetParallel(args=args)
  File "/workspace/assign_3/HowToTrainYourMAMLPytorch/data.py", line 159, in __init__
    "train": {key: len(self.datasets['train'][key]) for key in list(self.datasets['train'].keys())},
AttributeError: 'list' object has no attribute 'keys'

i am getting this error for mini imagenet dataset

@AntreasAntoniou
Copy link
Owner

I am really sorry about this. I recently applied some quick refactoring suggested by sourcery. I checked the changed but it seems this one escaped my attention. I'll resolve this shortly.

@rishabh004-ai
Copy link
Author

Thanks a lot.

@AntreasAntoniou
Copy link
Owner

Can you give it a try now?

@AntreasAntoniou
Copy link
Owner

I am hoping that 8696470 fixes it.

@rishabh004-ai
Copy link
Author

rishabh004-ai commented Nov 15, 2021

No, I think line 159 in data.py also needs to be changed.

@AntreasAntoniou
Copy link
Owner

Is this alright now? I triple checked and it runs fine on my local machine.

@AlanZhang1995
Copy link

I think I find the reason.
Please check whether your mini_imagenet_full_size.json is correct.
It would become {} if you did not put the dataset in correct place at the first time you run the script.
Hope this will help!

@sherry0451
Copy link

I have the same problem. Is that right to place file mini_imagenet_full_size.tar.bz2 under the folder 'datasets'? Is there other parameters needed to be modified?

@sherry0451
Copy link

I solved my problem as follows. First, automatic unzip code didn't work for my testing, so I unzip the file in terminal manually. Then I deleted the json file for miniimagenet in folder 'dataset'. Then it works.

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

4 participants