quantized_weight
Non-mutating export helpers for quantized checkpoint weights.
Functions
Build the canonical ModelOpt HF config from canonical module states. |
|
Capture export state without changing the module or its quantizers. |
|
Pack one canonical weight without mutating it or its quantizers. |
|
Return whether two states share one deployment format and tensor layout. |
|
Return whether two opaque export states describe the same checkpoint state. |
|
Authorize scalar state replication across a fused projection split. |
|
Max-reduce scalar state for ranks that shard one logical weight. |
- build_hf_quantization_config(layer_states)
Build the canonical ModelOpt HF config from canonical module states.
- Parameters:
layer_states (Mapping[str, object | None] | Iterable[tuple[str, object | None]])
- Return type:
dict
- capture_quantized_weight_export_state(module, weight_name='weight', *, weight_quantizer=None, input_quantizer=None)
Capture export state without changing the module or its quantizers.
- Parameters:
module (Module)
weight_name (str)
weight_quantizer (object | None)
input_quantizer (object | None)
- Return type:
_QuantizedWeightExportState
- export_quantized_weight(weight, state, *, dtype=None)
Pack one canonical weight without mutating it or its quantizers.
- Parameters:
weight (Tensor)
state (object)
dtype (dtype | None)
- Return type:
_QuantizedWeightExport
- quantized_weight_export_states_compatible(left, right)
Return whether two states share one deployment format and tensor layout.
- Parameters:
left (object)
right (object)
- Return type:
bool
- quantized_weight_export_states_equal(left, right)
Return whether two opaque export states describe the same checkpoint state.
- Parameters:
left (object)
right (object)
- Return type:
bool
- replicate_quantized_weight_export_state(state, projection_count)
Authorize scalar state replication across a fused projection split.
- Parameters:
state (object)
projection_count (int)
- Return type:
tuple[object, …]
- synchronize_quantized_weight_export_state(state, *, group=None, device=None)
Max-reduce scalar state for ranks that shard one logical weight.
- Parameters:
state (object)
device (device | str | None)
- Return type:
object