You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Warning: mid_block.attentions.0.transformer_blocks.9.attn1.to_out.0 is not calibrated, skip smoothing
Warning: mid_block.attentions.0.transformer_blocks.9.attn2.to_q is not calibrated, skip smoothing
Warning: mid_block.attentions.0.transformer_blocks.9.attn2.to_k is not calibrated, skip smoothing
Warning: mid_block.attentions.0.transformer_blocks.9.attn2.to_v is not calibrated, skip smoothing
Warning: mid_block.attentions.0.transformer_blocks.9.attn2.to_out.0 is not calibrated, skip smoothing
Warning: mid_block.attentions.0.transformer_blocks.9.ff.net.0.proj is not calibrated, skip smoothing
Warning: mid_block.attentions.0.transformer_blocks.9.ff.net.2 is not calibrated, skip smoothing
Warning: mid_block.attentions.0.proj_out is not calibrated, skip smoothing
Warning: mid_block.resnets.0.time_emb_proj is not calibrated, skip smoothing
Warning: mid_block.resnets.1.time_emb_proj is not calibrated, skip smoothing
Smoothed 0 modules
Pipelines loaded with dtype=torch.float16 cannot run with cpu device. It is not recommended to move them to cpu as running them will fail. Please make sure to use an accelerator to run the pipeline in inference, due to the lack of support forfloat16 operations on this device in PyTorch. Please, remove the torch_dtype=torch.float16 argument, or use another device for inference.
Pipelines loaded with dtype=torch.float16 cannot run with cpu device. It is not recommended to move them to cpu as running them will fail. Please make sure to use an accelerator to run the pipeline in inference, due to the lack of support forfloat16 operations on this device in PyTorch. Please, remove the torch_dtype=torch.float16 argument, or use another device for inference.
Pipelines loaded with dtype=torch.float16 cannot run with cpu device. It is not recommended to move them to cpu as running them will fail. Please make sure to use an accelerator to run the pipeline in inference, due to the lack of support forfloat16 operations on this device in PyTorch. Please, remove the torch_dtype=torch.float16 argument, or use another device for inference.
Pipelines loaded with dtype=torch.float16 cannot run with cpu device. It is not recommended to move them to cpu as running them will fail. Please make sure to use an accelerator to run the pipeline in inference, due to the lack of support forfloat16 operations on this device in PyTorch. Please, remove the torch_dtype=torch.float16 argument, or use another device for inference.
/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/diffusers/models/unets/unet_2d_condition.py:1111: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if dim % default_overall_up_factor != 0:
/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/modelopt/torch/quantization/nn/modules/tensor_quantizer.py:597: TracerWarning: Using len to get tensor shape might cause the trace to be incorrect. Recommended usage would be tensor.shape[0]. Passing a tensor of different shape might lead to errors or silently give incorrect results.
if len(inputs) == 0:
============= Diagnostic Run torch.onnx.export version 2.0.1+cu117 =============
verbose: False, log level: Level.ERROR
======================= 0 NONE 0 NOTE 0 WARNING 0 ERROR ========================
Traceback (most recent call last):
File "quantize.py", line 247, in
main()
File "quantize.py", line 243, in main
modelopt_export_sd(backbone, f"{str(args.onnx_dir)}", args.model, args.format)
File "/home/ubuntu1804/tsl/qvd/diffusers/quantization/onnx_utils/export.py", line 241, in modelopt_export_sd
onnx_export(
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/onnx/utils.py", line 506, in export
_export(
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/onnx/utils.py", line 1548, in _export
graph, params_dict, torch_out = _model_to_graph(
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/onnx/utils.py", line 1113, in _model_to_graph
graph, params, torch_out, module = _create_jit_graph(model, args)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/onnx/utils.py", line 989, in _create_jit_graph
graph, torch_out = _trace_and_get_graph_from_model(model, args)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/onnx/utils.py", line 893, in _trace_and_get_graph_from_model
trace_graph, torch_out, inputs_states = torch.jit._get_trace_graph(
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/jit/_trace.py", line 1268, in _get_trace_graph
outs = ONNXTracedModule(f, strict, _force_outplace, return_inputs, _return_inputs_states)(*args, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/jit/_trace.py", line 127, in forward
graph, out = torch._C._create_graph_by_tracing(
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/jit/_trace.py", line 118, in wrapper
outs.append(self.inner(*trace_inputs))
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1488, in _slow_forward
result = self.forward(*input, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/diffusers/models/unets/unet_2d_condition.py", line 1226, in forward
sample, res_samples = downsample_block(hidden_states=sample, temb=emb)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1488, in _slow_forward
result = self.forward(*input, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/diffusers/models/unets/unet_2d_blocks.py", line 1391, in forward
hidden_states = resnet(hidden_states, temb)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1488, in _slow_forward
result = self.forward(*input, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/diffusers/models/resnet.py", line 341, in forward
hidden_states = self.conv1(hidden_states)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1488, in _slow_forward
result = self.forward(*input, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/modelopt/torch/quantization/nn/modules/quant_module.py", line 85, in forward
return super().forward(input, *args, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/modelopt/torch/quantization/nn/modules/quant_module.py", line 39, in forward
input = self.input_quantizer(input)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1488, in _slow_forward
result = self.forward(*input, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/modelopt/torch/quantization/nn/modules/tensor_quantizer.py", line 614, in forward
self._check_onnx_readiness(inputs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/modelopt/torch/quantization/nn/modules/tensor_quantizer.py", line 437, in _check_onnx_readiness
assert hasattr(self, "_amax"), (
AssertionError: Quantizer has not been calibrated. ONNX export requires the quantizer to be calibrated.Calibrate and load amax before exporting to ONNX.
The text was updated successfully, but these errors were encountered:
version :0.19.0
I am trying to quantize SDXL with diffusers/quantization/quantize.py
python3 quantize.py \ --model sdxl-1.0 \ --format int8 --batch-size 2 \ --calib-size 32 --collect-method min-mean \ --percentile 1.0 --alpha 0.8 \ --quant-level 3 --n-steps 30 \ --quantized-torch-ckpt-save-path ../output/pth/sdxl-1.0_int8.pt --onnx-dir $ONNX_DIR
Warning: mid_block.attentions.0.transformer_blocks.9.attn1.to_out.0 is not calibrated, skip smoothing
Warning: mid_block.attentions.0.transformer_blocks.9.attn2.to_q is not calibrated, skip smoothing
Warning: mid_block.attentions.0.transformer_blocks.9.attn2.to_k is not calibrated, skip smoothing
Warning: mid_block.attentions.0.transformer_blocks.9.attn2.to_v is not calibrated, skip smoothing
Warning: mid_block.attentions.0.transformer_blocks.9.attn2.to_out.0 is not calibrated, skip smoothing
Warning: mid_block.attentions.0.transformer_blocks.9.ff.net.0.proj is not calibrated, skip smoothing
Warning: mid_block.attentions.0.transformer_blocks.9.ff.net.2 is not calibrated, skip smoothing
Warning: mid_block.attentions.0.proj_out is not calibrated, skip smoothing
Warning: mid_block.resnets.0.time_emb_proj is not calibrated, skip smoothing
Warning: mid_block.resnets.1.time_emb_proj is not calibrated, skip smoothing
Smoothed 0 modules
Pipelines loaded with
dtype=torch.float16
cannot run withcpu
device. It is not recommended to move them tocpu
as running them will fail. Please make sure to use an accelerator to run the pipeline in inference, due to the lack of support forfloat16
operations on this device in PyTorch. Please, remove thetorch_dtype=torch.float16
argument, or use another device for inference.Pipelines loaded with
dtype=torch.float16
cannot run withcpu
device. It is not recommended to move them tocpu
as running them will fail. Please make sure to use an accelerator to run the pipeline in inference, due to the lack of support forfloat16
operations on this device in PyTorch. Please, remove thetorch_dtype=torch.float16
argument, or use another device for inference.Pipelines loaded with
dtype=torch.float16
cannot run withcpu
device. It is not recommended to move them tocpu
as running them will fail. Please make sure to use an accelerator to run the pipeline in inference, due to the lack of support forfloat16
operations on this device in PyTorch. Please, remove thetorch_dtype=torch.float16
argument, or use another device for inference.Pipelines loaded with
dtype=torch.float16
cannot run withcpu
device. It is not recommended to move them tocpu
as running them will fail. Please make sure to use an accelerator to run the pipeline in inference, due to the lack of support forfloat16
operations on this device in PyTorch. Please, remove thetorch_dtype=torch.float16
argument, or use another device for inference./home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/diffusers/models/unets/unet_2d_condition.py:1111: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if dim % default_overall_up_factor != 0:
/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/modelopt/torch/quantization/nn/modules/tensor_quantizer.py:597: TracerWarning: Using len to get tensor shape might cause the trace to be incorrect. Recommended usage would be tensor.shape[0]. Passing a tensor of different shape might lead to errors or silently give incorrect results.
if len(inputs) == 0:
============= Diagnostic Run torch.onnx.export version 2.0.1+cu117 =============
verbose: False, log level: Level.ERROR
======================= 0 NONE 0 NOTE 0 WARNING 0 ERROR ========================
Traceback (most recent call last):
File "quantize.py", line 247, in
main()
File "quantize.py", line 243, in main
modelopt_export_sd(backbone, f"{str(args.onnx_dir)}", args.model, args.format)
File "/home/ubuntu1804/tsl/qvd/diffusers/quantization/onnx_utils/export.py", line 241, in modelopt_export_sd
onnx_export(
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/onnx/utils.py", line 506, in export
_export(
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/onnx/utils.py", line 1548, in _export
graph, params_dict, torch_out = _model_to_graph(
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/onnx/utils.py", line 1113, in _model_to_graph
graph, params, torch_out, module = _create_jit_graph(model, args)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/onnx/utils.py", line 989, in _create_jit_graph
graph, torch_out = _trace_and_get_graph_from_model(model, args)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/onnx/utils.py", line 893, in _trace_and_get_graph_from_model
trace_graph, torch_out, inputs_states = torch.jit._get_trace_graph(
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/jit/_trace.py", line 1268, in _get_trace_graph
outs = ONNXTracedModule(f, strict, _force_outplace, return_inputs, _return_inputs_states)(*args, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/jit/_trace.py", line 127, in forward
graph, out = torch._C._create_graph_by_tracing(
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/jit/_trace.py", line 118, in wrapper
outs.append(self.inner(*trace_inputs))
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1488, in _slow_forward
result = self.forward(*input, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/diffusers/models/unets/unet_2d_condition.py", line 1226, in forward
sample, res_samples = downsample_block(hidden_states=sample, temb=emb)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1488, in _slow_forward
result = self.forward(*input, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/diffusers/models/unets/unet_2d_blocks.py", line 1391, in forward
hidden_states = resnet(hidden_states, temb)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1488, in _slow_forward
result = self.forward(*input, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/diffusers/models/resnet.py", line 341, in forward
hidden_states = self.conv1(hidden_states)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1488, in _slow_forward
result = self.forward(*input, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/modelopt/torch/quantization/nn/modules/quant_module.py", line 85, in forward
return super().forward(input, *args, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/modelopt/torch/quantization/nn/modules/quant_module.py", line 39, in forward
input = self.input_quantizer(input)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1488, in _slow_forward
result = self.forward(*input, **kwargs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/modelopt/torch/quantization/nn/modules/tensor_quantizer.py", line 614, in forward
self._check_onnx_readiness(inputs)
File "/home/ubuntu1804/anaconda3/envs/isnet/lib/python3.8/site-packages/modelopt/torch/quantization/nn/modules/tensor_quantizer.py", line 437, in _check_onnx_readiness
assert hasattr(self, "_amax"), (
AssertionError: Quantizer has not been calibrated. ONNX export requires the quantizer to be calibrated.Calibrate and load amax before exporting to ONNX.
The text was updated successfully, but these errors were encountered: