Jupyter Notebook (only) Memory error, same code works on regular .py and works

I have a task for the Deep Learning class, and they provide the Jupyter laptop as the base code, the fact is that after starting the import and changing the data, the jupyter notebook through the "Memory Error", after some analysis, y tried to compile the same code in regular .py file and everything works fine.

The fact is that I should (preferably) use the Jupyter laptop as a basis for development, as it is more interactive for this kind of task.

<ipython-input-2-846f80a40ce2> in <module>()
  2 # Load the raw CIFAR-10 data
  3 cifar10_dir = 'datasets\\'
----> 4 X, y = load_CIFAR10(cifar10_dir)

C:\path\data_utils.pyc in load_CIFAR10(ROOT)
     18     f = os.path.join(ROOT, 'cifar10_train.p')
     19     print('Path:  ' + f );
---> 20     Xtr, Ytr = load_CIFAR_batch(f)
     21     return Xtr, Ytr
     22 

C:\path\data_utils.pyc in load_CIFAR_batch(filename)
     10         X = np.array(datadict['data'])
     11         Y = np.array(datadict['labels'])
---> 12         X = X.reshape(-1, 3, 32, 32).transpose(0,2,3,1).astype("float")
     13         return X, Y
     14 

MemoryError: 

The error is on line 12, I know that this is a memory allocation, but that does not mean that 4 GB of RAM is not enough, and this was confirmed when the code runs without problems outside of Jupyter.

, - Jupyter, Chrome, , .

:

  • Windows 10 4 .
  • Chrome 57.0.2987.133 (64- )
+6
5

-, , python .

, , windows python 2.7 , , , , , Conda .

, Conda , .

+1

. .

+1

.npy. . . , Firefox Chrome , Firefox .

: free -h : . : https://www.linuxatemyram.com/.

0

2 . , : https://superuser.com/questions/372881/is-there-a-technical-reason-why-32-bit-windows-is-limited-to-4gb- -

It also implies why the conda solution works.

But for a workaround without a lazy engineer, close the Chrome tabs that aren’t necessary and restart the kernel so that it starts again.

Kernel > Restart (& Run All)
0
source

You can reduce the data set for training, and testing can solve the memory error problem.

0
source

Source: https://habr.com/ru/post/1676732/


All Articles