Replies: 3 comments
-
@andreyanufr , @ljaljushkin , @AlexKoff88 please take a look. I guess the model passed to compress_weights() is in int8 and this might be the reason. Perhaps we need a better error trace for it. |
Beta Was this translation helpful? Give feedback.
-
The error happens because ...
"text_encoder": [
"optimum",
"OVModelTextEncoder"
],
"text_encoder_2": [
"optimum",
"OVModelTextEncoder"
],
.... They can be compressed separately, as follows: from nncf import compress_weights, CompressWeightsMode
ov_text_encoder_model = ov_pipe_bf16.text_encoder.model
compressed_text_encoder = compress_weights(ov_text_encoder_model, mode=CompressWeightsMode.INT4_SYM, group_size=128, ratio=0.8) As @MaximProshin noticed, BTW, 4bit options were added for from optimum.intel import OVQuantizer
from optimum.intel import OVConfig
quantizer = OVQuantizer.from_pretrained(ov_optimum_wrapper)
quantizer.quantize(save_directory='', weights_only=True, quantization_config=OVConfig(compression={"type": "int4_sym_g128", "ratio": 0.8}),) |
Beta Was this translation helpful? Give feedback.
-
@ranjithum you can load pretrained stable diffusion pipeline from optimum-intel with compressed weights by specifying the Please install the latest version pip install optimum-intel==1.15.2 Eaxmple from optimum.intel import OVStableDiffusionXLPipeline, OVWeightQuantizationConfig
model_id = "stabilityai/stable-diffusion-xl-base-1.0"
quantization_config = OVWeightQuantizationConfig(bits=4, sym=True, ratio=0.8, group_size=64)
ov_pipe_bf16 = OVStableDiffusionXLPipeline.from_pretrained(model_id, compile=False, export=True, quantization_config=quantization_config) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
i m not sure if this is the right group for discussion, but asking it anyways ..
i m trying to run compress_weights on pretrained stable diffusion pipeline.. and this is the snippet
But i get follwoing exception
Can some please help me with this problem...
Note:- i m trying to run this locally on my macbook, which has intel cpu. no GPU.
Beta Was this translation helpful? Give feedback.
All reactions