[ROCm][CI] Gate incompatible HF references on Transformers v5 (#41532)

Signed-off-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
Andreas Karatzas
2026-06-16 20:34:11 +08:00
committed by GitHub
parent 405c7cf283
commit 7e179e4bc0
10 changed files with 217 additions and 145 deletions
@@ -59,6 +59,12 @@ def get_fixture_path(filename):
)
def load_expected_fixture(filename):
fixture_path = get_fixture_path(filename)
with open(fixture_path) as f:
return json.load(f)
def assert_output_matches(output, expected_text, expected_token_ids):
generated = output.outputs[0]
assert generated.text == expected_text
@@ -76,7 +82,7 @@ def llm():
model_info.check_transformers_version(on_fail="skip")
try:
return LLM(
llm = LLM(
model=MODEL_NAME,
dtype="bfloat16",
enforce_eager=True,
@@ -86,14 +92,19 @@ def llm():
except Exception as e:
pytest.skip(f"Failed to load model {MODEL_NAME}: {e}")
# ROCm may compile decoder kernels on the first inference pass; warm up
# once so exact fixture assertions cover the steady-state path.
llm.chat(
messages=SINGLE_CONVERSATION,
sampling_params=SamplingParams(temperature=0.0, max_tokens=1),
use_tqdm=False,
)
return llm
def test_single_generation(llm):
fixture_path = get_fixture_path("expected_results_single.json")
if not os.path.exists(fixture_path):
pytest.skip(f"Fixture not found: {fixture_path}")
with open(fixture_path) as f:
expected = json.load(f)
expected = load_expected_fixture("expected_results_single.json")
outputs = llm.chat(
messages=SINGLE_CONVERSATION,
@@ -108,12 +119,7 @@ def test_single_generation(llm):
def test_batched_generation(llm):
fixture_path = get_fixture_path("expected_results_batched.json")
if not os.path.exists(fixture_path):
pytest.skip(f"Fixture not found: {fixture_path}")
with open(fixture_path) as f:
expected = json.load(f)
expected = load_expected_fixture("expected_results_batched.json")
outputs = llm.chat(
messages=BATCHED_CONVERSATIONS,