(Solved) Model esm-1b is not defined

EDIT : found the solution. Posted here for future reference :smiley:
As this PR is not yet merged : Add ESM to huggingface by liujas000 路 Pull Request #13662 路 huggingface/transformers 路 GitHub

We can use the following command to install the temp PR directly

!git clone -b add_esm-proper --single-branch https://github.com/liujas000/transformers.git 
!pip -q install ./transformers

Note that in this branch, it鈥檚 transformers version 4.13


original quesion

Hi,

It seems https://huggingface.co/facebook/esm-1b is not usable.
I.e.
both the given commands in the model document result in errors (tested in Transformers version 4.18.0 and 4.5.1 ):

from transformers import ESMForMaskedLM, ESMTokenizer
error as
ImportError: cannot import name 'ESMForMaskedLM' from 'transformers' (/opt/conda/lib/python3.7/site-packages/transformers/__init__.py)

and

from transformers import AutoModelForMaskedLM
model = AutoModelForMaskedLM.from_pretrained("facebook/esm-1b")

error as:

/opt/conda/lib/python3.7/site-packages/transformers/models/auto/configuration_auto.py in __getitem__(self, key)
    385             return self._extra_content[key]
    386         if key not in self._mapping:
--> 387             raise KeyError(key)
    388         value = self._mapping[key]
    389         module_name = model_type_to_module_name(key)

KeyError: 'esm'

Any ideas would be very appreciate!