Refactor: separate CI-specific weight validation into dedicated module (#15216)

Co-authored-by: Kangyan-Zhou <zky314343421@gmail.com>
This commit is contained in:
Alison Shao
2025-12-27 20:50:39 -08:00
committed by GitHub
co-authored by Kangyan-Zhou
parent d70c265533
commit 0e536600e8
5 changed files with 658 additions and 511 deletions
+5
View File
@@ -31,6 +31,7 @@ from transformers import (
)
from sglang.srt.entrypoints.engine import Engine
from sglang.srt.model_loader.ci_weight_validation import ci_validate_and_clean_hf_cache
from sglang.srt.utils import is_npu, load_image
from sglang.srt.utils.hf_transformers_utils import get_tokenizer
from sglang.test.test_utils import DEFAULT_PORT_FOR_SRT_TEST_RUNNER, calculate_rouge_l
@@ -251,6 +252,10 @@ class HFRunner:
# Apply model-specific patches
monkey_patch_gemma2_sdpa()
# Validate and clean corrupted files in HF cache (CI only)
# This is needed because HFRunner bypasses SGLang's weight validation
ci_validate_and_clean_hf_cache(model_path)
# Load the model and tokenizer
if self.model_type == "generation":
config = AutoConfig.from_pretrained(