Skip to content
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
19 changes: 18 additions & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,25 @@ jobs:
- name: Lint formatting
run: uv run black --check .

- name: Write secrets for expensive tests
env:
MODELLAB_FILE_DOWNLOAD_TOKEN: ${{ secrets.MODELLAB_FILE_DOWNLOAD_TOKEN }}
run: |
if [ -z "$MODELLAB_FILE_DOWNLOAD_TOKEN" ]; then
echo "MODELLAB_FILE_DOWNLOAD_TOKEN is not set on the Scheduled Testing environment."
exit 1
fi
mkdir -p config
cat > config/secrets.toml << EOF
[modellab_files]
token = "${MODELLAB_FILE_DOWNLOAD_TOKEN}"

[demo]
api_key = "12345"
EOF

- name: Test with pytest
run: uv run pytest
run: uv run pytest --expensive-tests

- name: Run mypy
run: uv run mypy --follow-imports silent --exclude modelbench src/modelgauge
10 changes: 1 addition & 9 deletions src/modelgauge/suts/anthropic_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@

from modelgauge.general import APIException
from modelgauge.prompt import ChatRole, TextPrompt
from modelgauge.secret_values import InjectSecret, RequiredSecret, SecretDescription
from modelgauge.secret_values import RequiredSecret, SecretDescription
from modelgauge.sut import REFUSAL_RESPONSE, PromptResponseSUT, SUTResponse
from modelgauge.model_options import ModelOptions
from modelgauge.sut_capabilities import AcceptsTextPrompt
from modelgauge.sut_decorator import modelgauge_sut
from modelgauge.sut_registry import SUTS
from modelgauge.suts.openai_client import OpenAIChatMessage, _ROLE_MAP

