MemoryError:ipython convnet模块。这是正常的吗?

时间:2015-06-12 07:17:42

标签: python ipython

我只是自己完成Stanford's cs231n course的任务。我不是课程的学生。我在their subreddit中问了同样的问题,但似乎没有人在那里。希望在这里找到一两个老兵。

我在VMWare Player中使用32位Ubuntu 14.04。我给它4GB的RAM(但因为32位可能没有使用整体)。我的电脑有16GB RAM,运行Windows 8.1 Pro。

我正在运行convnet ipython模块并且正处于小段数据中。这是我得到的错误:

---------------------------------------------------------------------------
MemoryError                               Traceback (most recent call last)
<ipython-input-7-5c1aed72acc3> in <module>()
      6           X_train[:50], y_train[:50], X_val, y_val, model, two_layer_convnet,
      7           reg=0.001, momentum=0.9, learning_rate=0.0001, batch_size=10, num_epochs=10,
----> 8           verbose=True)

.../classifier_trainer.pyc in train(self, X, y, X_val, y_val, model, loss_function, reg, learning_rate, momentum, learning_rate_decay, update, sample_batches, num_epochs, batch_size, acc_frequency, verbose, decay_rate)
    132 
    133         # evaluate val accuracy
--> 134         scores_val = loss_function(X_val, model)
    135         y_pred_val = np.argmax(scores_val, axis=1)
    136         val_acc = np.mean(y_pred_val ==  y_val)

.../convnet.pyc in two_layer_convnet(X, model, y, reg)
     49 
     50   # Compute the forward pass
---> 51   a1, cache1 = conv_relu_pool_forward(X, W1, b1, conv_param, pool_param)
     52   scores, cache2 = affine_forward(a1, W2, b2)
     53 

.../layer_utils.pyc in conv_relu_pool_forward(x, w, b, conv_param, pool_param)
     43   - cache: Object to give to the backward pass
     44   """
---> 45   a, conv_cache = conv_forward_fast(x, w, b, conv_param)
     46   s, relu_cache = relu_forward(a)
     47   out, pool_cache = max_pool_forward_fast(s, pool_param)

.../fast_layers.pyc in conv_forward_fast(x, w, b, conv_param)
     30   # x_cols = im2col_indices(x, w.shape[2], w.shape[3], pad, stride)
     31   x_cols = im2col_cython(x, w.shape[2], w.shape[3], pad, stride)
---> 32   res = w.reshape((w.shape[0], -1)).dot(x_cols) + b.reshape(-1, 1)
     33 
     34   out = res.reshape(w.shape[0], out.shape[2], out.shape[3], x.shape[0])

MemoryError: 

正如预期的那样,python已达到1.8GB。因此,内存错误是由于没有RAM。

但是我想知道这个小数据集是否正常超过1.8GB?我应该尝试使用64位Ubuntu在虚拟机中为其提供8GB的RAM吗?

提前致谢。

1 个答案:

答案 0 :(得分:1)

如果您正在运行32位ubuntu,如果我没记错的话,可寻址空间是〜2Gb应用程序/进程。你的过程只看到2Gb。使用64位Ubuntu和4Gb Ram就足够了。它是阻止你而不是VM内存的32位。