(module, names, bits, groupsize, name='')
| 370 | return out.reshape(out_shape) |
| 371 | |
| 372 | def 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 | |
| 385 | def quantize_with_gptq(model, wbits, groupsize): |
no test coverage detected