Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python/MacOSX & Protocol Buffers #6

Closed
JHenzi opened this issue Jan 27, 2023 · 2 comments
Closed

Python/MacOSX & Protocol Buffers #6

JHenzi opened this issue Jan 27, 2023 · 2 comments

Comments

@JHenzi
Copy link

JHenzi commented Jan 27, 2023

I was missing the binary and got that installed, installed the same (protocol buffers) with pip and I still get this when I tried to run it on OSX:

If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
@JHenzi
Copy link
Author

JHenzi commented Jan 27, 2023

Sorry, here's the full error:

Welcome to SODAverse!
Loading COSMO-xl...
Traceback (most recent call last):
  File "/Users/joe/Local Development/sodaverse/chat_with_cosmo.py", line 91, in <module>
    main()
  File "/Users/joe/Local Development/sodaverse/chat_with_cosmo.py", line 87, in main
    cosmo = CosmoAgent()
  File "/Users/joe/Local Development/sodaverse/chat_with_cosmo.py", line 12, in __init__
    self.tokenizer = AutoTokenizer.from_pretrained("allenai/cosmo-xl")
  File "/Users/joe/Local Development/sodaverse/lib/python3.10/site-packages/transformers/models/auto/tokenization_auto.py", line 676, in from_pretrained
    return tokenizer_class_fast.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
  File "/Users/joe/Local Development/sodaverse/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 1804, in from_pretrained
    return cls._from_pretrained(
  File "/Users/joe/Local Development/sodaverse/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 1959, in _from_pretrained
    tokenizer = cls(*init_inputs, **init_kwargs)
  File "/Users/joe/Local Development/sodaverse/lib/python3.10/site-packages/transformers/models/t5/tokenization_t5_fast.py", line 133, in __init__
    super().__init__(
  File "/Users/joe/Local Development/sodaverse/lib/python3.10/site-packages/transformers/tokenization_utils_fast.py", line 114, in __init__
    fast_tokenizer = convert_slow_tokenizer(slow_tokenizer)
  File "/Users/joe/Local Development/sodaverse/lib/python3.10/site-packages/transformers/convert_slow_tokenizer.py", line 1162, in convert_slow_tokenizer
    return converter_class(transformer_tokenizer).converted()
  File "/Users/joe/Local Development/sodaverse/lib/python3.10/site-packages/transformers/convert_slow_tokenizer.py", line 438, in __init__
    from .utils import sentencepiece_model_pb2 as model_pb2
  File "/Users/joe/Local Development/sodaverse/lib/python3.10/site-packages/transformers/utils/sentencepiece_model_pb2.py", line 92, in <module>
    _descriptor.EnumValueDescriptor(
  File "/Users/joe/Local Development/sodaverse/lib/python3.10/site-packages/google/protobuf/descriptor.py", line 755, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

@benimran0
Copy link

benimran0 commented Feb 11, 2023

Hello, you can just downgrade the protobuf's version.
pip install protobuf==3.20.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants