Skip to content

Commit

Permalink
Prohibit additional properties in scope_overrides section of NNCFConf…
Browse files Browse the repository at this point in the history
…ig (#1117)
  • Loading branch information
vshampor authored Mar 28, 2022
1 parent d48d16c commit d375cd0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
14 changes: 8 additions & 6 deletions docs/compression_algorithms/Quantization.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,14 @@ sparsity and filter pruning algorithms. It can be enabled by setting a non-zero
},
"quantize_inputs": true, // Whether the model inputs should be immediately quantized prior to any other model operations."
"scope_overrides": { // This option is used to specify overriding quantization constraints for specific scope, e.g. in case you need to quantize a single operation differently than the rest of the model.
"{re}.*InvertedResidual.*": {
"mode": "symmetric", // Mode of quantization
"bits": 4, // Bitwidth to quantize to.
"signed": true, // Whether to use signed or unsigned input/output values for quantization. If specified as unsigned and the input values during initialization have differing signs, will reset to performing signed quantization instead.
"per_channel": false // Whether to quantize inputs per channel (i.e. per 0-th dimension for weight quantization,and per 1-st dimension for activation quantization)
}
"activations": {
"{re}.*InvertedResidual.*": {
"mode": "symmetric", // Mode of quantization
"bits": 4, // Bitwidth to quantize to.
"signed": true, // Whether to use signed or unsigned input/output values for quantization. If specified as unsigned and the input values during initialization have differing signs, will reset to performing signed quantization instead.
"per_channel": false // Whether to quantize inputs per channel (i.e. per 0-th dimension for weight quantization,and per 1-st dimension for activation quantization)
}
}
},
// A list of model control flow graph node scopes to be ignored for this operation - functions as a 'denylist'. Optional.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
"compression": {
"algorithm": "quantization",
"scope_overrides": {
"{re}RMBlock\\[[0-9]*\\]/ELU\\[activation\\]": {
"signed": true
}
"activations": {
"{re}RMBlock\\[[0-9]*\\]/ELU\\[activation\\]": {
"signed": true
}
}
}
}
}
1 change: 1 addition & 0 deletions nncf/config/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ def with_attributes(schema: Dict, **kwargs) -> Dict:
},
}
},
"additionalProperties": False,
"description": "This option is used to specify overriding quantization constraints for specific scope,"
"e.g. in case you need to quantize a single operation differently than the rest of the "
"model."
Expand Down

0 comments on commit d375cd0

Please sign in to comment.