I'm trying to load tokenizer and seq2seq model from pretrained models.
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("ozcangundes/mt5-small-turkish-summarization")
model = AutoModelForSeq2SeqLM.from_pretrained("ozcangundes/mt5-small-turkish-summarization")
But I got this error.
File ~/.local/lib/python3.8/site-packages/google/protobuf/descriptor.py:1028, in FileDescriptor.__new__(cls, name, package, options, serialized_options, serialized_pb, dependencies, public_dependencies, syntax, pool, create_key)
1026 raise RuntimeError('Please link in cpp generated lib for %s' % (name))
1027 elif serialized_pb:
-> 1028 return _message.default_pool.AddSerializedFile(serialized_pb)
1029 else:
1030 return super(FileDescriptor, cls).__new__(cls)
TypeError: Couldn't build proto file into descriptor pool: duplicate file name (sentencepiece_model.proto)
I tried updating or downgrading the protobuf version. But I couldn't fix
I ran into the same issue when trying to use the microsoft/deberta-v3-small model. That is, at first it complained about not being able to find protobuf
, and when I installed the latest, it asked for version 3.20.x
. The issue happened after I downgraded to the lower version.
Anyway, I was experimenting with it on a locally-running Jupyter notebook. Rerunning that cell didn't help. But when I chose to "Restart & Run All," the problem went away.
Therefore, to solve your issue, I believe that you need to restart the Python instance where it cached the latest version of protobuf
in the first place.
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("some_model")
# outcome: some error asking for `protobuf`
pip install protobuf
Rerun the code above; some error asking for [email protected]
pip uninstall protobuf
pip install protobuf==3.20
Rerun the code above; same error as in OP
Restart the Python instance (notebook, app, etc.); ✓ no error