-
Notifications
You must be signed in to change notification settings - Fork 190
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Restore functionality doesnt work for from_pretrained function of huggingface/diffusers
Steps/Code to reproduce bug
from diffusers import SanaTransformer2DModel
import modelopt.torch.quantization as mtq
checkpoint = "Efficient-Large-Model/Sana_600M_1024px_diffusers"
model = SanaTransformer2DModel.from_pretrained(checkpoint, subfolder="transformer")
config = mtq.FP8_DEFAULT_CFG
config['quant_cfg']['*weight_quantizer'].update({'fake_quant': False})
model = mtq.quantize(model, config)
mtq.compress(model)
model.save_pretrained("test_modelopt_quant")
model = SanaTransformer2DModel.from_pretrained("test_modelopt_quant")
Error Trace
155 if force_quantize:
156 m.weight_quantizer._dequantize = False
--> 157 assert not m.weight.is_meta, (
158 "Real quantization does not support tensors on meta device."
159 )
160 real_quant_tensor = m.weight_quantizer(m.weight)
161 m.weight = QTensorWrapper(real_quant_tensor)
AssertionError: Real quantization does not support tensors on meta device.
It seems like weights are on meta device for diffusers unlike transformers where they are on cpu when we restore modelopt_state
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working