Skip to content

Commit f43ac70

Browse files
spellcheck (#3318)
### Changes Fix grammar
1 parent 8b48ab5 commit f43ac70

File tree

76 files changed

+126
-128
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+126
-128
lines changed

docs/usage/training_time_compression/quantization_aware_training/Usage.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ ov_quantized_model = ov.convert_model(stripped_model)
7474
<details open><summary><b>PyTorch</b></summary>
7575

7676
The complete information about compression is defined by a compressed model and a NNCF config.
77-
The model characterizes the weights and topology of the network. The NNCF config - how to restore additional modules intoduced by NNCF.
77+
The model characterizes the weights and topology of the network. The NNCF config - how to restore additional modules introduced by NNCF.
7878
The NNCF config can be obtained by `quantized_model.nncf.get_config()` on saving and passed to the
7979
`nncf.torch.load_from_config` helper function to load additional modules from the given NNCF config.
8080
The quantized model saving allows to load quantized modules to the target model in a new python process and

examples/post_training_quantization/openvino/anomaly_stfpm_quantize_with_accuracy_control/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pip install -r requirements.txt
2929

3030
It's pretty simple. The example does not require additional preparation. It will do the preparation itself, such as loading the dataset and model, etc.
3131

32-
The maximum accuracy drop you can pass as a command line argument. F1 score is calculted in range [0,1] for STFPM. Thus if you want to specify the maximum accuracy drop between the quantized and pre-trained model of 0.5% you must specify 0.005 as a command line argument:
32+
The maximum accuracy drop you can pass as a command line argument. F1 score is calculated in range [0,1] for STFPM. Thus if you want to specify the maximum accuracy drop between the quantized and pre-trained model of 0.5% you must specify 0.005 as a command line argument:
3333

3434
```bash
3535
python main.py 0.005

examples/post_training_quantization/openvino/yolov8/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pip install -r requirements.txt
2626

2727
## Run Example
2828

29-
The example is fully automated. Just run the following comman in the prepared Python environment:
29+
The example is fully automated. Just run the following command in the prepared Python environment:
3030

3131
```bash
3232
python main.py

nncf/common/graph/graph_matching.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ def _is_subgraph_matching_strict(graph: nx.DiGraph, pattern: nx.DiGraph, subgrap
9292
predecessors_keys = graph.pred[node_from_graph].keys()
9393
successor_keys = graph.succ[node_from_graph].keys()
9494
has_external_successors = any(successor_key not in subgraph for successor_key in successor_keys)
95-
has_external_predcessors = any(predecessor_key not in subgraph for predecessor_key in predecessors_keys)
95+
has_external_predecessors = any(predecessor_key not in subgraph for predecessor_key in predecessors_keys)
9696
if node_from_pattern in starting_nodes and has_external_successors:
9797
return False
98-
if node_from_pattern in last_nodes and has_external_predcessors:
98+
if node_from_pattern in last_nodes and has_external_predecessors:
9999
return False
100100
if (node_from_pattern not in last_nodes and node_from_pattern not in starting_nodes) and (
101-
has_external_successors or has_external_predcessors
101+
has_external_successors or has_external_predecessors
102102
):
103103
return False
104104
return True

nncf/common/graph/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def get_bias_shape_legacy(layer_attributes: WeightedLayerAttributes) -> int:
203203

204204
def get_num_filters_legacy(layer_attributes: WeightedLayerAttributes) -> int:
205205
"""
206-
Returns hard-coded number of filters for the given layer attribues.
206+
Returns hard-coded number of filters for the given layer attributes.
207207
Applicable only for eager PyTorch and Tensorflow models.
208208
209209
:param layer_attributes: Layer attributes of a NNCFNode.

nncf/common/insertion_point_graph.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,9 @@ def get_ip_graph_with_merged_hw_optimized_operations(
314314
single node; the resulting InsertionPointGraph no longer has accessible the pre- and post-hooks that were
315315
located in the middle of the fused pattern.
316316
If the InsertionPointGraph should be filtered from constant nodes before the node fusing,
317-
then 'known_non_constant_node_keys' should be pass. This is the list of the node known that are non constansts.
317+
then 'known_non_constant_node_keys' should be pass. This is the list of the node known that are non constants.
318318
319-
:param full_fusing_pattern: The GraphPatttern object representing a composition of fusing pattern variants.
319+
:param full_fusing_pattern: The GraphPattern object representing a composition of fusing pattern variants.
320320
:return: The InsertionPointGraph with nodes fused according to pattern matching.
321321
"""
322322
merged_ip_graph = deepcopy(self)

nncf/common/pruning/shape_pruning_processor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def get_next_nodes(
184184
:param pruning_groups: `Clusterization` of pruning groups.
185185
:return Dictionary of next nodes by cluster {cluster_id: [node]}.
186186
"""
187-
# 1. Propagate symbolic masks throught the net
187+
# 1. Propagate symbolic masks through the net
188188
for pruned_layer_info in pruning_groups.get_all_nodes():
189189
node = graph.get_node_by_id(pruned_layer_info.nncf_node_id)
190190
node.attributes["output_mask"] = SymbolicMask(get_output_channels(node), node.node_id)

nncf/common/pruning/symbolic_mask.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
class SymbolicMaskProducer:
2020
"""
21-
Container of information about a NNCFNode which is produsing a symbolic mask.
21+
Container of information about a NNCFNode which is producing a symbolic mask.
2222
NNCFNode produced a (symbolic or not) mask means this mask was set as an output
2323
mask to this NNCFNode during (symbolic or not) mask propagation.
2424
"""
@@ -152,7 +152,7 @@ def split(cls, tensor: SymbolicMask, output_shapes: List[int]) -> List[SymbolicM
152152
if any(shape <= 0 for shape in output_shapes) or tensor.shape[0] != sum(output_shapes):
153153
msg = (
154154
"Symbolic mask split was called with"
155-
f"invalid parammeters: input mask shape: {tensor.shape[0]}, output masks shapes: {output_shapes}"
155+
f"invalid parameters: input mask shape: {tensor.shape[0]}, output masks shapes: {output_shapes}"
156156
)
157157
raise AssertionError(msg)
158158

nncf/common/pruning/tensor_processor.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ def assert_allclose(cls, tensors: List[NNCFTensor]) -> None:
5656
@abstractmethod
5757
def repeat(cls, tensor: NNCFTensor, repeats: int) -> NNCFTensor:
5858
"""
59-
Successively repeat each element of given NNCFTesnor.
59+
Successively repeat each element of given NNCFTensor.
6060
6161
:param tensor: Given NNCFTensor.
6262
:param repeats: The number of repetitions for each element.
63-
:return: NNCFTensor with repited elements.
63+
:return: NNCFTensor with repeated elements.
6464
"""
6565

6666
@classmethod
@@ -78,7 +78,7 @@ def elementwise_mask_propagation(cls, input_masks: List[NNCFTensor]) -> NNCFTens
7878
@abstractmethod
7979
def split(cls, tensor: NNCFTensor, output_shapes: List[int]) -> List[NNCFTensor]:
8080
"""
81-
Split/chunk NNCFTensor into chunks along an exsiting dimension.
81+
Split/chunk NNCFTensor into chunks along an existing dimension.
8282
8383
:param tensor: Given NNCFTensor.
8484
:param output_shapes: Given shapes of the output masks

nncf/common/pruning/weights_flops_calculator.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ def count_flops_and_weights(
6969
:return number of FLOPs for the model
7070
number of weights (params) in the model
7171
"""
72-
flops_pers_node, weights_per_node = self.count_flops_and_weights_per_node(
72+
flops_per_node, weights_per_node = self.count_flops_and_weights_per_node(
7373
graph, output_shapes, input_channels, output_channels, kernel_sizes, op_addresses_to_skip
7474
)
75-
return sum(flops_pers_node.values()), sum(weights_per_node.values())
75+
return sum(flops_per_node.values()), sum(weights_per_node.values())
7676

7777
def count_flops_and_weights_per_node(
7878
self,

nncf/common/tensor_statistics/statistic_point.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class StatisticPoint:
2121
StatisticPoint stores information is necessary for statistics collection process:
2222
target_point from which statistics is collected: node_name and target_type determines the node edge.
2323
tensor_collector determines how to aggregate statistics in target_point
24-
algorithm implies on what algorithm nedeed this statistics.
24+
algorithm implies on what algorithm needed this statistics.
2525
"""
2626

2727
def __init__(self, target_point: TargetPoint, tensor_collector: TensorCollector, algorithm: str):

nncf/common/utils/patcher.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def patch( # noqa: C901
3636
) -> None:
3737
"""
3838
Apply patching
39-
:param obj_cls: Function to be overriden.
39+
:param obj_cls: Function to be overridden.
4040
:param wrapper: Wrapper function to override with.
4141
:param force: Whether to override previously applied patches or not.
4242
"""

nncf/experimental/quantization/algorithms/range_estimator/algorithm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(
3838
for the given model.
3939
:param subset_size: Size of a subset to calculate activations statistics used
4040
for quantization, defaults to 300.
41-
:param inplace_statistics: Defines wheather to calculate quantizers statistics
41+
:param inplace_statistics: Defines whether to calculate quantizers statistics
4242
by backend graph operations or by default Python implementation, defaults
4343
to True.
4444
:param batchwise_statistics: Determines whether quantizer statistics should be calculated

nncf/experimental/tensorflow/context.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __init__(self, in_call: bool = False, wrap_ops: bool = False, model: Optiona
5151

5252
if model is None and in_call:
5353
msg = (
54-
f"Inconsisten values `{in_call}` and `{model}` for `in_call` and `model` parameters. "
54+
f"Inconsistent values `{in_call}` and `{model}` for `in_call` and `model` parameters. "
5555
"The `None` value is specified that model is undefined at this moment. This is only "
5656
"possible when `in_call` is equal to `False`."
5757
)

nncf/experimental/tensorflow/graph/converter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def build(self, graph_optimizers: List[str]):
6969
# List of output tensors
7070
output_tensors = frozen_func.outputs
7171

72-
# Step 2: Run a Grappler pass to oprimize the TensorFlow graph.
72+
# Step 2: Run a Grappler pass to optimize the TensorFlow graph.
7373

7474
# Creates a ConfigProto for configuring Grappler
7575
grappler_config = _get_grappler_config(graph_optimizers)

nncf/experimental/tensorflow/nncf_network.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(self, model: tf.keras.Model, input_signature: InputSignature, **kwa
4141
Initializes the NNCF network.
4242
4343
:param model: Keras model.
44-
:param input_signature: Input signature of the moodel.
44+
:param input_signature: Input signature of the model.
4545
"""
4646
super().__init__(**kwargs)
4747
self._model = model
@@ -98,7 +98,7 @@ def insert_at_point(self, point: TFTargetPoint, ops: List[NNCFOperation]) -> Non
9898
Inserts the list of the NNCF operations according to the target point.
9999
100100
:param point: The location where operations should be inserted.
101-
:param ops: List of the NNCF operarions.
101+
:param ops: List of the NNCF operations.
102102
"""
103103
ops_weights = {op.name: op.create_variables(self) for op in ops}
104104
hook = Hook(ops, point, ops_weights)

nncf/experimental/tensorflow/patch_tf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def get_operation_weights(self, op_name: str) -> Any:
8282
Returns weights of the operation with `op_name`.
8383
8484
:param op_name: Name of the operation.
85-
:return: Weihts of the operation.
85+
:return: Weights of the operation.
8686
"""
8787
return self._ops_weights[op_name]
8888

nncf/experimental/torch/fx/constant_folding.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def _is_const_source(node: torch.fx.Node) -> bool:
6969

7070
class ConstantFolder(torch.fx.Interpreter):
7171
"""
72-
Finds constant subraphs and place it in node_replacement attribute.
72+
Finds constant subgraphs and place it in node_replacement attribute.
7373
"""
7474

7575
def __init__(
@@ -216,10 +216,10 @@ def add_node_replacement(self, node: torch.fx.Node, tensor: torch.Tensor) -> Non
216216

217217
def run(self) -> Any: # type: ignore[override]
218218
env: Dict[torch.fx.Node, Any] = {}
219-
self.insert_placerholder_values(env)
219+
self.insert_placeholder_values(env)
220220
return super().run(initial_env=env)
221221

222-
def insert_placerholder_values(self, env: Dict[torch.fx.Node, Any]) -> None:
222+
def insert_placeholder_values(self, env: Dict[torch.fx.Node, Any]) -> None:
223223
for n in self.module.graph.find_nodes(op="placeholder"):
224224
env[n] = self.unknown_value # type: ignore[assignment]
225225

@@ -242,10 +242,10 @@ def constant_fold(
242242
constraint_fn: Optional[Callable[[torch.fx.Node], bool]] = None,
243243
) -> None:
244244
"""
245-
Calcualtes constant subgraphs values and replaces them with a constant node inplace.
245+
Calculates constant subgraphs values and replaces them with a constant node inplace.
246246
247247
:param gm: Given graph model.
248-
:param constraint_fn: Constraint function which takes a node and returs the constraint:
248+
:param constraint_fn: Constraint function which takes a node and returns the constraint:
249249
should the node be constant folded or not.
250250
"""
251251
with torch.no_grad(), torch.utils._python_dispatch._disable_current_modes():

nncf/experimental/torch/fx/node_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# torch version update (>= 2.4)
2323
def get_graph_node_by_name(graph: torch.fx.Graph, name: str) -> torch.fx.Node:
2424
"""
25-
Retrieves a node with the specified name from the grpah.
25+
Retrieves a node with the specified name from the graph.
2626
Raises a runtime error if graph does not contain node with
2727
the given name.
2828

nncf/experimental/torch/fx/quantization/quantize_model.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ def quantize_impl(
9797
else:
9898
fq_weights_transformation(quantized_model)
9999

100-
# Magic. Without this call compiled model
101-
# is not preformant
100+
# Magic. Without this call compiled model is not performant
102101
quantized_model = GraphModule(quantized_model, quantized_model.graph)
103102

104103
quantized_model = _fold_conv_bn_qat(quantized_model)

nncf/experimental/torch/fx/quantization/quantize_pt2e.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ def quantize_pt2e(
123123
nncf_graph = NNCFGraphFactory.create(transformed_model)
124124
quantized_model = quantization_algorithm.apply(transformed_model, nncf_graph, dataset=calibration_dataset)
125125

126-
# Magic. Without this call compiled model
127-
# is not preformant
126+
# Magic. Without this call compiled model is not performant
128127
quantized_model = GraphModule(quantized_model, quantized_model.graph)
129128

130129
if fold_quantize:

nncf/experimental/torch/fx/quantization/quantizer/openvino_quantizer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def transform_for_annotation(self, model: torch.fx.GraphModule) -> torch.fx.Grap
355355
For example quantizer can
356356
a) decompose a compound operator like scaled dot product attention,
357357
into bmm and softmax if quantizer knows how to quantize bmm/softmax but not sdpa
358-
or b) transform scalars to tensor to allow quantizing scalares.
358+
or b) transform scalars to tensor to allow quantizing scalars.
359359
360360
Note: this is an optional method
361361

nncf/experimental/torch/fx/quantization/quantizer/torch_ao_adapter.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ def get_quantization_setup(self, model: torch.fx.GraphModule, nncf_graph: NNCFGr
7070
def _get_quantization_points(
7171
from_node: torch.fx.Node,
7272
to_nodes: List[torch.fx.Node],
73-
anotated_model: torch.fx.GraphModule,
73+
annotated_model: torch.fx.GraphModule,
7474
qconfig: QuantizerConfig,
7575
) -> List[QuantizationPointBase]:
7676
to_n = to_nodes[0]
7777
if from_node.op == "get_attr":
78-
_, metatype = GraphConverter.get_node_type_and_metatype(to_n, anotated_model)
78+
_, metatype = GraphConverter.get_node_type_and_metatype(to_n, annotated_model)
7979
# Check that the constant is placed on the actual weight port, as it is possible for
8080
# activations to be a constant as well.
8181
if TorchAOQuantizerAdapter._get_node_args(to_n).index(from_node) in metatype.weight_port_ids:
@@ -101,8 +101,8 @@ def _get_node_args(node: torch.fx.Node):
101101
return node.args
102102

103103
@staticmethod
104-
def get_quantizer_config_from_annotated_model(anotated_model: torch.fx.GraphModule) -> SingleConfigQuantizerSetup:
105-
edge_or_node_to_qspec = _get_edge_or_node_to_qspec(anotated_model)
104+
def get_quantizer_config_from_annotated_model(annotated_model: torch.fx.GraphModule) -> SingleConfigQuantizerSetup:
105+
edge_or_node_to_qspec = _get_edge_or_node_to_qspec(annotated_model)
106106

107107
q_map = defaultdict(list)
108108
for edge, qspec in edge_or_node_to_qspec.items():
@@ -133,7 +133,7 @@ def get_quantizer_config_from_annotated_model(anotated_model: torch.fx.GraphModu
133133
)
134134
qconfig = QuantizerConfig(mode=mode, signedness_to_force=signed, per_channel=per_channel)
135135

136-
qps = TorchAOQuantizerAdapter._get_quantization_points(from_n, to_nodes, anotated_model, qconfig)
136+
qps = TorchAOQuantizerAdapter._get_quantization_points(from_n, to_nodes, annotated_model, qconfig)
137137
for qp in qps:
138138
q_setup.add_independent_quantization_point(qp)
139139

nncf/experimental/torch/fx/statistics/aggregator.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def collect_statistics(self, model: NNCFNetwork, graph: NNCFGraph) -> None:
6060
with torch.no_grad():
6161
super().collect_statistics(model, graph)
6262
# All statistics are collected as a dead code,
63-
# so eliminate dead core removed statistcs collector
63+
# so eliminate dead core removed statistics collector
6464
# from the target model. No additional code required
6565
# for that, horay!
6666
model.graph.eliminate_dead_code()
@@ -72,7 +72,7 @@ def _register_statistics(self, outputs: Dict[str, Tensor], statistic_points: Sta
7272
@staticmethod
7373
def _get_statistic_collector_name(tp: PTTargetPoint, module_to_insert: torch.nn.Module) -> str:
7474
"""
75-
Compouses unique statistic collector name according to given target point and module.
75+
Composes unique statistic collector name according to given target point and module.
7676
7777
:param tp: Given target point.
7878
:param module_to_insert: Given statistic collection module.
@@ -118,7 +118,7 @@ def _get_transformation_layout_extra_outputs(
118118
def _get_merged_statistic_points(
119119
statistic_points: StatisticPointsContainer, model: TModel, graph: NNCFGraph
120120
) -> StatisticPointsContainer:
121-
# TODO(dlyakhov): mirgate to experimental statistic collector and use common merging algorithm
121+
# TODO(dlyakhov): migrate to experimental statistic collector and use common merging algorithm
122122
return statistic_points
123123

124124
@staticmethod

nncf/experimental/torch/nas/bootstrapNAS/search/evaluator.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def retrieve_from_cache(self, subnet_config_repr: Tuple[float, ...]) -> Tuple[bo
100100

101101
def get_state(self) -> Dict[str, Any]:
102102
"""
103-
Returns state of the evaluatar
103+
Returns state of the evaluator
104104
105105
:return: Dict with the state of the evaluator
106106
"""
@@ -180,7 +180,7 @@ def __init__(
180180
Initializes Accuracy operator
181181
182182
:param eval_func: function used to validate a sub-network
183-
:param val_loader: Datq loader used by the validation function
183+
:param val_loader: Data loader used by the validation function
184184
:param is_top1: Whether is top 1 accuracy or top 5.
185185
:param ref_acc: Accuracy from a model that is used as input to BootstrapNAS
186186
"""

nncf/experimental/torch/nas/bootstrapNAS/search/search.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -692,14 +692,14 @@ def __init__(self, search: BaseSearchAlgorithm):
692692
self._model = search._model
693693
self._lower_bound_acc = search.search_params.ref_acc - search.acc_delta
694694

695-
def _evaluate(self, x: List[float], out: Dict[str, Any], *args, **kargs) -> NoReturn:
695+
def _evaluate(self, x: List[float], out: Dict[str, Any], *args, **kwargs) -> NoReturn:
696696
"""
697697
Evaluates a population of sub-networks.
698698
699699
:param x: set of sub-networks to evaluate.
700700
:param out: measurements obtained by evaluating sub-networks.
701701
:param args:
702-
:param kargs:
702+
:param kwargs:
703703
:return:
704704
"""
705705
evaluators_arr = [[] for i in range(len(self._search.evaluator_handlers))]

nncf/experimental/torch/nas/bootstrapNAS/training/lr_scheduler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def __init__(
101101
@classmethod
102102
def from_dict(cls, lr_scheduler_config: Dict[str, Any]) -> "LRSchedulerParams":
103103
"""
104-
Initialize learning rate scheduler parameters storage clas from Dict.
104+
Initialize learning rate scheduler parameters storage class from Dict.
105105
:param lr_scheduler_config: Dict with parameters of learning rate scheduler.
106106
:return:
107107
"""

0 commit comments

Comments
 (0)