Issue: Unable to load `Doji070/rubert-tiny2-toxic-multilabel` with Transformers

#1
by SergeyFromIrkutsk - opened

Hello!

Thank you for publishing the model. I tried to use it with the standard Hugging Face Transformers API, but it cannot be loaded.

Environment

  • Python 3.12
  • transformers (latest available version)
  • torch (latest)
  • Windows 10

Code

from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("Doji070/rubert-tiny2-toxic-multilabel")
tokenizer = AutoTokenizer.from_pretrained("Doji070/rubert-tiny2-toxic-multilabel")

Error

ValueError: The checkpoint you are trying to load has model type
`MultiTaskToxicityEncoder` but Transformers does not recognize this architecture.

The traceback shows that AutoConfig cannot resolve

model_type = "MultiTaskToxicityEncoder"

because this architecture is not registered in Transformers.

Question

Is the repository missing the custom model implementation?

Normally, for a custom architecture, I would expect one of the following:

  • configuration_*.py
  • modeling_*.py
  • auto_map entries in config.json
  • or instructions to use trust_remote_code=True.

At the moment, AutoModel.from_pretrained() fails before the model weights are loaded.

Also, the example in the README uses:

outputs = model(**inputs)
probs = torch.sigmoid(outputs.logits)

which suggests a sequence-classification model, but the example loads the model with AutoModel instead of AutoModelForSequenceClassification. Could you clarify whether this is intentional?

Could you please check whether the repository is complete, or provide the correct way to load the model?

Thank you!

Sign up or log in to comment