OpenNMT初体验
背景
初体验
源码安装sentencepiece
系统依赖
$ yum install cmake pkg-config gperfools-devel git cmake3
环境依赖
$ git clone https://github.com/google/sentencepiece
或者
$ git clone https://gitee.com/mirrors/sentencepiece.git
编译
mkdir build
cd build
cmake3 ..
make -j $(nproc)
sudo make install
sudo ldconfig -v
设置环境变量
export PKG_CONFIG_PATH='/usr/local/lib64/pkgconfig/'
echo $PKG_CONFIG_PATH
编译包
cd python
python setup.py build
结果
$ python setup.py build
running build
running build_py
running build_ext
-L/usr/local/lib64 -lsentencepiece -lsentencepiece_train
## cflags=-std=c++11 -I/usr/local/include
## libs=-L/usr/local/lib64 -lsentencepiece -lsentencepiece_train
building 'sentencepiece._sentencepiece' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
creating build/temp.linux-x86_64-2.7/src/sentencepiece
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c src/sentencepiece/sentencepiece_wrap.cxx -o build/temp.linux-x86_64-2.7/src/sentencepiece/sentencepiece_wrap.o -std=c++11 -I/usr/local/include
g++ -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-2.7/src/sentencepiece/sentencepiece_wrap.o -L/usr/lib64 -lpython2.7 -o build/lib.linux-x86_64-2.7/sentencepiece/_sentencepiece.so -L/usr/local/lib64 -lsentencepiece -lsentencepiece_train
安装包
python setup.py install
结果
Installed /usr/lib64/python2.7/site-packages/sentencepiece-0.1.94-py2.7-linux-x86_64.egg
Processing dependencies for sentencepiece==0.1.94
Finished processing dependencies for sentencepiece==0.1.94
安装OpenNMT
这里选择版本 OpenNMT-tf 1.23.1
下载编译安装
https://github.com/OpenNMT/OpenNMT-tf/releases/tag/v1.23.1
wget "https://github.com/OpenNMT/OpenNMT-tf/archive/v1.23.1.zip"
python setup.py build
sudo python setup.py install
envi数据集测试
在 https://nlp.stanford.edu/projects/nmt/ 获取Small的数据集来做实验。
运行测试例子
python examples/library/minimal_transformer_training.py --src train.en --tgt train.vi --src_vocab vocab.en --tgt_vocab vocab.vi train
运行日志
Step = 39850 ; Learning rate = 0.000443 ; Loss = 1.348421
Step = 39900 ; Learning rate = 0.000442 ; Loss = 1.340251
Step = 39950 ; Learning rate = 0.000442 ; Loss = 1.342783
Step = 40000 ; Learning rate = 0.000442 ; Loss = 1.340605
Saving checkpoint for step 40000
Step = 40050 ; Learning rate = 0.000442 ; Loss = 1.340491
Step = 40100 ; Learning rate = 0.000441 ; Loss = 1.341630
Step = 40150 ; Learning rate = 0.000441 ; Loss = 1.339766
Step = 40200 ; Learning rate = 0.000441 ; Loss = 1.341236
Step = 40250 ; Learning rate = 0.000441 ; Loss = 1.332443
Step = 40300 ; Learning rate = 0.000440 ; Loss = 1.336307
Step = 40350 ; Learning rate = 0.000440 ; Loss = 1.347900
Step = 40400 ; Learning rate = 0.000440 ; Loss = 1.344488
Step = 40450 ; Learning rate = 0.000439 ; Loss = 1.331781
运行推理例子
输入
python examples/library/minimal_transformer_training.py --src test.en --src_vocab vocab.en --model_dir checkpoint --tgt_vocab vocab.vi translate
输出
2020-12-13 12:57:39.643218: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA
2020-12-13 12:57:40.348221: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:964] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-12-13 12:57:40.348941: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties:
name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53
pciBusID: 0000:00:07.0
totalMemory: 15.78GiB freeMemory: 15.48GiB
2020-12-13 12:57:40.348974: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2020-12-13 12:57:40.864966: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-12-13 12:57:40.865019: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988] 0
2020-12-13 12:57:40.865031: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0: N
2020-12-13 12:57:40.865189: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14980 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:00:07.0, compute capability: 7.0)
Khoa học đằng sau một tiêu đề về khí hậu
Trong 4 phút , chuyên gia hoá học khí quyển Rachel <unk> giới thiệu sơ lược về những nỗ lực khoa học miệt mài đằng sau những tiêu đề táo bạo về biến đổi khí hậu , c ùng với đoàn nghiên cứu của mình -- hàng ngàn người đã cống hiến cho dự án này -- một chuyến bay mạo hiểm qua rừng già để tìm kiếm thông tin về một phân tử then chốt .
Tôi muốn cho các bạn biết về sự to lớn của những nỗ lực khoa học đã góp phần làm nên các dòng tít bạn thường thấy trên báo .
Có những dòng trông như thế này khi bàn về biến đổi khí hậu , và như thế này khi nói về chất lượng không khí hay khói bụi .
Cả hai đều là một nhánh của cùng một lĩnh vực trong ngành khoa học khí quyển .
Các tiêu đề gần đây trông như thế này khi Ban Điều hành Biến đổi khí hậu Liên chính phủ , gọi tắt là IPCC đưa ra bài nghiên cứu của họ về hệ thống khí quyển .
Nghiên cứu được viết bởi <unk> nhà khoa học từ 40 quốc gia khác nhau .
Họ viết gần 1000 trang về chủ đề này .
Và tất cả các trang đều được xem xét bởi 400 khoa học gia và nhà phê bình khác từ <unk> quốc gia .
Đó là cả một cộng đồng lớn , lớn đến nỗi trên thực tế cuộc tụ hội hằng năm của chúng tôi là hội nghị khoa học [ tự nhiên ] lớn nhất thế giới .
toy-ende数据集测试
获取语料
获取 10k 条 English-German 语料对
wget https://s3.amazonaws.com/opennmt-trainingdata/toy-ende.tar.gz
tar xf toy-ende.tar.gz
cd toy-ende
生成词典
onmt-build-vocab --size 50000 --save_vocab src-vocab.txt src-train.txt
onmt-build-vocab --size 50000 --save_vocab tgt-vocab.txt tgt-train.txt
准备训练配置文件
准备ymal 配置文件:data.yml
model_dir: run/
data:
train_features_file: toy-ende/src-train.txt
train_labels_file: toy-ende/tgt-train.txt
eval_features_file: toy-ende/src-val.txt
eval_labels_file: toy-ende/tgt-val.txt
source_words_vocabulary: toy-ende/src-vocab.txt
target_words_vocabulary: toy-ende/tgt-vocab.txt
训练
基于RNN的小序列到序列模型的训练和评估循环。
onmt-main train_and_eval --model_type NMTSmall --auto_config --config data.yml
结果
INFO:tensorflow:loss = 1.6043131, step = 99864 (11.058 sec)
INFO:tensorflow:source_words/sec: 11854
INFO:tensorflow:target_words/sec: 11764
INFO:tensorflow:global_step/sec: 10.0165
INFO:tensorflow:loss = 2.1295054, step = 99964 (9.983 sec)
INFO:tensorflow:source_words/sec: 11374
INFO:tensorflow:target_words/sec: 11321
INFO:tensorflow:Saving checkpoints for 100000 into run/model.ckpt.
INFO:tensorflow:Skip the current checkpoint eval due to throttle secs (18000 secs).
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2020-12-13-08:21:09
INFO:tensorflow:Graph was finalized.
2020-12-13 16:21:09.284142: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2020-12-13 16:21:09.284202: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-12-13 16:21:09.284219: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988] 0
2020-12-13 16:21:09.284239: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0: N
2020-12-13 16:21:09.284340: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14980 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:00:07.0, compute capability: 7.0)
INFO:tensorflow:Restoring parameters from run/model.ckpt-100000
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Finished evaluation at 2020-12-13-08:21:17
INFO:tensorflow:Saving dict for global step 100000: global_step = 100000, loss = 18.656565
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 100000: run/model.ckpt-100000
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Signatures INCLUDED in export for Eval: None
INFO:tensorflow:Signatures INCLUDED in export for Classify: None
INFO:tensorflow:Signatures INCLUDED in export for Regress: None
INFO:tensorflow:Signatures INCLUDED in export for Predict: ['serving_default']
INFO:tensorflow:Signatures INCLUDED in export for Train: None
2020-12-13 16:21:18.661172: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2020-12-13 16:21:18.661223: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-12-13 16:21:18.661246: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988] 0
2020-12-13 16:21:18.661257: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0: N
2020-12-13 16:21:18.661371: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14980 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:00:07.0, compute capability: 7.0)
INFO:tensorflow:Restoring parameters from run/model.ckpt-100000
INFO:tensorflow:Assets added to graph.
INFO:tensorflow:Assets written to: run/export/latest/temp-1607847677/assets
INFO:tensorflow:SavedModel written to: run/export/latest/temp-1607847677/saved_model.pb
INFO:tensorflow:Loss for final step: 0.20588136.
查看训练结果
cd run
tensorboard --logdir="."
显示内容
- 训练和调整损失 training and evaluation loss
- 训练速度training speed
- 学习率 learning rate
- 梯度规范 gradients norm
- 计算图 computation graphs
- 单词嵌入向量word embeddings
- 解码器采样概率 decoder sampling probability
推理
//结果输出在控制台
onmt-main infer --auto_config --config data.yml --features_file toy-ende/src-test.txt
//结果保存在文件中
onmt-main infer --auto_config --config="data.yml" --features_file="toy-ende/src-test.txt" --predictions_file="predict.txt"
结果
In Orlando , 32 km , vom Flughafen Sanford 56 km .
So gibt Irland die Zahl von 16 , 32 km , vom Flughafen Sanford 56 km .
So ist Sie immer sehr viel , und immer wieder auch dieser Seite im Ende .
默认情况下将使用最新的checkpoint,推理结果将打印在标准输出上。
平均checkpoint参数
onmt-average-checkpoints可用于平均多个checkpoint的参数,通常可提高模型性能。例如:
onmt-average-checkpoints \
--model_dir run \
--output_dir run/avg \
--max_count 5
结果
INFO:tensorflow:Averaging 5 checkpoints...
INFO:tensorflow:Listing variables...
INFO:tensorflow:Loading checkpoint run/model.ckpt-81771
INFO:tensorflow:Loading checkpoint run/model.ckpt-87664
INFO:tensorflow:Loading checkpoint run/model.ckpt-93426
INFO:tensorflow:Loading checkpoint run/model.ckpt-99172
INFO:tensorflow:Loading checkpoint run/model.ckpt-100000
2020-12-13 17:31:47.509729: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA
2020-12-13 17:31:48.198088: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:964] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-12-13 17:31:48.198806: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties:
name: Tesla V100-SXM2-16GB major: 7 minor: 0 memoryClockRate(GHz): 1.53
pciBusID: 0000:00:07.0
totalMemory: 15.78GiB freeMemory: 15.48GiB
2020-12-13 17:31:48.198840: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2020-12-13 17:31:48.708390: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-12-13 17:31:48.708452: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988] 0
2020-12-13 17:31:48.708464: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0: N
2020-12-13 17:31:48.708617: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14980 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:00:07.0, compute capability: 7.0)
INFO:tensorflow:Saving new checkpoint to run/avg
使用平均后的参数进行预测
onmt-main infer \
--config data.yml \
--features_file toy-ende/src-test.txt \
--checkpoint_path run/avg/model.ckpt-100000
导出模型
模型导出包含推理所需的所有信息:图形定义,权重和外部资产(如词汇文件)。它通常在磁盘上看起来像这样:
tree run/export/latest/1607847677/
run/export/latest/1607847677/
├── assets
│ ├── src-vocab.txt
│ └── tgt-vocab.txt
├── saved_model.pb
└── variables
├── variables.data-00000-of-00001
└── variables.index
** 自动导出 **
在train_and_eval运行类型中,可以按照一个或多个导出计划自动导出模型:
- last:export/latest在每次评估后导出模型(默认);
- final:模型export/final在训练结束时导出;
- best:export/best只有在到目前为止达到最佳评估损失时才会导出模型。导出计划由配置文件部分中的exporters字段设置eval,例如:
eval:
exporters: best
** 手动导出 **
也可以使用export运行类型手动导出模型。默认情况下,手动导出的模型位于export/manual/模型目录中;
可以使用命令行选项配置自定义目标--export_dir_base,例如:
onmt-main export --export_dir_base ~/my-models/ende --auto-config --config my_config.yml
** 使用导出的模型SavedModel **
使用导出的模型时,需要知道模型的输入和输出节点。可以使用TensorFlow提供的脚本: saved_model_cli进行检查,例如:
saved_model_cli show --dir toy-ende/export/latest/1507109306/ \
--tag_set serve --signature_def serving_default
结果
$ saved_model_cli show --dir run/export/latest/1607847677/ --tag_set serve --signature_def serving_default
The given SavedModel SignatureDef contains the following input(s):
inputs['length'] tensor_info:
dtype: DT_INT32
shape: (-1)
name: Placeholder_1:0
inputs['tokens'] tensor_info:
dtype: DT_STRING
shape: (-1, -1)
name: Placeholder:0
The given SavedModel SignatureDef contains the following output(s):
outputs['alignment'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 1, -1, -1)
name: seq2seq/strided_slice_2:0
outputs['length'] tensor_info:
dtype: DT_INT32
shape: (-1, 1)
name: seq2seq/strided_slice_1:0
outputs['log_probs'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 1)
name: seq2seq/strided_slice_3:0
outputs['tokens'] tensor_info:
dtype: DT_STRING
shape: (-1, 1, -1)
name: seq2seq/strided_slice:0
Method name is: tensorflow/serving/predict
examples/ 目录中提供了一些使用导出模型的示例:examples/serving 使用TensorFlow服务为模特服务examples/cpp 使用TensorFlow C ++ API进行推理
注意:因为使用的Python函数tf.py_func未在图中序列化,所以模型导出不支持图中分词,并且文本输入应该被分词。
其它
checkpoint保存配置
train:
# (optional) Save a checkpoint every this many steps.
save_checkpoints_steps: 5000
# (optional) How many checkpoints to keep on disk.
keep_checkpoint_max: 10
复制训练
如果有4个GPU,则添加--num_gpus选项来在4个GPU中并行计算。
onmt-main train [...] --num_gpus 4
并行训练
OpenNMT-tf还支持使用复制图的异步分布式训练。在此模式下,每个图形副本独立处理batch,计算梯度,并异步更新共享参数集。
和复制训练的区别在于:可以在多个机器上并行训练
要启用分布式培训,用户应使用train_and_eval运行类型并在命令行上进行设置:
chief worker 负责训练循环并管理检查点
list workor 运行训练循环的工作主机列表
list parameter server用于同步参数
然后应在每个具有所选任务的主机上启动训练实例,例如:
CUDA_VISIBLE_DEVICES=0 onmt-main train_and_eval [...]
--ps_hosts localhost:2222
--chief_host localhost:2223
--worker_hosts localhost:2224,localhost:2225
--task_type worker
--task_index 1
将在当前计算机和第一个GPU上启动worker 1。通过CUDA_VISIBLE_DEVICES正确设置,可以在单个多GPU机器上运行异步分布式培训。
重新启动训练
由于opennmt在运行过程中会记录检查点,把之前保存的结果记录下来,中断后,和初始运行命令一样,即可以继续执行
# Start the training.
onmt-main train_and_eval --model_type NMTSmall --auto_config --config data.yml
# ... the training is interrupted or stopped ...
# Continue from the latest checkpoint.
onmt-main train_and_eval --model_type NMTSmall --auto_config --config data.yml
注意:如果train是因为train_steps到达而停止,应该先继续增加此值
微调训练
retraining对于微调现有模型也很有用。例如,在机器翻译中,与从头开始训练相比,将通用模型适应特定域往往速度更快。
OpenNMT-tf提供了一些功能,使这个过程更容易:
- 该脚本onmt-update-vocab可用于更改检查点中包含的单词词汇表,同时保持共享单词的学习权重(例如,添加域术语)
- 命令行参数--checkpoint_path可用于从新的训练状态开始加载现有检查点的权重(例如: 使用新的学习速率计划和优化器变量)
采样 Sampling
输出分布的采样预测可以是用于反向翻译的有效解码策略。要启用此功能,应配置参数sampling_topk。可能的值是:
- k,样本中k个最有可能的tokens
- 0,来自完整输出分布的样本
- 1,没有采样(默认)例如:
params:
beam_width: 1
sampling_topk: 0
sampling_temperature: 1
** N最佳列表N-best list **
使用定向搜索为模型生成n个最佳列表。
infer:
n_best: 5
使用此选项,每个输入行将在输出中简单地生成N个连续行,从最佳到最差排序。请注意,N不能大于配置beam_width。
得分Scoring
通过score运行类型对现有翻译进行评分。
设置2个命令行选项:
--features_file,输入标签;
--predictions_file,翻译文件。
onmt-main score \
--config data.yml \
--features_file newstest2014.en.tok \
--predictions_file newstest2014.en.tok.out
onmt-main score --auto_config --config="data.yml" --features_file="toy-ende/src-test.txt" --predictions_file="predict.txt"
onmt-main score --auto_config --config="data.yml" --features_file="toy-ende/tgt-test.txt" --predictions_file="predict.txt"
** 内置标准模型 **
OpenNMT-tf附带了一组在目录中定义的标准模型。可以使用--model_type命令行选项直接选择这些模型,例如:
onmt-main train --model_type Transformer [...]
** 自定义模型 **
自定义模型模型是从Python代码定义的,以实现高水平的建模自由度。它们是opennmt.models.Model使用用户定义模块的实例。其中一些模块定义为包含其他模块,可用于设计复杂的体系结构:
opennmt.encoders.ParallelEncoder
opennmt.encoders.SequentialEncoder
opennmt.inputters.MixedInputter
opennmt.inputters.ParallelInputter
例如,这些容器模块可用于实现多源输入,多模式训练,混合字/字符嵌入和任意复杂的编码器架构(例如,混合卷积,RNN,自注意等)。
config/models Git存储库中的目录中提供了一些示例。
应使用--model命令行选项选择自定义模型文件,例如:
onmt-main train --model config/models/custom_model.py [...]
** 参数配置 **
见官方文档:http://opennmt.net/OpenNMT-tf/configuration.html
** 自动配置 **
预定义模型声明了默认参数,这些参数应该提供开箱即用的可靠性能。要启用自动配置,请使用--auto_config标志:
onmt-main train_and_eval --model_type Transformer --config my_data.yml --auto_config
用户提供的my_data.yml文件将极少需要数据配置。您可能还想配置检查点相关设置,记录频率和培训步骤数。在训练开始时,将记录实际使用的配置值。如果要更改其中一些,只需在配置文件中添加该参数即可覆盖默认值。
注意:默认训练值通常假设GPU具有至少8GB的内存和大的系统内存:如果遇到GPU内存不足问题,请尝试覆盖batch_size较低的值。
如果遇到CPU内存不足问题,请尝试覆盖sample_buffer_size固定值。
** 多个配置文件Multiple configuration files **
命令行接受多个配置文件,以便某些部分可以重复使用,例如:
onmt-main [...] --config config/opennmt-defaults.yml config/optim/adam_with_decay.yml \
config/data/toy-ende.yml
如果配置密钥重复,则最右侧配置文件中定义的值具有优先级。如果您不确定实际使用的配置或只是更喜欢使用单个文件,请考虑使用merge_config脚本:
onmt-merge-config config/opennmt-defaults.yml config/optim/adam_with_decay.yml \
config/data/toy-ende.yml > config/my_config.yml
** TensorFlow会话 session **
命令行选项--session_config可用于配置为执行TensorFlow图而创建的TensorFlow会话。
该选项采用包含tf.ConfigProto以文本格式序列化的消息的文件。
以下是启用allow_growthGPU选项的示例:
$ cat config/session_config.txt
gpu_options {
allow_growth: true
}
onmt-main [...] --session_config config/session_config.txt
有关可能的选项和值,请参阅该tf.ConfigProto文件。