python - numpy.core._exceptions.MemoryError:无法为形状为 (1073741824, 0) 且数据类型为 float32 的数组分配 0 个字节
问题描述
我正在尝试训练StyleGAN2,但每次我开始训练时都会遇到此错误。奇怪的是它不能分配 0 字节。
日志:
Traceback (most recent call last):
File "train.py", line 561, in <module>
main()
File "train.py", line 553, in main
run_training(**vars(args))
File "train.py", line 416, in run_training
run_desc, training_options = setup_training_options(**hyperparam_options)
File "train.py", line 105, in setup_training_options
dataset_obj = dataset.load_dataset(**args.train_dataset_args) # try to load the data and see what comes out
File "C:\Temporary Software\stylegan2-ada\training\dataset.py", line 231, in load_dataset
mirror_augment=mirror_augment, repeat=repeat, shuffle=shuffle)
File "C:\Temporary Software\stylegan2-ada\training\dataset.py", line 114, in __init__
self._tf_labels_var = tflib.create_var_with_large_initial_value(self._np_labels, name='labels_var')
File "C:\Temporary Software\stylegan2-ada\dnnlib\tflib\tfutil.py", line 234, in create_var_with_large_initial_value
zeros = tf.zeros(initial_value.shape, initial_value.dtype)
File "C:\Users\Andrew\anaconda3\envs\stylegan\lib\site-packages\tensorflow\python\ops\array_ops.py", line 1871, in zeros
output = _constant_if_small(zero, shape, dtype, name)
File "C:\Users\Andrew\anaconda3\envs\stylegan\lib\site-packages\tensorflow\python\ops\array_ops.py", line 1829, in _constant_if_small
return constant(value, shape=shape, dtype=dtype, name=name)
File "C:\Users\Andrew\anaconda3\envs\stylegan\lib\site-packages\tensorflow\python\framework\constant_op.py", line 246, in constant
allow_broadcast=True)
File "C:\Users\Andrew\anaconda3\envs\stylegan\lib\site-packages\tensorflow\python\framework\constant_op.py", line 284, in _constant_impl
allow_broadcast=allow_broadcast))
File "C:\Users\Andrew\anaconda3\envs\stylegan\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 464, in make_tensor_proto
nparray = np.empty(shape, dtype=np_dt)
numpy.core._exceptions.MemoryError: Unable to allocate 0 bytes for an array with shape (1073741824, 0) and data type float32
这是一个麻木的错误还是我做错了什么?如果您能帮助我,我将不胜感激
解决方案
推荐阅读
- c++ - 如何监控 TLB 未命中(windows)?
- java - Hibernate 和 EJB:如何正确使用 @TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW)?
- python - 如何将文本文件中的多值字典作为字典导入 python 以及可能出现的问题。需要回答
- reactjs - 使用 React State Hook,设置多个状态后调用函数
- google-sheets - 尽管“不为空”,查询仍继续选择行
- php - 如何将页面添加到 wordpress 网站并通过自定义插件为其提供特定的短代码
- matlab - if else 条件未给出所需结果
- c++ - VSCode 中的 Google 测试设置帮助
- c# - C# SSH 客户端输出编码问题
- c# - 如何在 c# wpf 应用程序中单击按钮时显示 Devexpress XtraReport