-
Notifications
You must be signed in to change notification settings - Fork 295
Add --test HF CLI path for 2-layer random model configs, olive run and ModelBuilder support, Qwen how-to/layer-types fix, and merge conflict resolution
#2459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Copilot
wants to merge
37
commits into
main
Choose a base branch
from
copilot/fr-add-model-to-config-json
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
ef42e47
Initial plan
Copilot 00571f0
feat: add CLI test-model config for HF inputs
Copilot 485dfbf
test: broaden HF test-model coverage
Copilot a6fa34a
chore: polish test model config handling
Copilot 273850c
fix: fail fast for HF test model loading
Copilot 318fcbe
refactor: remove nested try from HF test loading
Copilot 40b0740
test: cover trust_remote_code helper behavior
Copilot 386ff01
feat: persist reusable HF test model path
Copilot 09fac8c
fix: tighten HF test model path handling
Copilot 09df0a7
refactor: simplify test model path handling
Copilot d4ebad5
lintrunner
xadupre 6321d32
lint
xadupre 6709852
docs: add phi test conversion how-to
Copilot 3f8f8fc
feat: support run command test models
Copilot 189289a
chore: address review nits for run test support
Copilot c90c520
chore: simplify run test override handling
Copilot 5cec47f
chore: polish run test support follow-up
Copilot eaf0a16
fix: use saved test checkpoint in model builder
Copilot 17cb075
chore: tidy model builder test fixture
Copilot 996f633
chore: clarify model builder test model errors
Copilot 00732b7
fix dtype: auto
xadupre 76ee4ef
update documentation
xadupre 9ba38c7
docs: clarify phi smoke test output path
Copilot fa6bee7
docs: switch smoke test how-to to qwen
Copilot ffda0dc
test: cover documented llm smoke flow
Copilot d0f868f
test: polish documented smoke flow test
Copilot a408b63
test: rename smoke flow cli test
Copilot e272c2a
test: refine smoke flow workflow stubs
Copilot c901b63
test: tidy smoke flow helper names
Copilot 36410cd
test: clarify smoke flow mocks
Copilot e16cb82
test: polish documented smoke flow test naming
Copilot 7507604
test: lift smoke flow imports and mock defaults
Copilot ac7840f
fix: keep qwen test layer types in sync
Copilot f165dda
Merge origin/main and resolve model builder test conflict
Copilot 5daba5d
Merge origin/main into copilot/fr-add-model-to-config-json
Copilot 8941efb
Potential fix for pull request finding
xadupre be35ef4
Merge branch 'main' into copilot/fr-add-model-to-config-json
xadupre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # How to convert a Qwen model with a quick `--test` smoke check | ||
|
|
||
| If you are converting a large language model, it is often useful to validate the Olive command, environment, and conversion recipe on a much smaller model before spending time on the full checkpoint. | ||
|
|
||
| The `--test` option does that for Hugging Face models. Olive keeps the same model architecture, reduces it to a random 2-layer test model, saves it to the folder you provide, and reuses that folder on later runs. | ||
|
|
||
| This example uses [`Qwen/Qwen3-0.6B`](https://huggingface.co/Qwen/Qwen3-0.6B), but the same pattern works for other supported Hugging Face LLMs. | ||
|
|
||
| ## Step 1: generate the workflow config | ||
|
|
||
| Start by generating the config that Olive will run for the Qwen conversion. | ||
|
|
||
| ```bash | ||
| olive optimize \ | ||
|
xadupre marked this conversation as resolved.
|
||
| --model_name_or_path Qwen/Qwen3-0.6B \ | ||
| --device cpu \ | ||
| --provider CPUExecutionProvider \ | ||
| --precision int4 \ | ||
| --output_path out/qwen-smoke \ | ||
| --dry_run | ||
| ``` | ||
|
|
||
| This creates `out/qwen-smoke/config.json` without launching the full conversion yet. | ||
|
|
||
| ## Step 2: run a fast smoke test with `olive run --test` | ||
|
|
||
| Use the generated config with `olive run` and pass `--test` so Olive swaps in a reduced random Qwen model. | ||
|
|
||
| ```bash | ||
| olive run \ | ||
|
xadupre marked this conversation as resolved.
xadupre marked this conversation as resolved.
|
||
| --config out/qwen-smoke/config.json \ | ||
| --test out/qwen-test-model \ | ||
| --output_path out/qwen-smoke-run | ||
| ``` | ||
|
|
||
| What this does: | ||
|
|
||
| - `--test out/qwen-test-model` creates a reduced random Qwen model and saves it in `out/qwen-test-model` | ||
| - later runs reuse the same saved test model instead of recreating it | ||
| - `--output_path out/qwen-smoke-run` gives the smoke test its own output folder, so the generated ONNX artifacts are easy to find | ||
|
|
||
| After the smoke test finishes, look under `out/qwen-smoke-run` for the exported ONNX model and related files. | ||
|
|
||
| This is a quick way to confirm that: | ||
|
|
||
| - Olive can load the source model | ||
| - the selected optimization recipe is valid for your setup | ||
| - the conversion path completes before you run the full model | ||
|
|
||
| If you omit the folder and just pass `--test`, `olive run` will save the reduced model under `<output_path>/test_model`. | ||
|
|
||
| ## Step 3: run the full conversion | ||
|
|
||
| Once the smoke test succeeds, rerun the conversion on the full Qwen checkpoint by removing `--test`. | ||
|
|
||
| ```bash | ||
| olive run \ | ||
| --config out/qwen-smoke/config.json \ | ||
| --output_path out/qwen-full | ||
| ``` | ||
|
|
||
| At this point you know the Olive command and the conversion recipe already worked on the lightweight test model, so you can focus on the full-model run instead of debugging both at once. | ||
|
|
||
| ## Why keep the test model folder? | ||
|
|
||
| The saved test model is useful beyond the first smoke test: | ||
|
|
||
| - you can rerun the reduced conversion quickly while iterating on options | ||
| - you can reuse the same HF test model later when comparing the Hugging Face model against the exported ONNX model | ||
| - you avoid recreating a new random test checkpoint every time | ||
|
|
||
| ## Related docs | ||
|
|
||
| - [How to use the `olive optimize` command to optimize a Pytorch model](cli-optimize) | ||
| - [How to write a new workflow from scratch](../configure-workflows/build-workflow) | ||
| - [CLI reference](../../reference/cli) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.