Skip to content

[BUG] CodeGen 2.5 Tokenizer cannot be initialized anymore #94

Open

Description

@AlEscher

The code from https://huggingface.co/Salesforce/codegen25-7b-multi_P#causal-sampling-code-autocompletion and https://github.com/salesforce/CodeGen/tree/main/codegen25#sampling does not work currently.
Creating the tokenizer like

tokenizer = AutoTokenizer.from_pretrained("Salesforce/codegen25-7b-mono", trust_remote_code=True)
# or
tokenizer = AutoTokenizer.from_pretrained("Salesforce/codegen25-7b-multi", trust_remote_code=True)

gives an error:

Traceback (most recent call last):
  File "C:\teamscale\teamscale\server\com.teamscale.service\src\main\resources\com\teamscale\service\testimpact\embeddings_prioritization\ml\code_gen_embedder.py", line 4, in <module>
    tokenizer = AutoTokenizer.from_pretrained("Salesforce/codegen25-7b-multi", trust_remote_code=True)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Alessandro\AppData\Local\Programs\Python\Python312\Lib\site-packages\transformers\models\auto\tokenization_auto.py", line 905, in from_pretrained
    return tokenizer_class.from_pretrained(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Alessandro\AppData\Local\Programs\Python\Python312\Lib\site-packages\transformers\tokenization_utils_base.py", line 2213, in from_pretrained
    return cls._from_pretrained(
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Alessandro\AppData\Local\Programs\Python\Python312\Lib\site-packages\transformers\tokenization_utils_base.py", line 2447, in _from_pretrained
    tokenizer = cls(*init_inputs, **init_kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Alessandro\.cache\huggingface\modules\transformers_modules\Salesforce\codegen25-7b-multi\0bdf3f45a09e4f53b333393205db1388634a0e2e\tokenization_codegen25.py", line 136, in __init__
    super().__init__(
  File "C:\Users\Alessandro\AppData\Local\Programs\Python\Python312\Lib\site-packages\transformers\tokenization_utils.py", line 435, in __init__
    super().__init__(**kwargs)
  File "C:\Users\Alessandro\AppData\Local\Programs\Python\Python312\Lib\site-packages\transformers\tokenization_utils_base.py", line 1592, in __init__
    raise AttributeError(f"{key} conflicts with the method {key} in {self.__class__.__name__}")
AttributeError: add_special_tokens conflicts with the method add_special_tokens in CodeGen25Tokenizer

I have installed tiktoken==0.8.0 as installation of tiktoken==0.4.0 via pip fails.

Activity

  1. AlEscher commented on Nov 16, 2024

    @AlEscher
    Author

    Seems to be an issue with transformers: huggingface/transformers#33453

  2. ahmedashraf443 commented on Nov 26, 2024

    @ahmedashraf443

    any fix for this I'm having trouble quantizing the model into gguf format

  3. AlEscher commented on Nov 26, 2024

    @AlEscher
    Author

    any fix for this I'm having trouble quantizing the model into gguf format

    Only workaround I found for now is https://onetwobytes.com/2024/10/07/codegen2-5-llm-not-working-with-latest-huggingface-transformers/

  4. ahmedashraf443 commented on Nov 27, 2024

    @ahmedashraf443

    @AlEscher I tried converting it to ggml so that I can quantize it and convert it to gguf but I'm still having trouble. did you manage to quantize it or are you running the full weights?

  5. AlEscher commented on Nov 28, 2024

    @AlEscher
    Author

    @ahmedashraf443 I am running full weights. By installing the specified transformers version as in the article I am able to load the model and use it.

  6. ahmedashraf443 commented on Nov 28, 2024

    @ahmedashraf443

    Yeah i thought so . Sadly i can't run the full weights on my laptop and i tried quantuzing the model but it never works. Guess ill have to stick toqwen25.5-coder

  7. ai-nikolai commented on Jan 26, 2026

    @ai-nikolai

    Bumping this up, as it still doesn't work in 2026.

    @AlEscher - any success since?

  8. ArthurZucker commented on Jan 27, 2026

    @ArthurZucker

    If you are using remote code, it is expected to not really work when we update code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions