tristandeleu / ntm-one-shot

One-shot Learning with Memory-Augmented Neural Networks
MIT License
421 stars 94 forks source link

Windows error 267 and ValueError: sample larger than population #6

Closed DavidZhang88 closed 7 years ago

DavidZhang88 commented 7 years ago

Hello ! After reading your paper, I try to execute you program,but everytime it will show me one of these two errors,Windows error 267 and ValueError: sample larger than population. I m a rookie in machine learning area, I have no idea how to figure out these problems,could you offer me some help please? Here is the two errors' traceback:

`Traceback (most recent call last(windows error 267)): File "", line 1, in runfile('C:/Users/Administrator/Desktop/work/task/2/ntm-one-shot-master/examples/omniglot.py', wdir='C:/Users/Administrator/Desktop/work/task/2/ntm-one-shot-master')

File "C:\ProgramData\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile execfile(filename, namespace)

File "C:\ProgramData\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 87, in execfile exec(compile(scripttext, filename, 'exec'), glob, loc)

File "C:/Users/Administrator/Desktop/work/task/2/ntm-one-shot-master/examples/omniglot.py", line 56, in omniglot()

File "C:/Users/Administrator/Desktop/work/task/2/ntm-one-shot-master/examples/omniglot.py", line 40, in omniglot for i, (example_input, example_output) in generator:

File "mann\utils\generators.py", line 37, in next return (self.num_iter - 1), self.sample(self.nb_samples)

File "mann\utils\generators.py", line 52, in sample nb_samples=self.nb_samples_per_class)

File "mann\utils\images.py", line 19, in get_shuffled_images for image in sampler(os.listdir(path))]

WindowsError: [Error 267] : './data/omniglot\matlab\space_img_to_motor.m/.'

all the m file could come out this error,not only space_img_to_motor.m

Traceback (most recent call last(ValueError: sample larger than population)):

File "", line 1, in runfile('C:/Users/Administrator/Desktop/work/task/2/ntm-one-shot-master/examples/omniglot.py', wdir='C:/Users/Administrator/Desktop/work/task/2/ntm-one-shot-master')

File "C:\ProgramData\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile execfile(filename, namespace)

File "C:\ProgramData\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 87, in execfile exec(compile(scripttext, filename, 'exec'), glob, loc)

File "C:/Users/Administrator/Desktop/work/task/2/ntm-one-shot-master/examples/omniglot.py", line 56, in omniglot()

File "C:/Users/Administrator/Desktop/work/task/2/ntm-one-shot-master/examples/omniglot.py", line 40, in omniglot for i, (example_input, example_output) in generator:

File "mann\utils\generators.py", line 37, in next return (self.num_iter - 1), self.sample(self.nb_samples)

File "mann\utils\generators.py", line 52, in sample nb_samples=self.nb_samples_per_class)

File "mann\utils\images.py", line 19, in get_shuffled_images for image in sampler(os.listdir(path))]

File "mann\utils\images.py", line 14, in sampler = lambda x: random.sample(x, nb_samples)

File "C:\ProgramData\Anaconda2\lib\random.py", line 323, in sample raise ValueError("sample larger than population")

ValueError: sample larger than population`

Thank you so much for your genorous.

tristandeleu commented 7 years ago

I think the issue here is that you don't have the Omniglot dataset downloaded in the data/omniglot folder. I updated the README with instructions to download the dataset and how it should look like in the data/omniglot folder. I'll try to make this error a bit more explicit.

DavidZhang88 commented 7 years ago

Thank you for your reply.but i have already downloaded the omniglot data and put it in that folder.i think not this reason because first time i run this program i forget to download data😂 and it shows me error 3. i searched error267, somebody imply it might be a bug of os module but i don't know how it exactly happened. i can sure that all these error come out from this code: File "mann\utils\images.py", line 19, in get_shuffled_images for image in sampler(os.listdir(path))]

File "mann\utils\images.py", line 14, in sampler = lambda x: random.sample(x, nb_samples) Thank you for your generous help again😊.

Oh,i move the file as your readme,then it worked! thankyou so much !

tristandeleu commented 7 years ago

Glad it helped! :)