wu~~ 2023-02-14 17:05 采纳率: 55.6%
浏览 33

theano0.9+lasagne0.2训练手写数字集出现报错

theano0.9+lasagne0.2训练手写数字集出现报错

报错如下

Traceback (most recent call last):
  File "D:\developer_tools\anaconda3\envs\lasagne0.2_py35\lib\site-packages\theano\compile\function_module.py", line 884, in __call__
    self.fn() if output_subset is None else\
MemoryError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:/Desktop/paper/Theano-LtRRE-master/Theano-LtRRE-master-py3-test/mnist.py", line 232, in <module>
    main()
  File "D:/Desktop/paper/Theano-LtRRE-master/Theano-LtRRE-master-py3-test/mnist.py", line 191, in main
    train_err += train_fn(inputs, targets)
  File "D:\developer_tools\anaconda3\envs\lasagne0.2_py35\lib\site-packages\theano\compile\function_module.py", line 898, in __call__
    storage_map=getattr(self.fn, 'storage_map', None))
  File "D:\developer_tools\anaconda3\envs\lasagne0.2_py35\lib\site-packages\theano\gof\link.py", line 325, in raise_with_op
    reraise(exc_type, exc_value, exc_trace)
  File "D:\developer_tools\anaconda3\envs\lasagne0.2_py35\lib\site-packages\six.py", line 718, in reraise
    raise value.with_traceback(tb)
  File "D:\developer_tools\anaconda3\envs\lasagne0.2_py35\lib\site-packages\theano\compile\function_module.py", line 884, in __call__
    self.fn() if output_subset is None else\
MemoryError: 
Apply node that caused the error: Elemwise{Composite{(i0 * (i1 + Abs(i1)))}}(TensorConstant{(1, 1, 1, 1) of 0.5}, Elemwise{Add}[(0, 0)].0)
Toposort index: 107
Inputs types: [TensorType(float64, (True, True, True, True)), TensorType(float64, 4D)]
Inputs shapes: [(1, 1, 1, 1), (32, 128, 10, 10)]
Inputs strides: [(8, 8, 8, 8), (102400, 800, 80, 8)]
Inputs values: [array([[[[ 0.5]]]]), 'not shown']
Outputs clients: [[CorrMM{valid, (1, 1), (1, 1)}(Elemwise{Composite{(i0 * (i1 + Abs(i1)))}}.0, Subtensor{::, ::, ::int64, ::int64}.0), CorrMM_gradWeights{valid, (1, 1), (1, 1)}(Elemwise{Composite{(i0 * (i1 + Abs(i1)))}}.0, Elemwise{Composite{((i0 * i1) + (i0 * i1 * sgn(i2)))}}[(0, 1)].0, Subtensor{int64}.0, Subtensor{int64}.0)]]

HINT: Re-running with most Theano optimization disabled could give you a back-trace of when this node was created. This can be done with by setting the Theano flag 'optimizer=fast_compile'. If that does not work, Theano optimizations can be disabled with 'optimizer=None'.
HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.

进程已结束,退出代码为 1

我没有下载cuda 当前环境是python3.5 lasagne0.2 theano0.9

请问如何解决这类问题

  • 写回答

2条回答 默认 最新

  • zhazha强 2023-02-14 17:24
    关注

    这个错误是内存不足导致的,通常是因为训练数据量太大,超出了你的计算机内存的限制。你可以尝试以下几种解决方法:

    1.减少训练数据量,可以尝试使用更小的批量大小(batch size),或者减少训练数据的维度。

    2.使用更大的内存,可以考虑更换计算机或者增加内存条。

    3.开启Theano的fast_compile优化,这个优化可以降低Theano编译函数的开销,减少内存使用。你可以在代码中添加以下语句:

    import theano
    theano.config.optimizer = 'fast_compile'
    
    
    
    评论

报告相同问题?

问题事件

  • 创建了问题 2月14日