Skip to content

Models not working with transformers v5 #44

Description

@BramVanroy

Hello

I am trying to run the ultra model with the code block from the model page (latest pip release). https://huggingface.co/knowledgator/gliclass-multilang-ultra

from gliclass import GLiClassModel, ZeroShotClassificationPipeline
from transformers import AutoTokenizer

model = GLiClassModel.from_pretrained("knowledgator/gliclass-multilang-ultra")
tokenizer = AutoTokenizer.from_pretrained("knowledgator/gliclass-multilang-ultra")
pipeline = ZeroShotClassificationPipeline(model, tokenizer, classification_type='multi-label', device='cuda:0')

text = "NASA launched a new Mars rover to search for signs of ancient life."
labels = ["space", "politics", "sports", "technology", "health"]

results = pipeline(text, labels, threshold=0.5)[0]
for r in results:
    print(r["label"], "=>", r["score"])

But I am getting this error:

[transformers] The tied weights mapping and config for this model specifies to tie shared.weight to encoder.embed_tokens.weight, but both are present in the checkpoints with different values, so we will NOT tie them. You should update the config with `tie_word_embeddings=False` to silence this warning.
[transformers] GLiClassModel LOAD REPORT from: knowledgator/gliclass-multilang-ultra
Key                                             | Status  | 
------------------------------------------------+---------+-
model.encoder_model.encoder.embed_tokens.weight | MISSING | 

Notes:
- MISSING:      those params were newly initialized because missing from the checkpoint. Consider training on your downstream task.
[transformers] You are using a model of type `GLiClass` to instantiate a model of type ``. This may be expected if you are loading a checkpoint that shares a subset of the architecture (e.g., loading a `sam2_video` checkpoint into `Sam2Model`), but is otherwise not supported and can yield errors. Please verify that the checkpoint is compatible with the model you are instantiating.
  0%|                                                                                                                                              | 0/1 [00:00<?, ?it/s][transformers] `use_return_dict` is deprecated! Use `return_dict` instead!

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