MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / func

Function func

deepspeed/inference/quantization/layers.py:36–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34def get_quantize_weight_fn(quantizer: Quantizer, pre_quant_weight: nn.Parameter) -> Callable:
35
36 def func() -> Tuple[nn.Parameter, Tensor, Tensor]:
37 quantized_weights, quant_scale, quant_min = quantizer.quantize(pre_quant_weight.data)
38 # A temporary hack as zero Zero3 assume all model weights has the same type. in all_gather_coalesced.get_only_unique_item
39 quantized_weights = quantized_weights.view(pre_quant_weight.dtype)
40 quant_scale = quant_scale.type(pre_quant_weight.dtype)
41 quant_min = quant_min.type(pre_quant_weight.dtype)
42 return quantized_weights, quant_scale, quant_min
43
44 return func
45

Callers 9

wrapperFunction · 0.85
adamwFunction · 0.85
wrapped_fnFunction · 0.85
graph_processFunction · 0.85
wrapperFunction · 0.85
wrappedMethod · 0.85
forwardMethod · 0.85
wrapperFunction · 0.85
log_wrapperFunction · 0.85

Calls 2

typeMethod · 0.80
quantizeMethod · 0.45

Tested by

no test coverage detected