add fast test for whisper#2484
Conversation
|
@copilot SUBFAILED(model_id='openai/whisper-tiny') test/cli/test_cli_test_model_smoke.py::TestCliWhisperSmoke::test_whisper_capture_onnx_graph - AssertionError: Expected encoder.onnx in output, got: set() |
The root cause is that |
|
@copilot still unresolved FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/.cache/huggingface/hub' |
…_dir between Whisper encoder and decoder saves
The root cause was more subtle than a missing directory. The Fixed in the latest commit by placing a temporary marker file ( |
| ).save_pretrained(model_path) | ||
|
|
||
|
|
||
| def _save_local_tiny_whisper(model_path: Path): |
There was a problem hiding this comment.
@copilot can you move the new code into a separate file
There was a problem hiding this comment.
Done. Moved all Whisper-specific code (_save_local_tiny_whisper, _run_whisper_capture_onnx_flow, TestCliWhisperSmoke, DEFAULT_WHISPER_MODEL_IDS) into a new test/cli/test_cli_whisper_smoke.py. The workflow now runs both files.
This was fixed in commit
Fixed in |
Describe your changes
Add fast test for whisper encoder and decoder in a dedicated
test/cli/test_cli_whisper_smoke.pyfile. Refactoredtransformersimports to be local imports inside the functions where they are needed (_save_local_tiny_llamaand_save_local_tiny_whisper) instead of at the module level. SwitchedWhisperConfig(...)keyword-argument style toWhisperConfig.from_dict({...})to fix PYLINTunexpected-keyword-argerrors, matching the existingLlamaConfig.from_dictpattern.Also fixed a bug in
olive/passes/onnx/model_builder.pywhereonnxruntime-genai'ssave_modelfor multi-component models like Whisper (encoder + decoder) prematurely deletes the sharedcache_dirbetween component saves. The encoder'ssave_modelcleanup removes thecache_dirwhen it is empty (no HF downloads for local models), causing the decoder'ssave_modelto fail withFileNotFoundError. The fix creates a temporary marker file (.olive_build_<pid>) inHF_HUB_CACHEbefore callingcreate_modelso the directory is never considered empty and never deleted prematurely; the marker is removed in afinallyblock aftercreate_modelcompletes.precisionis a configurable class attribute onTestCliWhisperSmoke(defaulting to"fp32") and a parameter of_run_whisper_capture_onnx_flow, making it easy to override in subclasses or from the command line.All Whisper-specific code (
DEFAULT_WHISPER_MODEL_IDS,_save_local_tiny_whisper,_run_whisper_capture_onnx_flow,TestCliWhisperSmoke) lives intest/cli/test_cli_whisper_smoke.py, separate from the existing LLaMA smoke tests intest/cli/test_cli_test_model_smoke.py. The CI workflow (test-model-fast.yml) is updated to run both files.Checklist before requesting a review
lintrunner -a(Optional) Issue link