Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
7 changes: 6 additions & 1 deletion .github/instructions/python-model-builder.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ When generating or reviewing code in the Python Model Builder (`src/python/py/mo

Read both documents to understand the intended usage, supported models, design principles, and architectural constraints before suggesting or reviewing any code changes in this area.

When a node is inserted into the model, prefer using `self.make_op_name` as the wrapper method for `self.make_node` + `self.make_value` calls.
## Code Style Guidelines

1. When a node is inserted into the model, prefer using `self.make_op_name` as the wrapper method for `self.make_node` + `self.make_value` calls.
2. Ignore any CodeQL warnings about how an __init__ method calls an overridden method. These warnings are false positives and can be safely ignored. The warning message is: "this call to ABC in an initialization method is overwritten by XYZ".
3. Find ways to reduce code duplication by reusing existing functionality and implementing common patterns.
4. Discover ways to leverage the use of shared code in the base classes to avoid code duplication and improve maintainability.
2 changes: 1 addition & 1 deletion src/python/py/models/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ def get_args():
int4_block_size = 16/32/64/128/256: Specify the block size for int4 quantization (MatMulNBits).
Default value is 32.
qmoe_block_size = 16/32/64/128/256: Specify the block size for QMoE expert weights quantization.
Default is 128 for trt-rtx, 32 for others. Supported EPs: cpu, webgpu, trt-rtx.
Default is 128 for CUDA and TRT-RTX, 32 for others. Supported EPs: CPU, CUDA, WebGPU, TRT-RTX.
int4_is_symmetric = Quantize the weights symmetrically. Default is true.
If true, quantization is done to int4. If false, quantization is done to uint4.
int4_op_types_to_quantize = MatMul/Gather: Specify op types to target for int4 quantization.
Expand Down
5 changes: 5 additions & 0 deletions src/python/py/models/builders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
# Modifications Copyright (C) 2026 Advanced Micro Devices, Inc. All rights reserved.
# Portions of this file consist of AI generated content.
# -------------------------------------------------------------------------
import os.path
import sys

sys.path.append(os.path.dirname(__file__))

Comment thread
kunal-vaishnavi marked this conversation as resolved.
Outdated
Comment thread
kunal-vaishnavi marked this conversation as resolved.
Outdated
from .base import Model
from .chatglm import ChatGLMModel
from .ernie import ErnieModel
Expand Down
724 changes: 131 additions & 593 deletions src/python/py/models/builders/base.py

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions src/python/py/models/builders/expansions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -------------------------------------------------------------------------
from .trt_rtx import TRT_RTX

__all__ = [
"TRT_RTX",
]
Loading
Loading