logger = get_logger(__name__)
Expand Down Expand Up @@ -122,10 +121,3 @@ def translate_response(self, request: AnthropicRequest, response: AnthropicMessa
return SUTResponse(text=REFUSAL_RESPONSE)
assert len(text_blocks) == 1, f"Expected a single text block in the response, got {len(text_blocks)}."
return SUTResponse(text=text_blocks[0].text)


ANTHROPIC_SECRET = InjectSecret(AnthropicApiKey)

for model in ["claude-3-5-sonnet-20241022", "claude-3-5-haiku-20241022", "claude-3-7-sonnet-20250219"]:
# UID is the model name.
SUTS.register(AnthropicSUT, model, model, ANTHROPIC_SECRET)
19 changes: 0 additions & 19 deletions src/modelgauge/suts/huggingface_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
import tenacity
from modelgauge.auth.huggingface_inference_token import HuggingFaceInferenceToken
from modelgauge.prompt import TextPrompt
from modelgauge.secret_values import InjectSecret
from modelgauge.sut import PromptResponseSUT, SUTResponse
from modelgauge.model_options import ModelOptions
from modelgauge.sut_capabilities import AcceptsTextPrompt
from modelgauge.sut_decorator import modelgauge_sut
from modelgauge.sut_registry import SUTS
from pydantic import BaseModel
from tenacity import stop_after_attempt, wait_random_exponential

Expand Down Expand Up @@ -63,20 +61,3 @@ def evaluate(self, request: HuggingFaceChatRequest) -> HuggingFaceResponse:

def translate_response(self, request: HuggingFaceChatRequest, response: HuggingFaceResponse) -> SUTResponse:
return SUTResponse(text=response.generated_text)


HF_SECRET = InjectSecret(HuggingFaceInferenceToken)

SUTS.register(
HuggingFaceSUT,
"olmo-7b-0724-instruct-hf",
"https://flakwttqzmq493dw.us-east-1.aws.endpoints.huggingface.cloud",
HF_SECRET,
)

SUTS.register(
HuggingFaceSUT,
"olmo-2-1124-7b-instruct-hf",
"https://l2m28ramsifovtf6.us-east-1.aws.endpoints.huggingface.cloud",
HF_SECRET,
)
61 changes: 0 additions & 61 deletions src/modelgauge/suts/huggingface_chat_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,43 +255,6 @@ class HuggingFaceChatCompletionServerlessThinkingSUT(ThinkingMixin, HuggingFaceC

HF_SECRET = InjectSecret(HuggingFaceInferenceToken)

SUTS.register(
HuggingFaceChatCompletionDedicatedSUT,
"nvidia-llama-3-1-nemotron-nano-8b-v1",
"llama-3-1-nemotron-nano-8b-v-uhu",
None,
HF_SECRET,
)

DEDICATED_SUTS_AND_SERVERS = {
"athene-v2-chat": "ijf",
"aya-expanse-8b": "rfn",
"gemma-2-9b-it": "plf",
"gemma-2-9b-it-simpo": "zop",
"gemma-3-12b-it": "mxk",
"granite-3-1-8b-instruct": "twe",
"llama-3-1-tulu-3-8b": "bzk", # check
"llama-3-1-tulu-3-70b": "ome",
"mistral-nemo-instruct-2407": "mgt",
"mixtral-8x22b-instruct-v0-1": "kog",
"olmo-2-1124-13b-instruct": "ibo",
"olmo-2-0325-32b-instruct": "yft",
"qwen1-5-110b-chat": "gek",
"qwen2-5-7b-instruct": "hgy",
"qwq-32b": "usw",
"yi-1-5-34b-chat": "nlm", # check
}

for sut, endpoint in DEDICATED_SUTS_AND_SERVERS.items():
SUTS.register(
HuggingFaceChatCompletionDedicatedSUT,
sut + "-hf",
sut + "-" + endpoint,
None,
HF_SECRET,
)


# Dedicated SUTs that require a model name to be specified in the requests.
DEDICATED_SUTS_AND_SERVERS_AND_MODELS = {
"llama-3-3-70b-instruct": ("iqc", "meta-llama/Llama-3.3-70B-Instruct"),
Expand Down Expand Up @@ -331,27 +294,3 @@ class HuggingFaceChatCompletionServerlessThinkingSUT(ThinkingMixin, HuggingFaceC
"together",
HF_SECRET,
)
# Register serverless SUTs.
SUTS.register(
HuggingFaceChatCompletionServerlessSUT,
"cohere-c4ai-command-a-03-2025-hf",
"CohereLabs/c4ai-command-a-03-2025",
"cohere",
HF_SECRET,
)

SUTS.register(
HuggingFaceChatCompletionServerlessSUT,
"meta-llama-3_1-8b-instruct-hf-nebius",
"meta-llama/Llama-3.1-8B-Instruct",
"nebius",
HF_SECRET,
)

SUTS.register(
HuggingFaceChatCompletionServerlessSUT,
"google-gemma-3-27b-it-hf-nebius",
"google/gemma-3-27b-it",
"nebius",
HF_SECRET,
)
17 changes: 1 addition & 16 deletions src/modelgauge/suts/meta_llama_client.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
from typing import List, Optional

import requests # type: ignore
from httpx import Timeout
from llama_api_client import LlamaAPIClient
from llama_api_client.types import CreateChatCompletionResponse, MessageTextContentItem, ModerationCreateResponse

from modelgauge.prompt import TextPrompt
from modelgauge.retry_decorator import retry
from modelgauge.secret_values import InjectSecret, RequiredSecret, SecretDescription
from modelgauge.secret_values import RequiredSecret, SecretDescription
from modelgauge.sut import PromptResponseSUT, REFUSAL_RESPONSE, SUTResponse
from modelgauge.model_options import ModelOptions
from modelgauge.sut_capabilities import AcceptsTextPrompt
from modelgauge.sut_decorator import modelgauge_sut
from modelgauge.sut_registry import SUTS
from pydantic import BaseModel
from requests.adapters import HTTPAdapter, Retry # type: ignore

Expand Down Expand Up @@ -111,16 +109,3 @@ def translate_response(self, request: MetaLlamaChatRequest, response: MetaLlamaM
text = response.sut_response.completion_message.content.text
assert text is not None
return SUTResponse(text=text)


# Unauthorized models: ["Llama-4-Scout-17B-16E-Instruct-FP8", "Llama-4-Maverick-17B-128E-Instruct-FP8"]
CHAT_MODELS = ["Llama-3.3-8B-Instruct"]

for model_name in CHAT_MODELS:
SUTS.register(MetaLlamaSUT, "meta-" + model_name.lower() + "-llama", model_name, InjectSecret(MetaLlamaApiKey))
SUTS.register(
MetaLlamaModeratedSUT,
"meta-" + model_name.lower() + "-moderated-llama",
model_name,
InjectSecret(MetaLlamaApiKey),
)
24 changes: 0 additions & 24 deletions src/modelgauge/suts/openai_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,34 +319,10 @@ def translate_response(self, request: OpenAIResponsesRequest, response: Response
return SUTResponse(text=response.output_text, top_logprobs=top_logprobs)


SUTS.register(
OpenAIChatSUT,
"gpt-3.5-turbo",
"gpt-3.5-turbo",
InjectSecret(OpenAIApiKey),
InjectSecret(OpenAIOrganization),
)

SUTS.register(
OpenAIChatSUT,
"gpt-4o",
"gpt-4o",
InjectSecret(OpenAIApiKey),
InjectSecret(OpenAIOrganization),
)

SUTS.register(
OpenAIChatSUT,
"gpt-4o-20250508",
"gpt-4o",
InjectSecret(OpenAIApiKey),
InjectSecret(OpenAIOrganization),
)

SUTS.register(
OpenAIChatSUT,
"gpt-4o-mini",
"gpt-4o-mini",
InjectSecret(OpenAIApiKey),
InjectSecret(OpenAIOrganization),
)
36 changes: 0 additions & 36 deletions src/modelgauge/suts/together_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,40 +389,4 @@ def evaluate(self, request: TogetherChatRequest) -> TogetherChatResponse:
raise e


LANGUAGE_MODELS: dict[str, str] = {
# This was deprecated around 2024-08-29
# You may add some once they are available.
# Leaving this empty dict in the code as an example to get you started.
# "llama-2-7b": "meta-llama/Llama-2-7b-hf",
}
for uid, model_name in LANGUAGE_MODELS.items():
SUTS.register(TogetherCompletionsSUT, uid, model_name, InjectSecret(TogetherApiKey))

# Chat
CHAT_MODELS = {
"llama-3.1-8b-instruct-turbo-together": "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
"llama-3.1-405b-instruct-turbo-together": "meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo",
"llama-3.3-70b-instruct-turbo-together": "meta-llama/Llama-3.3-70B-Instruct-Turbo-Free",
"Mistral-7B-Instruct-v0.2": "mistralai/Mistral-7B-Instruct-v0.2",
"Mixtral-8x7B-Instruct-v0.1": "mistralai/Mixtral-8x7B-Instruct-v0.1",
"mistral-8x22b-instruct": "mistralai/Mixtral-8x22B-Instruct-v0.1",
"mistral-8x22b-instruct-nim": "mlc_ai_safety_2/nim/mistralai/mixtral-8x22b-instruct-v01-c5e6181e",
"deepseek-R1": "deepseek-ai/DeepSeek-R1",
"deepseek-v3-together": "deepseek-ai/DeepSeek-V3",
# No longer supported as of 2025-04-25
# "llama-2-13b-chat": "meta-llama/Llama-2-13b-chat-hf",
# N/A serverless on together as of 2025-03-24
# "deepseek-llm-67b-chat": "deepseek-ai/deepseek-llm-67b-chat",
"qwen2.5-7B-instruct-turbo-together": "Qwen/Qwen2.5-7B-Instruct-Turbo",
# "StripedHyena-Nous-7B": "togethercomputer/StripedHyena-Nous-7B",
}
for uid, model_name in CHAT_MODELS.items():
SUTS.register(TogetherChatSUT, uid, model_name, InjectSecret(TogetherApiKey))

DEDICATED_CHAT_MODELS = {}
for uid, model_name in DEDICATED_CHAT_MODELS.items():
SUTS.register(
TogetherDedicatedChatSUT, uid, model_name, InjectSecret(TogetherApiKey), InjectSecret(TogetherProjectId)
)

SUTS.register(TogetherThinkingSUT, "deepseek-R1-thinking", "deepseek-ai/DeepSeek-R1", InjectSecret(TogetherApiKey))
1 change: 0 additions & 1 deletion tests/modelbench_tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,6 @@ def test_invalid_benchmark_versions_can_not_be_called(self, version, runner):
assert result.exit_code == 2
assert "Invalid value for '--version'" in result.output

@pytest.mark.skip(reason="we have temporarily removed other languages")
def test_calls_score_benchmark_with_correct_v1_locale(self, runner, mock_run_benchmarks, sut_uid):
_ = runner(cli, ["benchmark", "general", "--locale", FR_FR, "--sut", sut_uid])

Expand Down
10 changes: 0 additions & 10 deletions tests/modelgauge_tests/sut_tests/test_anthropic_sut_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@

import pytest

from modelgauge.config import load_secrets_from_config
from modelgauge.dynamic_sut_factory import ModelNotSupportedError
from modelgauge.sut_definition import SUTDefinition
from modelgauge.suts.anthropic_api import AnthropicSUT
from modelgauge.suts.anthropic_sut_factory import AnthropicSUTFactory
from modelgauge_tests.utilities import expensive_tests


class FakeModel(dict):
Expand Down Expand Up @@ -73,11 +71,3 @@ def test_autocorrect_is_limited(factory):
def test_list_suts(factory):
suts = factory.list_suts()
assert "anthropic/claude-sonnet-4-5-20250929:anthropic" in [s.uid for s in suts]


@expensive_tests
def test_connection():
factory = AnthropicSUTFactory(load_secrets_from_config(path="."))
sut_definition = SUTDefinition(model="claude-sonnet-4-5-20250929", driver="anthropic")
sut = factory.make_sut(sut_definition)
assert sut.uid == "claude-sonnet-4-5-20250929:anthropic"
11 changes: 1 addition & 10 deletions tests/modelgauge_tests/sut_tests/test_google_sut_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

import pytest

from modelgauge.config import load_secrets_from_config
from modelgauge.dynamic_sut_factory import ModelNotSupportedError
from modelgauge.sut_definition import SUTDefinition
from modelgauge.suts.google_genai import GoogleGenAiSUT
from modelgauge.suts.google_sut_factory import GoogleSUTFactory
from modelgauge_tests.utilities import expensive_tests, FakeObject
from modelgauge_tests.utilities import FakeObject


class FakeModelsResponse(list):
Expand Down Expand Up @@ -93,11 +92,3 @@ def test_list_suts_excludes_interactions_only_models(factory):
)
uids = [s.uid for s in factory.list_suts()]
assert uids == ["google/gemini-2.5-flash:google"]


@expensive_tests
def test_connection():
factory = GoogleSUTFactory(load_secrets_from_config(path="."))
sut_definition = SUTDefinition(model="gemini-2.5-flash", driver="google")
sut = factory.make_sut(sut_definition)
assert sut.uid == "gemini-2.5-flash:google"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import pytest

from modelgauge.config import load_secrets_from_config
from modelgauge.dynamic_sut_factory import ProviderNotFoundError
from modelgauge.sut_definition import SUTDefinition
from modelgauge.suts.huggingface_chat_completion import (
Expand All @@ -13,7 +12,7 @@
HuggingFaceChatCompletionDedicatedSUTFactory,
HuggingFaceChatCompletionServerlessSUTFactory,
)
from modelgauge_tests.utilities import expensive_tests, FakeObject
from modelgauge_tests.utilities import FakeObject

RAW_SECRETS = {"hugging_face": {"token": "value"}}

Expand Down Expand Up @@ -90,14 +89,3 @@ def test_dedicated_list_suts():
factory = HuggingFaceChatCompletionDedicatedSUTFactory(RAW_SECRETS)

assert "google/gemma:hf-dedicated" in [s.uid for s in factory.list_suts()]


@expensive_tests
def test_connection():
factory = HuggingFaceChatCompletionServerlessSUTFactory(load_secrets_from_config(path="."))
sut_definition = SUTDefinition(model="gemma-3-27b-it", maker="google", driver="hfrelay", provider="nebius")
sut = factory.make_sut(sut_definition)
assert isinstance(sut, HuggingFaceChatCompletionServerlessSUT)
assert sut.uid == "google/gemma-3-27b-it:nebius:hfrelay"
assert sut.model == "google/gemma-3-27b-it"
assert sut.provider == "nebius"
11 changes: 0 additions & 11 deletions tests/modelgauge_tests/sut_tests/test_openai_sut_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
import pytest
from openai import OpenAI

from modelgauge.config import load_secrets_from_config
from modelgauge.dynamic_sut_factory import ModelNotSupportedError
from modelgauge.sut_definition import SUTDefinition
from modelgauge.suts.openai_client import OpenAIResponsesSUT
from modelgauge.suts.openai_sut_factory import OpenAISUTFactory
from modelgauge_tests.utilities import expensive_tests


@pytest.fixture
Expand Down Expand Up @@ -55,12 +53,3 @@ def test_make_unknown_sut_raises_error(openai_factory):
sut_definition = SUTDefinition(model="bogus", maker="openai", driver="openai")
with pytest.raises(ModelNotSupportedError):
openai_factory.make_sut(sut_definition)


@expensive_tests
def test_connection():
factory = OpenAISUTFactory(load_secrets_from_config(path="."))
sut_definition = SUTDefinition(model="gpt-4o", maker="openai", driver="openai")
sut = factory.make_sut(sut_definition)
assert sut.uid == "openai/gpt-4o:openai"
assert sut.model == "gpt-4o"
Loading
Loading