mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-11-26 23:29:34 +00:00
Some checks are pending
Behavior Check / ubuntu (push) Waiting to run
Behavior Check / windows (push) Waiting to run
CI (3rd-party) / ubuntu-26-llguidance (push) Waiting to run
CI (android) / default (push) Waiting to run
CI (android) / ndk (push) Waiting to run
CI (android) / arm64 (push) Waiting to run
CI (apple) / macos-latest-arm64 (push) Waiting to run
CI (cpu) / ubuntu (arm64, ubuntu-26.04-arm) (push) Waiting to run
CI (cpu) / ubuntu (x64, ubuntu-26.04) (push) Waiting to run
CI (cpu) / windows / arm64 (push) Waiting to run
CI (cpu) / windows / x64-cpu-static (push) Waiting to run
CI (cpu) / windows / x64-openblas (push) Waiting to run
CI (cpu) / build-cmake-pkg (push) Waiting to run
CI (CUDA, ubuntu) / cuda (push) Waiting to run
CI (CUDA, ubuntu) / hip (push) Waiting to run
CI (CUDA, ubuntu) / musa (push) Waiting to run
CI (ibm) / ubuntu-26-s390x (VXE OFF) (push) Waiting to run
CI (ibm) / ubuntu-26-zdnn-s390x (push) Waiting to run
CI (ibm) / ubuntu-24-ppc64le (push) Waiting to run
CI (opencl) / windows-2025-opencl-adreno (push) Waiting to run
CI (openvino) / ubuntu-24-openvino (push) Waiting to run
CI (openvino) / openvino-windows-2022 (push) Waiting to run
CI (riscv) / ubuntu-cpu-riscv64-native (push) Waiting to run
CI (virtgpu) / ubuntu-26-virtgpu (push) Waiting to run
CI (vulkan) / ubuntu-arm64 (push) Waiting to run
CI (vulkan) / ubuntu-llvmpipe (push) Waiting to run
CI (vulkan) / windows / arm64 (push) Waiting to run
CI (vulkan) / windows / x64 (push) Waiting to run
CI (wasi) / ubuntu-webgpu (push) Waiting to run
CI (ibm) / ubuntu-26-s390x (VXE ON) (push) Waiting to run
CI (sanitize) / ctest (ubuntu-26.04, ADDRESS) (push) Waiting to run
CI (sanitize) / ctest (ubuntu-26.04, THREAD) (push) Waiting to run
CI (sanitize) / ctest (ubuntu-26.04, UNDEFINED) (push) Waiting to run
CI (sycl) / ubuntu-26-sycl (fp16, ON) (push) Waiting to run
CI (sycl) / ubuntu-26-sycl (fp32, OFF) (push) Waiting to run
CI (sycl) / windows-latest-sycl (push) Waiting to run
CI (wasm) / ubuntu-webgpu (push) Waiting to run
CI (self-hosted CPU backend) / cpu-x64-high-perf (push) Waiting to run
CI (self-hosted CPU backend) / cpu-arm64-high-perf-graviton4 (push) Waiting to run
CI (self-hosted CUDA backend) / gpu-cuda (push) Waiting to run
CI (self-hosted CUDA backend) / gpu-rocm (gfx1151) (push) Waiting to run
CI (self-hosted CUDA backend) / gpu-rocm (gfx1201) (push) Waiting to run
CI (self-hosted KleidiAI backend) / cpu-arm64-graviton4-kleidiai (push) Waiting to run
CI (self-hosted Metal backend) / gpu-metal (push) Waiting to run
CI (self-hosted OpenVINO backend) / gpu-openvino-low-perf (push) Waiting to run
CI (self-hosted Vulkan backend) / gpu-vulkan-nvidia-cm (push) Waiting to run
CI (self-hosted Vulkan backend) / gpu-vulkan-nvidia-cm2 (push) Waiting to run
CI (self-hosted Vulkan backend) / gpu-vulkan-apple (push) Waiting to run
CI (self-hosted Vulkan backend) / gpu-vulkan-intel-linux (push) Waiting to run
CI (self-hosted Vulkan backend) / gpu-vulkan-intel-windows (push) Waiting to run
CI (self-hosted WebGPU backend) / gpu-webgpu-nvidia (push) Waiting to run
CI (self-hosted WebGPU backend) / gpu-webgpu-apple (push) Waiting to run
Code Style Checker / model-naming (push) Waiting to run
EditorConfig Checker / editorconfig (push) Waiting to run
HIP quality check / ubuntu-22-hip-quality-check (push) Waiting to run
Models Backend Check / cuda (push) Waiting to run
Models Backend Check / metal (push) Waiting to run
Models Backend Check / rocm (push) Waiting to run
Models Backend Check / vulkan-nvidia (push) Waiting to run
Models Backend Check / vulkan-amd (push) Waiting to run
Models Backend Check / webgpu-nvidia (push) Waiting to run
flake8 Lint / Lint (push) Waiting to run
Python Type-Check / python type-check (push) Waiting to run
Release / windows-openvino (push) Blocked by required conditions
Release / check-release (push) Waiting to run
Release / macos-cpu (arm64, arm64, -DGGML_METAL_EMBED_LIBRARY=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=13.3, macos-26) (push) Blocked by required conditions
Release / macos-cpu (x64, x64, -DGGML_METAL=OFF -DCMAKE_OSX_DEPLOYMENT_TARGET=13.3, macos-15-intel) (push) Blocked by required conditions
Release / ubuntu-cpu (26.04-s390x, ubuntu-26.04-s390x) (push) Blocked by required conditions
Release / windows-cpu / arm64 (push) Blocked by required conditions
Release / ubuntu-cpu (arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
Release / ubuntu-cpu (s390x, ubuntu-24.04-s390x) (push) Blocked by required conditions
Release / ubuntu-cpu (x64, ubuntu-22.04) (push) Blocked by required conditions
Release / ubuntu-vulkan (arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
Release / ubuntu-vulkan (x64, ubuntu-22.04) (push) Blocked by required conditions
Release / ubuntu-cuda (13.5, arm64) (push) Blocked by required conditions
Release / ubuntu-cuda (12.8, x64) (push) Blocked by required conditions
Release / ubuntu-cuda (13.5, x64) (push) Blocked by required conditions
Release / android-arm64 (push) Blocked by required conditions
Release / android-arm64-snapdragon (push) Blocked by required conditions
Release / linux-arm64-snapdragon (push) Blocked by required conditions
Release / ubuntu-24-openvino (push) Blocked by required conditions
Release / windows-cpu / x64 (push) Blocked by required conditions
Release / windows-rocm (10.0.0, x64, gfx1010;gfx1011;gfx1012;gfx1030;gfx1031;gfx1032;gfx1033;gfx1034;gfx1035;gfx1036;gfx1100;gfx1101;gfx1102;gfx1103;gfx1150;gfx1151;gfx1152;gfx1153;gfx1200;gfx1201) (push) Blocked by required conditions
Release / windows (arm64, opencl-adreno, -G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/opencl-arm64-release" -DGGML_OPENCL=ON -DGGML_OPENCL_USE_ADRENO_KERNELS=ON, ggml-opencl) (push) Blocked by required conditions
Release / windows (arm64, vulkan, -G "Ninja Multi-Config" -DGGML_VULKAN=ON -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake, ggml-vulkan) (push) Blocked by required conditions
Release / windows (x64, vulkan, -DGGML_VULKAN=ON, ggml-vulkan) (push) Blocked by required conditions
Release / windows-cuda (13.5, arm64) (push) Blocked by required conditions
Release / windows-cuda (12.4, x64) (push) Blocked by required conditions
Release / windows-cuda (13.5, x64) (push) Blocked by required conditions
Release / windows-sycl (push) Blocked by required conditions
Release / ubuntu-24-sycl (fp16, ON) (push) Blocked by required conditions
Release / ubuntu-24-sycl (fp32, OFF) (push) Blocked by required conditions
Release / ubuntu-24-rocm (10.0.0, x64, gfx908;gfx90a;gfx942;gfx950;gfx1010;gfx1011;gfx1012;gfx1030;gfx1031;gfx1032;gfx1033;gfx1034;gfx1035;gfx1036;gfx1100;gfx1101;gfx1102;gfx1103;gfx1150;gfx1151;gfx1152;gfx1200;gfx1201) (push) Blocked by required conditions
Release / ubuntu-26-zdnn (push) Blocked by required conditions
Release / ios-xcode (push) Blocked by required conditions
Release / ui-build (push) Blocked by required conditions
Server (sanitize) / server (RelWithDebInfo, ADDRESS) (push) Waiting to run
Server (sanitize) / server (RelWithDebInfo, UNDEFINED) (push) Waiting to run
Server (self-hosted) / server-metal (push) Waiting to run
Server (self-hosted) / server-cuda (push) Waiting to run
Server (self-hosted) / server-kleidiai (push) Waiting to run
Server / ubuntu (push) Waiting to run
Server / windows (push) Waiting to run
UI (self-hosted) / E2E Tests (push) Blocked by required conditions
UI (self-hosted) / Build static output (push) Waiting to run
UI (self-hosted) / Checks (push) Blocked by required conditions
UI / Build static output (push) Waiting to run
UI / Checks (push) Blocked by required conditions
UI / E2E Tests (push) Blocked by required conditions
The reasoning effort probe already renders every candidate level, but it dropped the ones the template raises on, so a request with such a level (e.g. max on Qwen3.8) reached the template and came back as a 500 on /v1/chat/completions, /v1/responses and /v1/messages. Keep the raising levels in reasoning_effort_rejected and reject them in oaicompat_chat_params_parse with an invalid_argument, which the server answers with a 400 listing the supported levels. Aliases and levels a template ignores are not rejected, so high on Qwen3.8 still renders as xhigh. Also trim the output_config.effort test to a single level.
126 lines
4.8 KiB
Python
126 lines
4.8 KiB
Python
#!/usr/bin/env python
|
|
import pytest
|
|
|
|
# ensure grandparent path is in sys.path
|
|
from pathlib import Path
|
|
import sys
|
|
|
|
from unit.test_tool_call import TEST_TOOL
|
|
path = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(path))
|
|
|
|
import datetime
|
|
from utils import *
|
|
from typing import Literal
|
|
|
|
server: ServerProcess
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def create_server():
|
|
global server
|
|
server = ServerPreset.tinyllama2()
|
|
server.model_alias = "tinyllama-2"
|
|
server.n_slots = 1
|
|
|
|
|
|
def test_reasoning_effort_rejected_by_template():
|
|
global server
|
|
server.jinja = True
|
|
# the template raises on max, and high is one of its levels
|
|
server.chat_template_file = '../../../models/templates/IFM-K2-Horizon.jinja'
|
|
server.start()
|
|
|
|
messages = [{"role": "user", "content": "Hello"}]
|
|
for path, data in [
|
|
("/chat/completions/input_tokens", {"messages": messages, "reasoning_effort": "max"}),
|
|
("/v1/responses/input_tokens", {"input": "Hello", "reasoning": {"effort": "max"}}),
|
|
("/v1/messages/count_tokens", {"model": "test", "messages": messages, "output_config": {"effort": "max"}}),
|
|
]:
|
|
res = server.make_request("POST", path, data=data)
|
|
assert res.status_code == 400, f"{path}: {res.body}"
|
|
|
|
res = server.make_request("POST", "/chat/completions/input_tokens", data={"messages": messages, "reasoning_effort": "high"})
|
|
assert res.status_code == 200, res.body
|
|
|
|
|
|
@pytest.mark.parametrize("tools", [None, [], [TEST_TOOL]])
|
|
@pytest.mark.parametrize("template_name,reasoning,expected_end", [
|
|
("deepseek-ai-DeepSeek-R1-Distill-Qwen-32B", "on", "<think>\n"),
|
|
("deepseek-ai-DeepSeek-R1-Distill-Qwen-32B","auto", "<think>\n"),
|
|
("deepseek-ai-DeepSeek-R1-Distill-Qwen-32B", "off", "<think>\n</think>"),
|
|
|
|
("Qwen-Qwen3-0.6B","auto", "<|im_start|>assistant\n"),
|
|
("Qwen-Qwen3-0.6B", "off", "<|im_start|>assistant\n<think>\n\n</think>\n\n"),
|
|
|
|
("Qwen-QwQ-32B","auto", "<|im_start|>assistant\n<think>\n"),
|
|
("Qwen-QwQ-32B", "off", "<|im_start|>assistant\n<think>\n</think>"),
|
|
|
|
("CohereForAI-c4ai-command-r7b-12-2024-tool_use","auto", "<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>"),
|
|
("CohereForAI-c4ai-command-r7b-12-2024-tool_use", "off", "<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|><|START_THINKING|><|END_THINKING|>"),
|
|
])
|
|
def test_reasoning(template_name: str, reasoning: Literal['on', 'off', 'auto'] | None, expected_end: str, tools: list[dict]):
|
|
global server
|
|
server.jinja = True
|
|
server.reasoning = reasoning
|
|
server.chat_template_file = f'../../../models/templates/{template_name}.jinja'
|
|
server.start()
|
|
|
|
res = server.make_request("POST", "/apply-template", data={
|
|
"messages": [
|
|
{"role": "user", "content": "What is today?"},
|
|
],
|
|
"tools": tools,
|
|
})
|
|
assert res.status_code == 200
|
|
prompt = res.body["prompt"]
|
|
|
|
assert prompt.endswith(expected_end), f"Expected prompt to end with '{expected_end}', got '{prompt}'"
|
|
|
|
|
|
@pytest.mark.parametrize("tools", [None, [], [TEST_TOOL]])
|
|
@pytest.mark.parametrize("template_name,format", [
|
|
("meta-llama-Llama-3.3-70B-Instruct", "%d %b %Y"),
|
|
("fireworks-ai-llama-3-firefunction-v2", "%b %d %Y"),
|
|
])
|
|
def test_date_inside_prompt(template_name: str, format: str, tools: list[dict]):
|
|
global server
|
|
server.jinja = True
|
|
server.chat_template_file = f'../../../models/templates/{template_name}.jinja'
|
|
server.start()
|
|
|
|
res = server.make_request("POST", "/apply-template", data={
|
|
"messages": [
|
|
{"role": "user", "content": "What is today?"},
|
|
],
|
|
"tools": tools,
|
|
})
|
|
assert res.status_code == 200
|
|
prompt = res.body["prompt"]
|
|
|
|
today_str = datetime.date.today().strftime(format)
|
|
assert today_str in prompt, f"Expected today's date ({today_str}) in content ({prompt})"
|
|
|
|
|
|
@pytest.mark.parametrize("add_generation_prompt", [False, True])
|
|
@pytest.mark.parametrize("template_name,expected_generation_prompt", [
|
|
("meta-llama-Llama-3.3-70B-Instruct", "<|start_header_id|>assistant<|end_header_id|>"),
|
|
])
|
|
def test_add_generation_prompt(template_name: str, expected_generation_prompt: str, add_generation_prompt: bool):
|
|
global server
|
|
server.jinja = True
|
|
server.chat_template_file = f'../../../models/templates/{template_name}.jinja'
|
|
server.start()
|
|
|
|
res = server.make_request("POST", "/apply-template", data={
|
|
"messages": [
|
|
{"role": "user", "content": "What is today?"},
|
|
],
|
|
"add_generation_prompt": add_generation_prompt,
|
|
})
|
|
assert res.status_code == 200
|
|
prompt = res.body["prompt"]
|
|
|
|
if add_generation_prompt:
|
|
assert expected_generation_prompt in prompt, f"Expected generation prompt ({expected_generation_prompt}) in content ({prompt})"
|
|
else:
|
|
assert expected_generation_prompt not in prompt, f"Did not expect generation prompt ({expected_generation_prompt}) in content ({prompt})"
|