Skip to content

Commit 697c5be

Browse files
authored
Fix sdxl q_unet config (#2081)
Signed-off-by: Kaihui-intel <kaihui.tang@intel.com>
1 parent 306bd63 commit 697c5be

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

examples/3.x_api/pytorch/diffusion_model/diffusers/stable_diffusion/smooth_quant/run_benchmark.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,13 @@ function run_benchmark {
5050

5151
if [[ ${mode} == "performance" ]]; then
5252
extra_cmd=$extra_cmd" --performance"
53-
if [[ ${int8} == "true" ]]; then
54-
extra_cmd=$extra_cmd" --int8"
55-
fi
5653
echo $extra_cmd
5754

5855
python -u sdxl_smooth_quant.py \
5956
--model_name_or_path ${model_name_or_path} \
6057
--latent ${latent} \
6158
${extra_cmd}
6259
else
63-
if [[ ${int8} == "true" ]]; then
64-
extra_cmd=$extra_cmd" --int8"
65-
fi
6660
echo $extra_cmd
6761

6862
python -u sdxl_smooth_quant.py \
@@ -82,7 +76,7 @@ function run_benchmark {
8276
cd mlperf_sd_inference
8377
cp ../main.py ./
8478
if [ -d "../saved_results/" ]; then
85-
mv ../saved_results/ ./
79+
cp -r ../saved_results/ ./
8680
fi
8781

8882
python -u main.py \

examples/3.x_api/pytorch/diffusion_model/diffusers/stable_diffusion/smooth_quant/sdxl_smooth_quant.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,10 @@ def forward_loop(model):
406406
if args.int8:
407407
from neural_compressor.torch.quantization import load
408408
q_unet = load(os.path.abspath(os.path.expanduser(args.output_dir)))
409-
setattr(q_unet, "config", pipeline.unet.config)
410409
else:
411410
q_unet = pipeline.unet
412-
411+
if not hasattr(q_unet, "config"):
412+
setattr(q_unet, "config", pipeline.unet.config)
413413
pipeline.unet = q_unet
414414
quant_images = prompts2images(pipeline, prompts, n_steps=args.n_steps, latent=init_latent)
415415
save_images(prompts, quant_images, args.output_dir, prefix='quant')

0 commit comments

Comments
 (0)