OpenNMT Forum

Attribute lookup Field.<lambda> on failed

I use conda and I try to install openNMT-py
I install torchtext version 0.4.0 But the error is occur whte i try to preprocess the data.
Of course I try pip install -r requirements.txt and setup.
also try conda install ~~

command :

python3 -train_src data/src-train.txt -train_tgt data/tgt-train.txt -valid_src data/src-val.txt -valid_tgt data/tgt-val.txt -save_data data/demo


Traceback (most recent call last):
File “”, line 218, in
File “”, line 199, in main
‘train’, fields, src_reader, tgt_reader, opt)
File “”, line 142, in build_save_dataset, vocab_path)
File “/home/chanjun_park/miniconda3/envs/WAT/lib/python3.6/site-packages/torch/”, line 209, in save
return _with_file_like(f, “wb”, lambda f: _save(obj, f, pickle_module, pickle_protocol))
File “/home/chanjun_park/miniconda3/envs/WAT/lib/python3.6/site-packages/torch/”, line 134, in _with_file_like
return body(f)
File “/home/chanjun_park/miniconda3/envs/WAT/lib/python3.6/site-packages/torch/”, line 209, in
return _with_file_like(f, “wb”, lambda f: _save(obj, f, pickle_module, pickle_protocol))
File “/home/chanjun_park/miniconda3/envs/WAT/lib/python3.6/site-packages/torch/”, line 282, in _save
_pickle.PicklingError: Can’t pickle <function Field. at 0x7fed4f81e950>: attribute lookup Field. on failed

Hello! @park

I remember I got this issue on one of my machines, but did not have a note. I think it was about the Torch version. What is the Torch version you have? When in trouble, the easiest way to install Torch was following the provided command at: - scroll down, select your system specifications and use the command.

Kind regards,

Thank you !! I solve the problem!!
when i command pip install --upgrade -r requirements.txt