How to Pass Nested Config Values to Runner

I am using the opennmt-tf API in Python for implementing the model and the Runner class for training. The config values are passed to the Runner as a dictionary. The example in the PyPI site is as follows :-

config = {
“model_dir”: "/data/wmt-ende/checkpoints/,
“data”: {
“source_vocabulary”: “/data/wmt-ende/joint-vocab.txt”,
“target_vocabulary”: “/data/wmt-ende/joint-vocab.txt”,
“train_features_file”: “/data/wmt-ende/train.en”,
“train_labels_file”: “/data/wmt-ende/train.de”,
“eval_features_file”: “/data/wmt-ende/valid.en”,
“eval_labels_file”: “/data/wmt-ende/valid.de”,
}
}

The keys and values correspond to the Parameters used in the config YAML file.

However, there is no reference to how to pass multiple train_features_file. For example in the config YAML file, multiple files are passed like this :-

train_features_file:
- features_1.txt
- features_2.txt
- features_3.txt

How would these be passed in a dictionary? Should the values be a list or a nested dict?

Thanks.

Hi,

It should be a list of files:

{"train_features_file": ["features_1.txt", "features_2.txt", "features_3.txt"]}
1 Like

Thanks for the quick solution.