如何在Floydhub中指定模型目录?

问题描述 投票:1回答:1

我是Floydhub的新手。我正在尝试从this github repository和相应的教程运行代码。

为了训练,我成功使用了这个命令:

 floyd run --gpu --env tensorflow-1.2 --data janinanu/dataset 
 /data/2:tut_train 'python udc_train.py'

我在培训文件中调整了这一行,以便在Floydhub中工作:

tf.flags.DEFINE_string("input_dir", "/tut_train", "Directory containing 
input data files 'train.tfrecords' and 'validation.tfrecords'")

如上所述,这对培训没有任何问题。

现在进行测试,我真的没有找到关于如何指定存储训练输出的模型目录的任何细节。我使用model_dir作为挂载点来训练输出。我假设正确的命令看起来像这样:

floyd run --cpu --env tensorflow-1.2 --data janinanu/datasets
/data/2:tut_test --data janinanu/projects/retrieval-based-dialogue-system-
on-ubuntu-corpus/18/output:model_dir 'python udc_test.py     
--model_dir=?' 

我不知道在--model_dir=?放什么

相应地,我假设我必须调整测试文件中的一些行:

tf.flags.DEFINE_string("test_file", "/tut_test/test.tfrecords", "Path of   
test data in TFRecords format")
tf.flags.DEFINE_string("model_dir", "/model_dir", "Directory to load model    
checkpoints from")

......以及火车档案(虽然不确定......):

tf.flags.DEFINE_string("input_dir", "/tut_train", "Directory containing  
input data files 'train.tfrecords' and 'validation.tfrecords'")
tf.flags.DEFINE_string("model_dir", "/model_dir", "Directory to store   
model checkpoints (defaults to /model_dir)")

当我使用例如--model_dir=/model_dir和上面调整的代码,我得到这个错误:

2017-12-22 12:17:49,048 INFO - return func(*args, **kwargs)
2017-12-22 12:17:49,048 INFO - File "/usr/local/lib/python3.5/site-       
packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", 
line 543, in evaluate
2017-12-22 12:17:49,048 INFO - log_progress=log_progress)
2017-12-22 12:17:49,049 INFO - File "/usr/local/lib/python3.5/site-
packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", 
line 816, in _evaluate_model
2017-12-22 12:17:49,049 INFO - % self._model_dir)
2017-12-22 12:17:49,049 INFO - 
tensorflow.contrib.learn.python.learn.estimators._sklearn.NotFittedError: 
Couldn't find trained model at /model_dir

这并不令人意外。

谁能给我一些关于如何将训练输出提供给测试运行的澄清?

我还将在Floydhub论坛上发布这个问题。

谢谢!!

.

tensorflow nlp deep-learning
1个回答
2
投票

您可以像挂载数据一样挂载任何作业的输出。在你的例子中:

--data janinanu/projects/retrieval-based-dialogue-system- on-ubuntu-corpus/18/output:model_dir

应该将整个输出目录从第18行安装到新作业的/mount_dir

您可以通过查看作业页面来确认这一点(选择“数据”选项卡以查看在哪些路径上安装了哪些数据集)。

在您的情况下,您能否确认测试是否正在寻找正确的模型文件名?

我也将在FloydHub论坛上回应这个问题。

© www.soinside.com 2019 - 2024. All rights reserved.