我的代码在本地计算机上完全没问题,但是当我在谷歌云存储上运行时它会抛出异常(之前它也在谷歌云上运行)。有谁知道是什么原因?
"The replica master 0 exited with a non-zero status of 1. Termination reason: Error.
Traceback (most recent call last):\n [...]\n File \"/root/.local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py\", line 1001, in moving_average_update
x, value, momentum, zero_debias=True)
File \"/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/moving_averages.py\", line 70, in assign_moving_average
update_delta = _zero_debias(variable, value, decay)
File \"/usr/local/lib/python2.7/dist packages/tensorflow/python/training/moving_averages.py\", line 180, in _zero_debias
\"biased\", initializer=biased_initializer, trainable=False)\n File \"/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py\", line 988, in get_variable
custom_getter=custom_getter)\n File \"/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py\", line 890, in get_variable\n custom_getter=custom_getter)
File \"/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py\", line 348, in get_variable\n validate_shape=validate_shape)\n File \"/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py\", line 333, in _true_getter\n caching_device=caching_device, validate_shape=validate_shape)
File \"/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.py\", line 639, in _get_single_variable\n name, \"\".join(traceback.format_list(tb))))\nValueError: Variable batch_normalization_1/moving_mean/biased already exists, disallowed. Did you mean to set reuse=True in VarScope? Originally defined at:
File \"/root/.local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py\", line 1001, in moving_average_update
x, value, momentum, zero_debias=True)
File \"/root/.local/lib/python2.7/site-packages/keras/layers/normalization.py\", line 185, in call
self.momentum),
File \"/root/.local/lib/python2.7/site-packages/keras/engine/topology.py\", line 617, in __call__
output = self.call(inputs, **kwargs)
To find out more about why your job exited please check the logs: https://console.cloud.google.com/logs/viewer?
答案 0 :(得分:1)
正如 @Idavid 指出的那样,出现此问题是因为 Local 和 Cloud 软件包之间不兼容。这是一个简单的解决方案:
from setuptools import setup, find_packages
setup(name='Awesome project',
version='1.0',
packages=find_packages(),
include_package_data=True,
description='Awesome project',
author='Hadifar',
author_email='Your_email@gmail.com',
license='MIT',
install_requires=[
'keras==2.1.3',
'numpy==1.14.1',
'scipy==1.0.0',
'tensorflow==1.4.1',
'sklearn==0.19.1',
'h5py==2.7.1'],
zip_safe=False)
确保本地和云计算包相同。