Skip to content

Commit

Permalink
fix segmind notebook (#2354)
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova authored Sep 3, 2024
1 parent 6674324 commit 5804064
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions notebooks/stable-diffusion-xl/segmind-vegart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,17 @@
"\n",
"int8_pipe = None\n",
"\n",
"core = ov.Core()\n",
"\n",
"def create_int8_pipe(model_dir, unet_int8_path, device, core, unet_device='CPU'):\n",
" int8_pipe = OVStableDiffusionXLPipeline.from_pretrained(model_dir, device=device, compile=True)\n",
" del int8_pipe.unet.request\n",
" del int8_pipe.unet.model\n",
" gc.collect()\n",
" int8_pipe.unet.model = core.read_model(unet_int8_path)\n",
" int8_pipe.unet.request = core.compile_model(int8_pipe.unet.model, unet_device or device)\n",
" return int8_pipe\n",
"\n",
"if to_quantize.value and \"GPU\" in device.value:\n",
" to_quantize.value = False\n",
"42\n",
Expand Down Expand Up @@ -635,15 +646,6 @@
"source": [
"%%skip not $to_quantize.value\n",
"\n",
"def create_int8_pipe(model_dir, unet_int8_path, device, core, unet_device='CPU'):\n",
" int8_pipe = OVStableDiffusionXLPipeline.from_pretrained(model_dir, device=device, compile=True)\n",
" del int8_pipe.unet.request\n",
" del int8_pipe.unet.model\n",
" gc.collect()\n",
" int8_pipe.unet.model = core.read_model(unet_int8_path)\n",
" int8_pipe.unet.request = core.compile_model(int8_pipe.unet.model, unet_device or device)\n",
" return int8_pipe\n",
"\n",
"int8_text2image_pipe = create_int8_pipe(model_dir, UNET_INT8_OV_PATH, device.value, core)\n",
"\n",
"\n",
Expand Down Expand Up @@ -840,6 +842,8 @@
}
],
"source": [
"import ipywidgets as widgets\n",
"\n",
"quantized_model_present = UNET_INT8_OV_PATH.exists()\n",
"\n",
"use_quantized_model = widgets.Checkbox(\n",
Expand Down

0 comments on commit 5804064

Please sign in to comment.