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

Function quantize_fn

deepspeed/module_inject/module_quantize.py:44–52  ·  view source on GitHub ↗
(child)

Source from the content-addressed store, hash-verified

42 layer.output.dense.weight.data = quantize_weight(layer.output.dense.weight.data)
43
44 def quantize_fn(child):
45 if megatron:
46 # Quantize megatron GPT2 / GPT3 trained model
47 megatron_layer_quantize(child)
48 else:
49 # Quantize either DeepSpeed or HuggingFace trained model
50 bert_layer_quantize(child)
51
52 return child
53
54 return quantize_module(model=model, orig_class=orig_layer_impl, quantize_fn=quantize_fn)
55

Callers 1

_quantize_moduleMethod · 0.85

Calls 2

megatron_layer_quantizeFunction · 0.85
bert_layer_quantizeFunction · 0.85

Tested by

no test coverage detected