Skip to content

Commit 56aa639

Browse files
committed
Move W4A16_NVFP4_CFG to YAML
main added W4A16_NVFP4_CFG (weight-only NVFP4 for all linears) after the YAML-conversion branch was forked, so it landed in choices but had no YAML preset and no load_config call after rebase. Add the YAML preset and the load_config call to match the rest of the constants. Signed-off-by: Shengliang Xu <shengliangx@nvidia.com>
1 parent 683b0ef commit 56aa639

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

modelopt/torch/quantization/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,10 @@ def _load_quantizer_cfg_dict_list(config_path: str) -> list[dict[str, Any]]:
13851385
"configs/ptq/presets/model/w4a8_nvfp4_fp8",
13861386
schema_type=QuantizeConfig,
13871387
)
1388+
W4A16_NVFP4_CFG: QuantizeConfig = load_config(
1389+
"configs/ptq/presets/model/w4a16_nvfp4",
1390+
schema_type=QuantizeConfig,
1391+
)
13881392
MXFP4_MLP_WEIGHT_ONLY_CFG: QuantizeConfig = load_config(
13891393
"configs/ptq/presets/model/mxfp4_mlp_weight_only",
13901394
schema_type=QuantizeConfig,
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# QuantizeConfig preset for NVFP4 weight-only quantization on all layers (W4A16).
17+
18+
# modelopt-schema: modelopt.torch.quantization.config.QuantizeConfig
19+
imports:
20+
base_disable_all: configs/ptq/units/base_disable_all
21+
default_disabled_quantizers: configs/ptq/units/default_disabled_quantizers
22+
nvfp4: configs/numerics/nvfp4
23+
24+
algorithm: max
25+
quant_cfg:
26+
- $import: base_disable_all
27+
- quantizer_name: '*weight_quantizer'
28+
cfg:
29+
$import: nvfp4
30+
- $import: default_disabled_quantizers

0 commit comments

Comments
 (0)