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

"mtrand.pyx", line 1120, in mtrand.RandomState.choice ValueError: a must be greater than 0 #26

Open
vidigen opened this issue Apr 13, 2020 · 6 comments

Comments

@vidigen
Copy link

vidigen commented Apr 13, 2020

First of all thx a lot for posting this very interesting work.

"mtrand.pyx", line 1120, in mtrand.RandomState.choice
ValueError: a must be greater than 0

In running the maml.py I incurred in the error above. I believe is a numpy error... How do you get around it?

Thanks a lot,

@vidigen
Copy link
Author

vidigen commented Apr 13, 2020

to be more precise it gets stuck in line 80 of core.py code:
query = df[(df['class_id'] == k) & (~df['id'].isin(support_k[k]['id']))].sample(self.q)

@Shandilya21
Copy link

Hi, @oscarknagg thanks for posting this work.
Hi @vidigen I have similar issues, in, it raises a different error which is something like

File "../few_shot/train.py", line 108, in fit

for batch_index, batch in enumerate(dataloader):

File "/home/shandilya/nlp_project/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 193, in iter
return _DataLoaderIter(self)
File "/home/shandilya/nlp_project/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 493, in init
self._put_indices()
File "/home/shandilya/nlp_project/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 591, in _put_indices
indices = next(self.sample_iter, None)
File "../few_shot/core.py", line 80, in iter
query = df[(df['class_id'] == k) & (~df['id'].isin(support_k[k]['id']))].sample(self.q)
File "/home/shandilya/nlp_project/lib/python3.5/site-packages/pandas/core/generic.py", line 2144, in sample
locs = rs.choice(axis_length, size=n, replace=replace, p=weights)
File "mtrand.pyx", line 1165, in mtrand.RandomState.choice

ValueError: Cannot take a larger sample than population when 'replace=False'

Did you know the solution for this problem? Initially, I thought it was the problem related to the NumPy sample (with or without replacement)? But as you said, it was associated with few_shot/core.py raises an error at line 80.

Thanks for your help and I am looking for your comment.

@Sgsouham
Copy link

@oscarknagg any updates on this??

@ucalyptus
Copy link

@Shandilya21 did you solve this ?

@ceevaaa
Copy link

ceevaaa commented Nov 15, 2020

Which dataset you guys are trying to run this?

@AlisonYao
Copy link

Solved this problem by deleting the hidden .DS_store file in my images_evaluation folder. There could also be a .DS_store file in the images_background folder (somehow I don't have it though). It seems that whenever episode_classes has the class 0, the path is directed to .DS_store instead of the actual data folder, which caused an error.

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

6 participants