Add --test HF CLI path for 2-layer random model configs, olive run and ModelBuilder support, and Qwen how-to/layer-types fix#2459
Conversation
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/e2149604-9db1-438e-a31f-01a53886093d Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/e2149604-9db1-438e-a31f-01a53886093d Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/e2149604-9db1-438e-a31f-01a53886093d Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
--test HF CLI path for 2-layer random model configs
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/d4221aaf-b4a3-4bed-85fe-30a12dcdfd6e Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
--test HF CLI path for 2-layer random model configs--test HF CLI path for 2-layer random model configs with fail-fast loading
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/57fd060e-5678-4015-b277-c7d14ec52145 Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/57fd060e-5678-4015-b277-c7d14ec52145 Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/cf4d7fdc-1de9-4098-adc3-3bedd436d7d0 Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/cf4d7fdc-1de9-4098-adc3-3bedd436d7d0 Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/cf4d7fdc-1de9-4098-adc3-3bedd436d7d0 Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
--test HF CLI path for 2-layer random model configs with fail-fast loading--test HF CLI path for 2-layer random model configs with reusable saved test models
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/c25a0cd6-d252-4e16-8783-52a5be97f14e Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
--test HF CLI path for 2-layer random model configs, olive run support, and Phi how-to--test HF CLI path for 2-layer random model configs, olive run and ModelBuilder support, and Phi how-to
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/acc48c65-2f6d-44c0-80c1-271e83838437 Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
--test HF CLI path for 2-layer random model configs, olive run and ModelBuilder support, and Phi how-to--test HF CLI path for 2-layer random model configs, olive run and ModelBuilder support, and Qwen how-to
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/c421adc3-0615-4d10-bf15-b21d632d70b2 Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/c421adc3-0615-4d10-bf15-b21d632d70b2 Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/c421adc3-0615-4d10-bf15-b21d632d70b2 Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/c421adc3-0615-4d10-bf15-b21d632d70b2 Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/c421adc3-0615-4d10-bf15-b21d632d70b2 Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/c421adc3-0615-4d10-bf15-b21d632d70b2 Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/c421adc3-0615-4d10-bf15-b21d632d70b2 Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/c421adc3-0615-4d10-bf15-b21d632d70b2 Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
| Use the generated config with `olive run` and pass `--test` so Olive swaps in a reduced random Qwen model. | ||
|
|
||
| ```bash | ||
| olive run \ |
There was a problem hiding this comment.
@copilot this command generates ValueError: num_hidden_layers (2) must be equal to the number of layer types (28)
There was a problem hiding this comment.
Fixed in ac7840f. The --test config reduction now trims Qwen layer_types to match the reduced hidden-layer count, and I added a regression test covering reload of the reduced Qwen3 config.
Agent-Logs-Url: https://github.com/microsoft/Olive/sessions/5bd5199d-42fa-4109-94a3-c7995abe72a2 Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
--test HF CLI path for 2-layer random model configs, olive run and ModelBuilder support, and Qwen how-to--test HF CLI path for 2-layer random model configs, olive run and ModelBuilder support, and Qwen how-to/layer-types fix
Describe your changes
Adds a CLI test path for Hugging Face models so generated
config.jsoncan carry a lightweight random-model definition instead of always using pretrained weights. When--testis passed, Olive now preserves the source architecture, instantiates a random model with 2 hidden layers, and can persist that test model for reuse.CLI/config support
--testto HF-backed CLI commands using shared input-model options.--testnow accepts an optional folder path where the generated test model is saved for reuse.input_model.test_model_configinto generated run configs, and now also emitsinput_model.test_model_pathwhen a save folder is provided or derived.{ "input_model": { "type": "HfModel", "model_path": "model-id", "test_model_config": { "hidden_layers": 2 }, "test_model_path": "path/to/test_model" } }--testis used without an explicit folder, Olive uses<output_path>/test_model.--testis used in a context where no output path is available, Olive now fails clearly instead of silently skipping persistence.olive runsupportolive run --testso it can apply the same lightweight HF test-model override to an existing Hugging Faceinput_modelalready present in a workflow config.olive run --testis used without an explicit folder, it derives the saved test-model location from the effective workflow output path.olive run --testnow fails clearly when the workflow config does not contain a Hugging Faceinput_model.HF model loading
test_model_config.num_hidden_layers,num_layers,n_layer,n_layers).layer_typesto match the reduced hidden-layer count so the saved reduced config remains valid when reloaded.from_config) so the model is random-initialized rather than loaded from pretrained weights.from_configloading path to avoid nestedtry/excepthandling by only passingtrust_remote_codewhen the model class signature supports it.test_model_pathalready contains a saved HF model, Olive loads that model instead of recreating it; otherwise it creates the reduced model once and saves it there.ModelBuilder support
--testworkflows export from the saved reduced Hugging Face test checkpoint instead of still using the original full checkpoint.test_model_configis present, ModelBuilder now materializes or reusestest_model_pathbefore export and passes that saved checkpoint to the builder.IO config / dummy input propagation
test_model_configthrough HF IO-config and dummy-input generation so the reduced-layer model shape metadata stays consistent with the generated test model.Documentation
--testsmoke check first, then rerun the full conversion.olive optimize --dry_runfollowed byolive run --test, matching the new CLI support.Qwen/Qwen3-0.6Band renamed the how-to page and index entry to match.Targeted coverage
--testtest_model_configtest_model_path--testneeds an explicit folderolive run --testoverriding an existing HFinput_modelfrom a workflow configolive run --testis used on a non-HF workflow configtrust_remote_codehandling for supported, omitted, and unsupportedfrom_configsignaturestest_model_configis activeolive optimize --dry_runthenolive run --testcommands withhf-internal-testing/tiny-random-LlamaForCausalLMand verifies an ONNX artifact is producedlayer_typesaligned with the reduced hidden-layer count and can be reloaded successfullyExamples:
Checklist before requesting a review
lintrunner -aRelease notes: Added a
--testoption for Hugging Face CLI workflows that can take a folder path, writes a lightweight 2-layer random-model config, saves and reuses the generated HF test model from that folder, fails fast if the reduced test model cannot be instantiated from the expected model class, only passestrust_remote_codewhen the targetfrom_configsupports it, and now keeps Qwen-stylelayer_typesmetadata aligned with reduced test-model layer counts so saved reduced configs reload cleanly. Also addedolive run --testsupport for workflow configs with Hugging Face input models, updated ModelBuilder to export from the saved reduced test checkpoint for--testflows, and added a Qwen3 0.6B how-to page for running a quick smoke test before the full conversion with an explicit output path for the generated ONNX files.(Optional) Issue link