jxmorris12 / vec2text

utilities for decoding deep representations (like sentence embeddings) back to text
Other
747 stars 84 forks source link

PicklingError when running corrector training example. #22

Closed ArvinZhuang closed 10 months ago

ArvinZhuang commented 11 months ago

Hi @jxmorris12 , I got the below error when I ran the example in README:

Traceback (most recent call last):
  File "vec2text/run.py", line 16, in <module>
    main()
  File "vec2text/run.py", line 12, in main
    experiment.run()
  File "/xxx/vec2text/experiments.py", line 143, in run
    self.train()
  File "xxx/vec2text/experiments.py", line 164, in train
    torch.save(
  File "xxx/conda_envs/vec2text/lib/python3.8/site-packages/torch/serialization.py", line 619, in save
    _save(obj, opened_zipfile, pickle_module, pickle_protocol, _disable_byteorder_record)
  File "xxx/conda_envs/vec2text/lib/python3.8/site-packages/torch/serialization.py", line 831, in _save
    pickler.dump(obj)
_pickle.PicklingError: Can't pickle <class 'run_args.DataArguments'>: it's not the same object as run_args.DataArguments

I found the error can be fixed by commenting out these few lines in analyze_utils.py: https://github.com/jxmorris12/vec2text/blob/8f52f71fed2b16b29dc790b8b522c7e849225afc/vec2text/analyze_utils.py#L34-L40

any ideas?

jxmorris12 commented 11 months ago

Ok, so I think those lines were from a previous version of vec2text that didn't exist as a pypi module, so run_args was simply referred to as "run_args" (i.e. not vec2text.run_args). You can comment these lines out, since all of the modules have been retroactively fixed now so this shouldn't be necessary. In fact, if you want, please submit a pull request to remove these few lines :)