MCPcopy Create free account
hub / github.com/GreenBitAI/low_bit_llama / model_to_half

Function model_to_half

model.py:113–120  ·  view source on GitHub ↗
(model)

Source from the content-addressed store, hash-verified

111
112
113def model_to_half(model):
114 model.half()
115 for n, m in model.named_modules():
116 if isinstance(m, QuantLinear):
117 m.qscales_scales = m.qscales_scales.half()
118 m.qscales_zeros = m.qscales_zeros.half()
119 m.bias = m.bias.half()
120 print(Style.BRIGHT + Fore.YELLOW + 'Converted as Half.')
121
122
123def find_layers(module, layers=[nn.Conv2d, nn.Linear], name=''):

Callers 1

load_llama_modelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected