Skip to content

Commit

Permalink
ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderDokuchaev committed Jan 29, 2025
1 parent bff3860 commit ffa65f8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion nncf/experimental/torch2/model_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def transform(self, transformation_layout: TransformationLayout) -> GraphModelWr
for transformation in transformations:
transformation_cls = transformation.__class__
if transformation_cls not in [x[0] for x in self._command_transformation_ordered_pairs]:
raise ValueError(f"Unsupported transformation: {transformation_cls}")
msg = f"Unsupported transformation: {transformation_cls}"
raise ValueError(msg)
aggregated_transformations[transformation.__class__].append(transformation)

model = self._model.model
Expand Down
9 changes: 6 additions & 3 deletions nncf/experimental/torch2/quantization/quantize_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,14 @@ def quantize_impl(
Implementation of the `quantize()` method for the PyTorch backend.
"""
if fast_bias_correction is False:
raise ValueError(f"fast_bias_correction={fast_bias_correction} is not supported")
msg = f"fast_bias_correction={fast_bias_correction} is not supported"
raise ValueError(msg)
if target_device == TargetDevice.CPU_SPR:
raise nncf.InternalError("target_device == CPU_SPR is not supported")
msg = "target_device == CPU_SPR is not supported"
raise nncf.InternalError(msg)
if mode is not None:
raise ValueError(f"mode={mode} is not supported")
msg = f"mode={mode} is not supported"
raise ValueError(msg)

copied_model = deepcopy(model)
example_input = next(iter(calibration_dataset.get_inference_data()))
Expand Down
3 changes: 2 additions & 1 deletion nncf/experimental/torch2/statistics/aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def _get_statistics_key(self, statistics: TensorStatistic, target_point: TargetP
:return: Statistics key.
"""
if not isinstance(target_point, PTTargetPoint):
raise nncf.InternalError(f"Unexpected target point type: {type(target_point)}")
msg = f"Unexpected target point type: {type(target_point)}"
raise nncf.InternalError(msg)
target_point_id = f"{target_point.target_node_name}_{target_point.type}_{target_point.input_port_id}"
return f"{statistics.__class__.__name__}_{target_point_id}"

0 comments on commit ffa65f8

Please sign in to comment.