facebookresearch / esm

Evolutionary Scale Modeling (esm): Pretrained language models for proteins
MIT License
3.16k stars 627 forks source link

ESM2 embedding extraction error: 'NoneType' object has no attribute 'arch' #255

Closed HannesStark closed 2 years ago

HannesStark commented 2 years ago

Thanks for the great tool!

I encountered an error when generating embeddings with ESM2 like this: python scripts/extract.py esm2_t33_650M_UR50D sequences.fasta . --repr_layers 0 32 33 --include mean per_tok

The error is

  File "/data/rsg/nlp/hstark/esm/scripts/extract.py", line 140, in <module>
    main(args)
  File "/data/rsg/nlp/hstark/esm/scripts/extract.py", line 63, in main
    model, alphabet = pretrained.load_model_and_alphabet(args.model_location)
  File "/data/rsg/nlp/hstark/miniconda3/envs/esm/lib/python3.10/site-packages/esm/pretrained.py", line 24, in load_model_and_alphabet
    return load_model_and_alphabet_hub(model_name)
  File "/data/rsg/nlp/hstark/miniconda3/envs/esm/lib/python3.10/site-packages/esm/pretrained.py", line 55, in load_model_and_alphabet_hub
    return load_model_and_alphabet_core(model_data, regression_data)
  File "/data/rsg/nlp/hstark/miniconda3/envs/esm/lib/python3.10/site-packages/esm/pretrained.py", line 81, in load_model_and_alphabet_core
    alphabet = esm.Alphabet.from_architecture(model_data["args"].arch)
AttributeError: 'NoneType' object has no attribute 'arch'

When using ESM1b this does not happen and everything works: python scripts/extract.py esm1b_t33_650M_UR50S sequences.fasta . --repr_layers 0 32 33 --include mean per_tok

Any help with resolving this issue would be greatly appreciated!

nikitos9000 commented 2 years ago

Hi @HannesStark! It seems like you still have old esm package installed so it was imported instead of the current version, please remove it via "pip uninstall fair-esm" and install the current one with e.g. "pip install -e ."

HannesStark commented 2 years ago

Thank you @nikitos9000 and my apologies for the basic mistake. Everything is working excellently!

linyuheng594 commented 1 year ago

hello ,my version of fair-esm-2.0.1,but this bug is still. How can I do?