File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change 1
1
from typing import Any , Dict
2
2
3
3
import torch
4
- from optimum .quanto .nn import QModuleMixin
5
- from optimum .quanto .quantize import _quantize_submodule , freeze
4
+ from optimum .quanto .quantize import _quantize_submodule
6
5
7
-
8
- def custom_freeze ( model : torch . nn . Module ):
9
- for name , m in model . named_modules ( ):
10
- if isinstance ( m , QModuleMixin ):
11
- m .freeze ()
6
+ # def custom_freeze(model: torch.nn.Module):
7
+ # for name, m in model.named_modules( ):
8
+ # if isinstance(m, QModuleMixin ):
9
+ # m.weight =
10
+ # m.freeze()
12
11
13
12
14
13
def requantize (
@@ -47,8 +46,8 @@ def move_tensor(t, device):
47
46
for name , param in m .named_buffers (recurse = False ):
48
47
setattr (m , name , move_tensor (param , "cpu" ))
49
48
# Freeze model and move to target device
50
- freeze (model )
51
- model .to (device )
49
+ # freeze(model)
50
+ # model.to(device)
52
51
53
52
# Load the quantized model weights
54
53
model .load_state_dict (state_dict , strict = False )
You can’t perform that action at this time.
0 commit comments