ai-forever / Kandinsky-2

Kandinsky 2 — multilingual text2image latent diffusion model
Apache License 2.0
2.77k stars 307 forks source link

Couldn't build proto file into description pool #10

Open erelsgl opened 1 year ago

erelsgl commented 1 year ago

While getting kandinsky model, I get the following error.

>>> model = get_kandinsky2('cuda', task_type='text2img')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/dist-packages/kandinsky2/__init__.py", line 64, in get_kandinsky2
    model = Kandinsky2(config, unet_path, device, task_type)
  File "/usr/local/lib/python3.10/dist-packages/kandinsky2/kandinsky2_model.py", line 30, in __init__
    self.tokenizer2 = AutoTokenizer.from_pretrained(self.config['tokenizer_name2'])
  File "/usr/local/lib/python3.10/dist-packages/transformers/models/auto/tokenization_auto.py", line 610, in from_pretrained
    return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/transformers/tokenization_utils_base.py", line 1775, in from_pretrained
    return cls._from_pretrained(
  File "/usr/local/lib/python3.10/dist-packages/transformers/tokenization_utils_base.py", line 1930, in _from_pretrained    tokenizer = cls(*init_inputs, **init_kwargs)
  File "/usr/local/lib/python3.10/dist-packages/transformers/models/t5/tokenization_t5_fast.py", line 134, in __init__
    super().__init__(
  File "/usr/local/lib/python3.10/dist-packages/transformers/tokenization_utils_fast.py", line 114, in __init__
    fast_tokenizer = convert_slow_tokenizer(slow_tokenizer)
  File "/usr/local/lib/python3.10/dist-packages/transformers/convert_slow_tokenizer.py", line 1162, in convert_slow_tokenizer
    return converter_class(transformer_tokenizer).converted()
  File "/usr/local/lib/python3.10/dist-packages/transformers/convert_slow_tokenizer.py", line 438, in __init__
    from .utils import sentencepiece_model_pb2 as model_pb2
  File "/usr/local/lib/python3.10/dist-packages/transformers/utils/sentencepiece_model_pb2.py", line 29, in <module>
    DESCRIPTOR = _descriptor.FileDescriptor(
  File "/usr/local/lib/python3.10/dist-packages/google/protobuf/descriptor.py", line 1066, in __new__
    return _message.default_pool.AddSerializedFile(serialized_pb)
TypeError: Couldn't build proto file into descriptor pool: duplicate file name sentencepiece_model.proto
erelsgl commented 1 year ago

I solved it using: export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python

erelsgl commented 1 year ago

For WSL, another needed export is: export LD_LIBRARY_PATH=/usr/lib/wsl/lib:$LD_LIBRARY_PATH