Skip to content

fix: add missing @classmethod decorator to load_model_tokenizer#22

Open
amathxbt wants to merge 1 commit into
nesaorg:mainfrom
amathxbt:fix/missing-classmethod-load-model-tokenizer
Open

fix: add missing @classmethod decorator to load_model_tokenizer#22
amathxbt wants to merge 1 commit into
nesaorg:mainfrom
amathxbt:fix/missing-classmethod-load-model-tokenizer

Conversation

@amathxbt
Copy link
Copy Markdown

@amathxbt amathxbt commented May 9, 2026

Bug

The load_model_tokenizer method in HuggingFaceModelMixin (demo/nesa/backend/hf_models.py) is missing the @classmethod decorator.

Impact: When the method is called on the class (e.g. HuggingFaceModelMixin.load_model_tokenizer(model_name)), Python treats it as a regular instance method. This means cls receives model_name instead of the class, and model_name is never received — resulting in a TypeError at runtime.

The companion method perform_inference in the same class correctly uses @classmethod.

Fix

Added the missing @classmethod decorator before the method definition.

How to reproduce

HuggingFaceModelMixin.load_model_tokenizer("nesaorg_distilbert-sentiment-encrypted")
# TypeError: load_model_tokenizer() takes 1 positional argument but 2 were given

The load_model_tokenizer method in HuggingFaceModelMixin was missing the
@classmethod decorator, causing a TypeError when called on the class.
Without it, 'cls' receives the first positional argument (model_name)
instead of the class, making the method uncallable as intended.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant