(model)
| 59 | return iter(params) |
| 60 | |
| 61 | def trainable_parameters_num(model): |
| 62 | params = [] |
| 63 | total = 0 |
| 64 | for n, m in model.named_parameters(): |
| 65 | if m.requires_grad: |
| 66 | total += m.numel() |
| 67 | return total |
| 68 | |
| 69 | def set_quant_state(model, weight_quant: bool = False): |
| 70 | for m in model.modules(): |