Fine tunning of Donut rvl-cdip throughing an error. module 'google.protobuf.descriptor' has no attribute '_internal_create_key'
Author: AIritik
Pull request: no

When I am trying to run these lines....
**from transformers import DonutProcessor, VisionEncoderDecoderModel, BartConfig

processor = DonutProcessor.from_pretrained("nielsr/donut-base")
model = VisionEncoderDecoderModel.from_pretrained("nielsr/donut-base", config=config)**

Getting this error
AttributeError Traceback (most recent call last)
/tmp/ipykernel_3566149/2070905111.py in
2 from transformers import AutoTokenizer, AutoModel
3
----> 4 tokenizer = AutoTokenizer.from_pretrained("nielsr/donut-base")
5
6 model = AutoModel.from_pretrained("nielsr/donut-base")

~/.local/lib/python3.8/site-packages/transformers/models/auto/tokenization_auto.py in from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwargs)
653 f"Tokenizer class {tokenizer_class_candidate} does not exist or is not currently imported."
654 )
--> 655 return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
656
657 # Otherwise we have to be creative.

~/.local/lib/python3.8/site-packages/transformers/tokenization_utils_base.py in from_pretrained(cls, pretrained_model_name_or_path, *init_inputs, **kwargs)
1799 [logger.info](http://logger.info/)(f"loading file {file_path} from cache at {resolved_vocab_files[file_id]}")
1800
-> 1801 return cls._from_pretrained(
1802 resolved_vocab_files,
1803 pretrained_model_name_or_path,

~/.local/lib/python3.8/site-packages/transformers/tokenization_utils_base.py in _from_pretrained(cls, resolved_vocab_files, pretrained_model_name_or_path, init_configuration, use_auth_token, cache_dir, local_files_only, _commit_hash, *init_inputs, **kwargs)
1954 # Instantiate tokenizer.
1955 try:
-> 1956 tokenizer = cls(*init_inputs, **init_kwargs)
1957 except OSError:
1958 raise OSError(

~/.local/lib/python3.8/site-packages/transformers/models/xlm_roberta/tokenization_xlm_roberta_fast.py in init(self, vocab_file, tokenizer_file, bos_token, eos_token, sep_token, cls_token, unk_token, pad_token, mask_token, **kwargs)
153 mask_token = AddedToken(mask_token, lstrip=True, rstrip=False) if isinstance(mask_token, str) else mask_token
154
--> 155 super().init(
156 vocab_file,
157 tokenizer_file=tokenizer_file,

~/.local/lib/python3.8/site-packages/transformers/tokenization_utils_fast.py in init(self, *args, **kwargs)
116 # We need to create and convert a slow tokenizer to build the backend
117 slow_tokenizer = self.slow_tokenizer_class(*args, **kwargs)
--> 118 fast_tokenizer = convert_slow_tokenizer(slow_tokenizer)
119 else:
120 raise ValueError(

~/.local/lib/python3.8/site-packages/transformers/convert_slow_tokenizer.py in convert_slow_tokenizer(transformer_tokenizer)
1160 converter_class = SLOW_TO_FAST_CONVERTERS[tokenizer_class_name]
1161
-> 1162 return converter_class(transformer_tokenizer).converted()

~/.local/lib/python3.8/site-packages/transformers/convert_slow_tokenizer.py in init(self, *args)
436 super().init(*args)
437
--> 438 from .utils import sentencepiece_model_pb2 as model_pb2
439
440 m = model_pb2.ModelProto()

~/.local/lib/python3.8/site-packages/transformers/utils/sentencepiece_model_pb2.py in
32 syntax="proto2",
33 serialized_options=b"H\003",
---> 34 create_key=_descriptor._internal_create_key,
35 serialized_pb=(
36 b'\n\x19sentencepiece_model.proto\x12\rsentencepiece"\xa1\n\n\x0bTrainerSpec\x12\r\n\x05input\x18\x01'

AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key'

In the env I have installed these libraries

aiohttp==3.8.3
aiosignal==1.3.1
async-timeout==4.0.2
attrs==22.2.0
brotlipy==0.7.0
certifi @ file:///croot/certifi_1671487769961/work/certifi
cffi @ file:///croot/cffi_1670423208954/work
charset-normalizer @ file:///tmp/build/80754af9/charset-normalizer_1630003229654/work
cryptography @ file:///croot/cryptography_1673298753778/work
datasets==2.8.0
dill==0.3.6
filelock==3.9.0
flit_core @ file:///opt/conda/conda-bld/flit-core_1644941570762/work/source/flit_core
frozenlist==1.3.3
fsspec==2022.11.0
huggingface-hub==0.11.1
idna @ file:///croot/idna_1666125576474/work
mkl-fft==1.3.1
mkl-random @ file:///home/builder/ci_310/mkl_random_1641843545607/work
mkl-service==2.4.0
multidict==6.0.4
multiprocess==0.70.14
numpy @ file:///croot/numpy_and_numpy_base_1672336185480/work
packaging==23.0
pandas==1.5.2
Pillow==9.3.0
protobuf==3.19.6
pyarrow==10.0.1
pycparser @ file:///tmp/build/80754af9/pycparser_1636541352034/work
pyOpenSSL @ file:///opt/conda/conda-bld/pyopenssl_1643788558760/work
PySocks @ file:///home/builder/ci_310/pysocks_1640793678128/work
python-dateutil==2.8.2
pytz==2022.7.1
PyYAML==6.0
regex==2022.10.31
requests @ file:///opt/conda/conda-bld/requests_1657734628632/work
responses==0.18.0
sentencepiece==0.1.97
six @ file:///tmp/build/80754af9/six_1644875935023/work
tokenizers==0.13.2
torch==1.13.1
torchaudio==0.13.1
torchvision==0.14.1
tqdm==4.64.1
transformers @ git+https://github.com/huggingface/transformers.git@2411f0e465e761790879e605a4256f3d4afb7f82
typing_extensions @ file:///croot/typing_extensions_1669924550328/work
urllib3 @ file:///croot/urllib3_1670526988650/work
xxhash==3.2.0
yarl==1.8.2

Comments:
This looks like an error we had with recent versions of protobuf. Are you absolutely sure the env information you are pasting is correct? Could you try doing `pip install protobuf<=3.20.2 --upgrade` in your env?

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.