OpenNMT Forum

AttributeError when use src_ex_vocab

Hi. I met a bug in inputter.build_vocab function.
for (sub_n, sub_f), fd in zip(
f_iter, all_data):
has_vocab = (sub_n == ‘src’ and src_vocab) or
(sub_n == ‘tgt’ and tgt_vocab)
if sub_f.sequential and not has_vocab:
When the sub_n is src_ex_vocab(I use the dynamic_dict), the sub_f is a Rawfield (because of the definition about src_ex_vocab in get_fields function). So I got the bug above. Did I miss something?
And the full Traceback is below:

Traceback (most recent call last):
File “/users8/zkwang/.vscode-server/extensions/ms-python.python-2019.11.50794/pythonFiles/”, line 43, in
File “/users8/zkwang/.vscode-server/extensions/ms-python.python-2019.11.50794/pythonFiles/lib/python/old_ptvsd/ptvsd/ main .py”, line 432, in main
File “/users8/zkwang/.vscode-server/extensions/ms-python.python-2019.11.50794/pythonFiles/lib/python/old_ptvsd/ptvsd/ main .py”, line 316, in run_file
runpy.run_path(target, run_name=’ main ')
File “/users4/zkwang/miniconda3/envs/tmp/lib/python3.6/”, line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File “/users4/zkwang/miniconda3/envs/tmp/lib/python3.6/”, line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File “/users4/zkwang/miniconda3/envs/tmp/lib/python3.6/”, line 85, in _run_code
exec(code, run_globals)
File “/users8/zkwang/code/code/”, line 253, in
File “/users8/zkwang/code/code/”, line 249, in main
File “/users8/zkwang/code/code/”, line 234, in preprocess
build_save_vocab(train_dataset_files, fields, opt)
File “/users8/zkwang/code/code/”, line 164, in build_save_vocab
File “/users8/zkwang/code/code/onmt/inputters/”, line 457, in build_vocab
if sub_f.sequential and not has_vocab:
AttributeError: ‘RawField’ object has no attribute ‘sequential’