overrides
Attributes#
fastforward.overrides.override = forward_override
module-attribute
#
Classes#
fastforward.overrides.DisableQuantizationOverride()
#
Override to disable quantization.
Attach DisableQuantizationOverride instance as quantizer override to
disable quantization. Quantization is enabled/disabled using the
enable_quantization and disable_quantization methods for all quantizers
the instance is attached to.
Quantizers can be 'bulk' attached to using the attach_to and detach
methods. Note that detach will only detach from quantizers which
where attached to using the attach_to methods, i.e., if an instance of
DisableQuantizationOverride is registered as override to a quantizers
using different means, it must be detached separately.
Attributes#
quantization_enabled
property
#
True if quantization is enabled, False otherwise.
Methods#
attach_to(quantizers)
#
Attach this override to one or more quantizers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quantizers
|
Quantizer | QuantizerCollection | Iterable[Quantizer]
|
Either a single quantizer, a |
required |
detach()
#
Detach this override.
Detach from all quantizers it was attached to using the
attach_to method.
disable_quantization()
#
enable_quantization(enabled=True)
#
Enable quantization.
More specifically, this instance will not disable quantization for any quantizers it is attached to. Other instance, or other methods may still disable quantization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
True if quantization must be enabled, False if it must be disabled. |
True
|
Functions#
fastforward.overrides.disable_quantization(model)
#
Disable quantization for all quantizers in model within context.
The global strict_quantization flag is also set to False during the context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Module
|
The model for which all quantizers are disabled. |
required |
fastforward.overrides.enable_quantization(model)
#
Enable quantization for all quantizers in model within context.
Note that this context manager does not change the strict_quantization flag.
To also (temporarily) change the strict_quantization flag use
fastforward.quantization.strict_quantization.strict_quantization_for_module
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Module
|
The model for which all quantizers are enabled. |
required |