Skip to content

Commit

Permalink
Make export_config mandatory to get path & set default quantization_c…
Browse files Browse the repository at this point in the history
…onfig

Signed-off-by: Jan Lasek <[email protected]>
  • Loading branch information
janekl committed Nov 27, 2024
1 parent 06e6703 commit 3560e8b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nemo/collections/llm/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,11 @@ def validate(
@run.cli.entrypoint(name="ptq", namespace="llm")
def ptq(
nemo_checkpoint: str,
export_config: ExportConfig,
calib_tp: int = 1,
calib_pp: int = 1,
quantization_config: Annotated[Optional[QuantizationConfig], run.Config[QuantizationConfig]] = None,
export_config: Optional[Union[ExportConfig, run.Config[ExportConfig]]] = None,
) -> Path:
# TODO: Fix "nemo_run.cli.cli_parser.CLIException: An unexpected error occurred (Argument: , Context: {})"
"""
Applies Post-Training Quantization (PTQ) for a model using the specified quantization and export configs. It runs
calibration for a small dataset to collect scaling factors low-precision GEMMs used by desired quantization method.
Expand All @@ -297,6 +296,9 @@ def ptq(
Returns:
Path: The path where the quantized checkpoint has been saved after calibration.
"""
if not quantization_config:
quantization_config = QuantizationConfig()

if export_config.path is None:
raise ValueError("The export_config.path needs to be specified, got None.")

Expand Down

0 comments on commit 3560e8b

Please sign in to comment.