Skip to content

Commit

Permalink
fix vegart syntax error, update stable zephyr (#1634)
Browse files Browse the repository at this point in the history
* fix vegart syntax error, update stable zephyr

* fix saving fp16 calibrated model on win

update jupyterlab (#1635)
  • Loading branch information
eaidova authored and openvino-dev-samples committed Jan 22, 2024
1 parent 9509806 commit fbd774e
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 113 deletions.
6 changes: 3 additions & 3 deletions .docker/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion notebooks/248-stable-diffusion-xl/248-segmind-vegart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@
"import time\n",
"\n",
"validation_size = 7\n",
"calibration_dataset = datasets.load_dataset(\"conceptual_captions\",, split=\"train\")\n",
"calibration_dataset = datasets.load_dataset(\"conceptual_captions\", split=\"train\")\n",
"validation_data = []\n",
"for batch in calibration_dataset:\n",
" prompt = batch[\"caption\"]\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip uninstall -y -q openvino-dev openvino openvino-nightly\n",
"%pip install -q --extra-index-url https://download.pytorch.org/whl/cpu torch torchvision \"openvino-nightly\" \"diffusers>=0.18.0\" \"transformers>=4.30.2\" \"gradio\""
]
},
Expand Down Expand Up @@ -910,7 +911,10 @@
{
"cell_type": "markdown",
"metadata": {
"collapsed": false
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"source": [
"### Calibrate UNet for GPU inference\n",
Expand All @@ -922,12 +926,16 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"outputs": [],
"source": [
"import pickle\n",
"import urllib.request\n",
"import os\n",
"\n",
"# Fetch `model_upcast_utils` which helps to restore accuracy when inferred on GPU\n",
"urllib.request.urlretrieve(\n",
Expand All @@ -949,10 +957,12 @@
" unet_model = partially_upcast_nodes_to_fp32(unet_model, example_input, upcast_ratio=0.7,\n",
" operation_types=[\"Convolution\"])\n",
"\n",
" import os\n",
" ov.save_model(unet_model, UNET_OV_PATH.with_suffix(\"._tmp.xml\"))\n",
" del unet_model\n",
" os.remove(UNET_OV_PATH)\n",
" os.remove(str(UNET_OV_PATH).replace(\".xml\", \".bin\"))\n",
" ov.save_model(unet_model, UNET_OV_PATH)"
" UNET_OV_PATH.with_suffix(\"._tmp.xml\").rename(UNET_OV_PATH)\n",
" UNET_OV_PATH.with_suffix(\"._tmp.bin\").rename(UNET_OV_PATH.with_suffix('.bin'))\n"
]
},
{
Expand All @@ -961,7 +971,7 @@
"metadata": {},
"outputs": [],
"source": [
"unet_model = core.compile_model(unet_model, device.value)"
"unet_model = core.compile_model(UNET_OV_PATH, device.value)"
]
},
{
Expand Down
Loading

0 comments on commit fbd774e

Please sign in to comment.