ggerganov / llama.cpp

LLM inference in C/C++
MIT License
65.59k stars 9.41k forks source link

Bug: convert-hf-to-gguf.py - AttributeError: 'LlamaTokenizerFast' object has no attribute 'added_tokens_decoder' #8120

Closed abgulati closed 3 months ago

abgulati commented 3 months ago

What happened?

Hi! I'm trying to work with the DeepSeek-Coder-V2 models and have cloned their official HF repos. However when trying to run the convert-hf-to-gguf.py script, the following error occurs:

image

I have tried this with llama.cpp version b3131 and the latest b3222

Name and Version

llama-cli --version version: 3229 (6fcbf682) built with MSVC 19.37.32825.0 for x64

What operating system are you seeing the problem on?

Windows 11

Relevant log output

Traceback (most recent call last):
  File "M:\Storage\Softwares and drivers\To Add\Programming & Dev Tools\LLM-Tools\llama.cpp-b3222\llama.cpp\convert-hf-to-gguf.py", line 3096, in <module>
    main()
  File "M:\Storage\Softwares and drivers\To Add\Programming & Dev Tools\LLM-Tools\llama.cpp-b3222\llama.cpp\convert-hf-to-gguf.py", line 3081, in main
    model_instance.set_vocab()
  File "M:\Storage\Softwares and drivers\To Add\Programming & Dev Tools\LLM-Tools\llama.cpp-b3222\llama.cpp\convert-hf-to-gguf.py", line 2704, in set_vocab
    self._set_vocab_gpt2()
  File "M:\Storage\Softwares and drivers\To Add\Programming & Dev Tools\LLM-Tools\llama.cpp-b3222\llama.cpp\convert-hf-to-gguf.py", line 513, in _set_vocab_gpt2
    tokens, toktypes, tokpre = self.get_vocab_base()
                               ^^^^^^^^^^^^^^^^^^^^^
  File "M:\Storage\Softwares and drivers\To Add\Programming & Dev Tools\LLM-Tools\llama.cpp-b3222\llama.cpp\convert-hf-to-gguf.py", line 397, in get_vocab_base
    if tokenizer.added_tokens_decoder[i].special:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'LlamaTokenizerFast' object has no attribute 'added_tokens_decoder'
abgulati commented 3 months ago

Updating the Python Transformers package solves the issue:

pip show transformers # should be at least v4.34.x!

Update package with:

pip install transformers -U # may need to use the --user flag incase of permission errors