Skip to content

Add missing model_name fixes #768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions examples/custom_models/local_mt_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,33 +84,33 @@ class LocalMTClient(LightevalModel):
"""

def __init__(self, config, env_config) -> None:
self.model = config.model
self.model_name = config.model_name
self.model_definition_file_path = config.model_definition_file_path
self.batch_size = 32
self.device = "cuda" if torch.cuda.is_available() else "cpu"

self.model_info = ModelInfo(
model_name=config.model,
model_name=config.model_name,
model_sha="",
model_dtype=None,
model_size="",
)

# Update model initialization to handle both models
if "seamless-m4t" in config.model:
self._tokenizer = AutoProcessor.from_pretrained(config.model)
self._model = SeamlessM4Tv2ForTextToText.from_pretrained(config.model)
if "seamless-m4t" in config.model_name:
self._tokenizer = AutoProcessor.from_pretrained(config.model_name)
self._model = SeamlessM4Tv2ForTextToText.from_pretrained(config.model_name)
self.model_type = "seamless-4mt"
self.batch_size = 1
logger.info(
"Using batch size of 1 for seamless-4mt model because it the target language needs to be set for the entire batch."
)
elif "madlad400" in config.model:
self._tokenizer = AutoTokenizer.from_pretrained(config.model)
self._model = AutoModelForSeq2SeqLM.from_pretrained(config.model)
elif "madlad400" in config.model_name:
self._tokenizer = AutoTokenizer.from_pretrained(config.model_name)
self._model = AutoModelForSeq2SeqLM.from_pretrained(config.model_name)
self.model_type = "madlad400"
else:
raise ValueError(f"Unsupported model: {config.model}")
raise ValueError(f"Unsupported model: {config.model_name}")

self._model.to(self.device)
self._model.eval()
Expand Down
4 changes: 2 additions & 2 deletions src/lighteval/models/endpoints/openai_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def __init__(self, config: OpenAIModelConfig, env_config) -> None:
self.sampling_params = self.generation_parameters.to_vllm_openai_dict()

self.model_info = ModelInfo(
model_name=config.model,
model_name=config.model_name,
model_sha="",
model_dtype=None,
model_size="",
Expand All @@ -103,7 +103,7 @@ def __init__(self, config: OpenAIModelConfig, env_config) -> None:
self.API_RETRY_SLEEP = 3
self.API_RETRY_MULTIPLIER = 2
self.CONCURENT_CALLS = 100
self.model = config.model
self.model_name = config.model_name
try:
self._tokenizer = tiktoken.encoding_for_model(self.model)
except KeyError:
Expand Down