MCPcopy Index your code
hub / github.com/OpenMOSS/MOSS / make_quant

Function make_quant

models/quantization.py:372–382  ·  view source on GitHub ↗
(module, names, bits, groupsize, name='')

Source from the content-addressed store, hash-verified

370 return out.reshape(out_shape)
371
372def make_quant(module, names, bits, groupsize, name=''):
373 if isinstance(module, QuantLinear):
374 return
375 for attr in dir(module):
376 tmp = getattr(module, attr)
377 name1 = name + '.' + attr if name != '' else attr
378 if name1 in names:
379 delattr(module, attr)
380 setattr(module, attr, QuantLinear(bits, groupsize, tmp.in_features, tmp.out_features, tmp.bias is not None))
381 for name1, child in module.named_children():
382 make_quant(child, names, bits, groupsize, name + '.' + name1 if name != '' else name1)
383
384
385def quantize_with_gptq(model, wbits, groupsize):

Callers 1

quantize_with_gptqFunction · 0.85

Calls 1

QuantLinearClass · 0.85

Tested by

no test coverage detected