-
Notifications
You must be signed in to change notification settings - Fork 43
Add webgpu recipes for qwen3.5 models #307
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
apsonawane
wants to merge
9
commits into
main
Choose a base branch
from
asonawane/webgpu
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
9 commits
Select commit
Hold shift + click to select a range
b9fd90f
Add webgpu recipes for qwen3.5 models
apsonawane d1cd7fc
Update session options
apsonawane 5e11fd7
Update block_size for cpu models
apsonawane e7552a0
Do not override context_length
apsonawane 453034f
Merge branch 'main' into asonawane/webgpu
apsonawane 4f12db2
Remove engine from webgpu
apsonawane f8e6859
remove int4_block_size
apsonawane ebf8157
Update recipes
apsonawane 45143b5
Merge branch 'main' into asonawane/webgpu
apsonawane 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
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,45 @@ | ||
| { | ||
| "input_model": { | ||
| "type": "PyTorchModel", | ||
| "model_path": "Qwen/Qwen3.5-0.8B", | ||
| "model_loader": "get_embedding_model", | ||
| "model_script": "user_script.py", | ||
| "io_config": "get_embedding_io_config", | ||
| "dummy_inputs_func": "get_embedding_dummy_inputs" | ||
| }, | ||
| "passes": { | ||
| "convert": { | ||
| "type": "OnnxConversion", | ||
| "use_dynamo_exporter": false | ||
| }, | ||
| "ort": { | ||
| "type": "OrtTransformersOptimization", | ||
| "model_type": "", | ||
| "opt_level": 1, | ||
| "only_onnxruntime": true | ||
| }, | ||
| "cast": { | ||
| "type": "OnnxPeepholeOptimizer", | ||
| "onnxscript_optimize": false, | ||
| "onnxoptimizer_optimize": false, | ||
| "fuse_reshape_operations": false, | ||
| "fix_com_microsoft_opset": true, | ||
| "cast_chain_elimination": true | ||
| }, | ||
| "gemm2mm": { | ||
| "type": "GraphSurgeries", | ||
| "surgeries": [ | ||
| { | ||
| "surgeon": "GemmToMatMulAdd" | ||
| } | ||
| ] | ||
| }, | ||
| "fp16": { | ||
| "type": "OnnxFloatToFloat16", | ||
| "save_as_external_data": true, | ||
| "external_data_name": "embedding.onnx.data" | ||
| } | ||
| }, | ||
| "no_artifacts": true, | ||
| "output_dir": "webgpu/models/embedding.onnx" | ||
| } |
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,20 @@ | ||
| { | ||
| "input_model": { | ||
| "type": "HfModel", | ||
| "model_path": "Qwen/Qwen3.5-0.8B" | ||
| }, | ||
| "passes": { | ||
| "m": { | ||
| "type": "ModelBuilder", | ||
| "precision": "int4", | ||
| "int4_accuracy_level": 4, | ||
| "extra_options": { | ||
| "filename": "text.onnx", | ||
| "prune_lm_head": true, | ||
| "quant_mode": "default" | ||
| } | ||
| } | ||
| }, | ||
| "no_artifacts": true, | ||
| "output_dir": "webgpu/models/text.onnx" | ||
| } |
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 @@ | ||
| { | ||
| "input_model": { | ||
| "type": "PyTorchModel", | ||
| "model_path": "Qwen/Qwen3.5-0.8B", | ||
| "model_loader": "get_vision_model", | ||
| "model_script": "user_script.py", | ||
| "io_config": "get_vision_io_config", | ||
| "dummy_inputs_func": "get_vision_dummy_inputs" | ||
| }, | ||
| "passes": { | ||
| "c": { | ||
| "type": "OnnxConversion", | ||
| "use_dynamo_exporter": true | ||
| }, | ||
| "gs": { | ||
| "type": "GraphSurgeries", | ||
| "surgeries": [ | ||
| { | ||
| "surgeon": "PackedAttentionToLoopMHA" | ||
| }, | ||
| { | ||
| "surgeon": "ReciprocalMulToDiv" | ||
| }, | ||
| { | ||
| "surgeon": "RenameOutputDims", | ||
| "output_idx": 0, | ||
| "dim_idx": 0, | ||
| "dim_name": "num_logical_patches" | ||
| } | ||
| ] | ||
| }, | ||
| "ort": { | ||
| "type": "OrtTransformersOptimization", | ||
| "model_type": "vit", | ||
| "opt_level": 2, | ||
| "only_onnxruntime": true | ||
| }, | ||
| "dedup": { | ||
| "type": "GraphSurgeries", | ||
| "surgeries": [ | ||
| { | ||
| "surgeon": "DeduplicateSubgraphInitializers" | ||
| } | ||
| ] | ||
| }, | ||
| "cast": { | ||
| "type": "OnnxPeepholeOptimizer", | ||
| "onnxscript_optimize": false, | ||
| "onnxoptimizer_optimize": false, | ||
| "fuse_reshape_operations": false, | ||
| "fix_com_microsoft_opset": true, | ||
| "cast_chain_elimination": true | ||
| }, | ||
| "fp16": { | ||
| "type": "OnnxFloatToFloat16", | ||
| "op_block_list": [ | ||
| "LayerNormalization", | ||
| "Range" | ||
| ], | ||
| "save_as_external_data": true, | ||
| "external_data_name": "vision.onnx.data" | ||
| }, | ||
| "cleanup": { | ||
| "type": "GraphSurgeries", | ||
| "surgeries": [ | ||
| { | ||
| "surgeon": "DeduplicateNodes" | ||
| } | ||
| ], | ||
| "save_as_external_data": true, | ||
| "external_data_name": "vision.onnx.data" | ||
| } | ||
| }, | ||
| "no_artifacts": true, | ||
| "output_dir": "webgpu/models/vision.onnx" | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| { | ||
| "input_model": { | ||
| "type": "PyTorchModel", | ||
| "model_path": "Qwen/Qwen3.5-2B", | ||
| "model_loader": "get_embedding_model", | ||
| "model_script": "user_script.py", | ||
| "io_config": "get_embedding_io_config", | ||
| "dummy_inputs_func": "get_embedding_dummy_inputs" | ||
| }, | ||
| "passes": { | ||
| "convert": { | ||
| "type": "OnnxConversion", | ||
| "use_dynamo_exporter": false | ||
| }, | ||
| "ort": { | ||
| "type": "OrtTransformersOptimization", | ||
| "model_type": "", | ||
| "opt_level": 1, | ||
| "only_onnxruntime": true | ||
| }, | ||
| "cast": { | ||
| "type": "OnnxPeepholeOptimizer", | ||
| "onnxscript_optimize": false, | ||
| "onnxoptimizer_optimize": false, | ||
| "fuse_reshape_operations": false, | ||
| "fix_com_microsoft_opset": true, | ||
| "cast_chain_elimination": true | ||
| }, | ||
| "gemm2mm": { | ||
| "type": "GraphSurgeries", | ||
| "surgeries": [ | ||
| { | ||
| "surgeon": "GemmToMatMulAdd" | ||
| } | ||
| ] | ||
| }, | ||
| "fp16": { | ||
| "type": "OnnxFloatToFloat16", | ||
| "save_as_external_data": true, | ||
| "external_data_name": "embedding.onnx.data" | ||
| } | ||
| }, | ||
| "no_artifacts": true, | ||
| "output_dir": "webgpu/models/embedding.onnx" | ||
| } |
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,22 @@ | ||
| { | ||
| "input_model": { | ||
| "type": "HfModel", | ||
| "model_path": "Qwen/Qwen3.5-2B" | ||
| }, | ||
| "passes": { | ||
| "m": { | ||
| "type": "ModelBuilder", | ||
| "precision": "int4", | ||
| "int4_accuracy_level": 4, | ||
| "int4_algo_config": "k_quant_mixed", | ||
| "int4_block_size": 128, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. webgpu needs bs=32 |
||
| "extra_options": { | ||
| "filename": "text.onnx", | ||
| "prune_lm_head": true, | ||
| "quant_mode": "int4" | ||
| } | ||
| } | ||
| }, | ||
| "no_artifacts": true, | ||
| "output_dir": "webgpu/models/text.onnx" | ||
| } | ||
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 @@ | ||
| { | ||
| "input_model": { | ||
| "type": "PyTorchModel", | ||
| "model_path": "Qwen/Qwen3.5-2B", | ||
| "model_loader": "get_vision_model", | ||
| "model_script": "user_script.py", | ||
| "io_config": "get_vision_io_config", | ||
| "dummy_inputs_func": "get_vision_dummy_inputs" | ||
| }, | ||
| "passes": { | ||
| "c": { | ||
| "type": "OnnxConversion", | ||
| "use_dynamo_exporter": true | ||
| }, | ||
| "gs": { | ||
| "type": "GraphSurgeries", | ||
| "surgeries": [ | ||
| { | ||
| "surgeon": "PackedAttentionToLoopMHA" | ||
| }, | ||
| { | ||
| "surgeon": "ReciprocalMulToDiv" | ||
| }, | ||
| { | ||
| "surgeon": "RenameOutputDims", | ||
| "output_idx": 0, | ||
| "dim_idx": 0, | ||
| "dim_name": "num_logical_patches" | ||
| } | ||
| ] | ||
| }, | ||
| "ort": { | ||
| "type": "OrtTransformersOptimization", | ||
| "model_type": "vit", | ||
| "opt_level": 2, | ||
| "only_onnxruntime": true | ||
| }, | ||
| "dedup": { | ||
| "type": "GraphSurgeries", | ||
| "surgeries": [ | ||
| { | ||
| "surgeon": "DeduplicateSubgraphInitializers" | ||
| } | ||
| ] | ||
| }, | ||
| "cast": { | ||
| "type": "OnnxPeepholeOptimizer", | ||
| "onnxscript_optimize": false, | ||
| "onnxoptimizer_optimize": false, | ||
| "fuse_reshape_operations": false, | ||
| "fix_com_microsoft_opset": true, | ||
| "cast_chain_elimination": true | ||
| }, | ||
| "fp16": { | ||
| "type": "OnnxFloatToFloat16", | ||
| "op_block_list": [ | ||
| "LayerNormalization", | ||
| "Range" | ||
| ], | ||
| "save_as_external_data": true, | ||
| "external_data_name": "vision.onnx.data" | ||
| }, | ||
| "cleanup": { | ||
| "type": "GraphSurgeries", | ||
| "surgeries": [ | ||
| { | ||
| "surgeon": "DeduplicateNodes" | ||
| } | ||
| ], | ||
| "save_as_external_data": true, | ||
| "external_data_name": "vision.onnx.data" | ||
| } | ||
| }, | ||
| "no_artifacts": true, | ||
| "output_dir": "webgpu/models/vision.onnx" | ||
| } |
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.