skywalker023 / sodaverse

🥤🧑🏻‍🚀Code and dataset for our EMNLP 2023 paper - "SODA: Million-scale Dialogue Distillation with Social Commonsense Contextualization"
https://aclanthology.org/2023.emnlp-main.799/
MIT License
218 stars 12 forks source link

Python/MacOSX & Protocol Buffers #6

Closed JHenzi closed 1 year ago

JHenzi commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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