eole-nlp / eole

Open language modeling toolkit based on PyTorch
https://eole-nlp.github.io/eole
MIT License
50 stars 11 forks source link

pre_word_vecs_enc attribute is not defined in the TrainConfig model #107

Open HURIMOZ opened 1 week ago

HURIMOZ commented 1 week ago

Hi all, Iʻm using pre-trained embeddings and I get this error:

(TY-EN) ubuntu@ip-172-31-2-199:~/TY-EN/eole/recipes/wmt17$ eole train --config wmt17_enty.yaml
[2024-09-19 04:42:34,864 INFO] Get special vocabs from Transforms: {'src': [], 'tgt': []}.
[2024-09-19 04:42:34,930 INFO] Reading encoder embeddings from data/en.wiki.bpe.vs25000.d300.w2v-256.txt
[2024-09-19 04:42:37,129 INFO]  Found 25000 total vectors in file.
[2024-09-19 04:42:37,129 INFO] After filtering to vectors in vocab:
[2024-09-19 04:42:37,135 INFO]  * enc: 16041 match, 7 missing, (99.96%)
[2024-09-19 04:42:37,135 INFO]
Saving encoder embeddings as:
        * enc: processed_data/.enc_embeddings.pt
Traceback (most recent call last):
  File "/home/ubuntu/TY-EN/TY-EN/bin/eole", line 33, in <module>
    sys.exit(load_entry_point('eole', 'console_scripts', 'eole')())
  File "/home/ubuntu/TY-EN/eole/eole/bin/main.py", line 39, in main
    bin_cls.run(args)
  File "/home/ubuntu/TY-EN/eole/eole/bin/run/train.py", line 69, in run
    train(config)
  File "/home/ubuntu/TY-EN/eole/eole/bin/run/train.py", line 56, in train
    train_process(config, device_id=0)
  File "/home/ubuntu/TY-EN/eole/eole/train_single.py", line 141, in main
    checkpoint, vocabs, transforms, config = _init_train(config)
  File "/home/ubuntu/TY-EN/eole/eole/train_single.py", line 96, in _init_train
    vocabs, transforms = prepare_transforms_vocabs(config, transforms_cls)
  File "/home/ubuntu/TY-EN/eole/eole/train_single.py", line 38, in prepare_transforms_vocabs
    prepare_pretrained_embeddings(config, vocabs)
  File "/home/ubuntu/TY-EN/eole/eole/modules/embeddings.py", line 331, in prepare_pretrained_embeddings
    config.pre_word_vecs_enc = enc_output_file
  File "/home/ubuntu/TY-EN/TY-EN/lib/python3.10/site-packages/pydantic/main.py", line 853, in __setattr__
    self.__pydantic_validator__.validate_assignment(self, name, value)
pydantic_core._pydantic_core.ValidationError: 1 validation error for TrainConfig
pre_word_vecs_enc
  Object has no attribute 'pre_word_vecs_enc' [type=no_such_attribute, input_value='processed_data/.enc_embeddings.pt', input_type=str]
    For further information visit https://errors.pydantic.dev/2.8/v/no_such_attribute

The code is attempting to assign a value to pre_word_vecs_enc which does not exist as a field in the TrainConfig model.

francoishernandez commented 1 week ago

Duplicate of #94, where my reply still stands -- https://github.com/eole-nlp/eole/issues/94#issuecomment-2352361168 Do not hesitate to PR the fix, should be relatively straightforward.