tensorflow ranking 碰到的问题

tensorflow-ranking 链接:https://github.com/tensorflow/ranking

安装完成后,我想运行一下,看看效果。running scripts的指导应该是在命令行中输入程序运行所需参数以及运行tf_ranking_record.py。

Running Scripts

For ease of experimentation, we also provide a TFRecord example and a LIBSVM example in the form of executable scripts. This is particularly useful for hyperparameter tuning, where the hyperparameters are supplied as flags to the script.

TFRecord Example

  1. Set up the data and directory.

    MODEL_DIR=/tmp/tf_record_model && \
    TRAIN=tensorflow_ranking/examples/data/train_elwc.tfrecord && \
    EVAL=tensorflow_ranking/examples/data/eval_elwc.tfrecord && \
    VOCAB=tensorflow_ranking/examples/data/vocab.txt
  2. Build and run.

    rm -rf $MODEL_DIR && \
    bazel build -c opt \
    tensorflow_ranking/examples/tf_ranking_tfrecord_py_binary && \
    ./bazel-bin/tensorflow_ranking/examples/tf_ranking_tfrecord_py_binary \
    --train_path=$TRAIN \
    --eval_path=$EVAL \
    --vocab_path=$VOCAB \
    --model_dir=$MODEL_DIR \
    --data_format=example_list_with_context

我并不太懂,所以我按照我的理解,在tf_ranking_record.py中把所需参数设置成默认值,这样就不用再在运行时提供参数了:

flags.DEFINE_string("train_path", "data/train_elwc.tfrecord", "Input file path used for training.")
flags.DEFINE_string("eval_path", "data/eval_elwc.tfrecord", "Input file path used for eval.")
flags.DEFINE_string("vocab_path", "data/vocab.txt",
"Vocabulary path for query and document tokens.")
flags.DEFINE_string("model_dir","tmp/tf_record_model", "Output directory for models.")#训练得到的模型存放路径

运行程序,在pycharm的运行窗口第一行,提示我:Could not load dynamic library 'cudart64_100.dll'; dlerror: cudart64_100.dll not found。
最后面显示:cudaGetDevice()failed. Status:cudaGetErrorString symbol not found.
我在网上找了一下,有说更新显卡驱动的,我试了一下,并没有用。然后我看到这个:
http://www.pianshen.com/article/3040699942/
照着做程序就能正常跑起来了。我的理解是cuda版本的问题,我装的版本是10.1,程序需要的是10.0,所以照着上面的链接把cudart64_101.dll修改一下就没啥问题了。

 

posted on 2019-11-28 16:47  mhw-rookie  阅读(229)  评论(0)    收藏  举报