AttributeError:'命名空间'对象没有属性' epochs_per_eval'

时间:2018-03-25 05:46:50

标签: python docker tensorflow namespaces

我尝试使用最新的docker模型运行tensorflow wide_deep训练模型。我已将官方模型安装到泊坞窗图像

docker run -it -p 8888:8888 --mount type=bind,src="$(pwd)",target=/notebooks/model tensorflow/tensorflow

正如文档中所提到的,我已将模型目录添加到python路径。

然后我使用python download_data.py

下载了数据集

关闭后,当我运行python wide_deep.py时会抛出此错误

/usr/local/lib/python2.7/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
INFO:tensorflow:Using config: {'_save_checkpoints_secs': 600, '_session_config': device_count {
  key: "GPU"
}
, '_keep_checkpoint_max': 5, '_task_type': 'worker', '_global_id_in_cluster': 0, '_is_chief': True, '_cluster_spec': <tensorflow.python.training.server_lib.ClusterSpec object at 0x7f69d55f0510>, '_evaluation_master': '', '_save_checkpoints_steps': None, '_keep_checkpoint_every_n_hours': 10000, '_service': None, '_num_ps_replicas': 0, '_tf_random_seed': None, '_master': '', '_num_worker_replicas': 1, '_task_id': 0, '_log_step_count_steps': 100, '_model_dir': '/tmp/census_model', '_save_summary_steps': 100}
Traceback (most recent call last):
  File "wide_deep.py", line 230, in <module>
    main(argv=sys.argv)
  File "wide_deep.py", line 199, in main
    model.train(input_fn=train_input_fn, hooks=train_hooks)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", line 352, in train
    loss = self._train_model(input_fn, hooks, saving_listeners)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", line 809, in _train_model
    input_fn, model_fn_lib.ModeKeys.TRAIN))
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", line 668, in _get_features_and_labels_from_input_fn
    result = self._call_input_fn(input_fn, mode)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", line 760, in _call_input_fn
    return input_fn(**kwargs)
  File "wide_deep.py", line 187, in train_input_fn
    return input_fn(train_file, flags.epochs_per_eval, True, flags.batch_size)
AttributeError: 'Namespace' object has no attribute 'epochs_per_eval'

我对此很陌生。我错过了什么?

2 个答案:

答案 0 :(得分:0)

代码中的错误。将epochs_per_eval更改为epochs_between_eval。它与命令行参数解析有关。由于名称epochs_per_eval没有参数,因此引发错误。

答案 1 :(得分:0)

看起来他们修复了这是主分支,但尚未进入最新版本:

https://github.com/tensorflow/models/pull/3777