1diff --git a/src/python/py/models/builder.py b/src/python/py/models/builder.py
2index 7a0cb70d..774a3861 100644
3--- a/src/python/py/models/builder.py
4+++ b/src/python/py/models/builder.py
5@@ -1459,7 +1459,7 @@ class Model:
6 self.rope_attrs["save_caches"] = False
7 cos_cache_small, sin_cache_small = self.make_rotary_embedding_caches(cos_cache_name=cos_cache_small_name, sin_cache_name=sin_cache_small_name)
8
9- if self.ep in ["dml", "NvTensorRtRtx"]:
10+ if self.ep in ["dml", "NvTensorRtRtx", "webgpu"]:
11 # Concat small and large cos/sin caches for DML and NvTensorRtRtx EPs
12 # These EPs don't support the If operator
13 cos_cache = torch.cat((cos_cache_small, cos_cache_large), dim=0)
-
Build model with command: python -m src/python/py/models/builder.py -m microsoft/Phi-4-mini-instruct -o Phi-4-mini-instruct-onnx -e webgpu -c cache-dir -p int4 --extra_options int4_block_size=32 int4_accuracy_level=4 int4_op_types_to_quantize=MatMul/Gather
-
The generated external data (model.onnx.data) is larger than 2GB, which is not suitable for ORT-Web. Move some weights to model.onnx to reduce the size of
model.onnx.data with following script:
1import onnx
2from onnx.external_data_helper import convert_model_to_external_data
3
4# load mode
5model = onnx.load("model.onnx")
6
7# re-convert model to external data with bigger size_threshold
8convert_model_to_external_data(model, all_tensors_to_one_file=True, location='model.onnx.data', size_threshold=1024 * 1024 * 5)
9onnx.save_model(model, "new_model.onnx")
10