(child)
| 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 |
no test coverage detected