Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/python/py/models/builders/qwen.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,16 +954,6 @@ def __init__(self, config, io_dtype, onnx_dtype, ep, cache_dir, extra_options):
# SkipSimplifiedLayerNormalization can be used directly.
self.layernorm_attrs["add_offset"] = 1

Comment thread
xiaofeihan1 marked this conversation as resolved.
# HF Qwen3_5RMSNorm always computes in float32 regardless of model
# dtype. Force the builder to cast inputs to fp32 before LayerNorm
# and cast back after, matching HF behaviour and preventing precision
# loss that compounds across 36+ layers in fp16/bf16 builds.
self.layernorm_attrs["cast"]["use_fp32"] = True
self.layernorm_attrs["cast"]["root_input"] = True
self.layernorm_attrs["cast"]["skip_input"] = True
self.layernorm_attrs["cast"]["output_0"] = True
self.layernorm_attrs["cast"]["output_3"] = True

# 3D position_ids for mRoPE: [3, batch_size, sequence_length]
self.input_shapes["position_ids"] = [3, "batch_size", "sequence_length"]
self.input_names["position_ids"] = "position_ids"
Expand Down
Loading