Skip to content

Commit

Permalink
fix missed imports and devices
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova committed Sep 10, 2024
1 parent 4426fe9 commit fc07eb4
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "03d85252-fd60-4a13-8f71-a49aa00e0140",
"metadata": {},
Expand Down Expand Up @@ -98,6 +99,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "a955bc95-84e8-41ff-94e9-f7b2d7f38c57",
"metadata": {},
Expand Down Expand Up @@ -128,6 +130,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "a5242b3e-f601-4e84-a014-a7fbbea72314",
"metadata": {
Expand Down Expand Up @@ -160,6 +163,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "e5399705-e90c-4ade-bb56-fecc982c5656",
"metadata": {},
Expand Down Expand Up @@ -189,6 +193,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "0cd8f96d-4fd4-4b4b-833d-9c9ff48e82bb",
"metadata": {},
Expand Down Expand Up @@ -276,6 +281,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "aaf8a841-78ed-4454-97e4-aeedc39698ed",
"metadata": {},
Expand All @@ -297,6 +303,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "4bfc11ed-20f0-4b47-b1f1-3219f84ad276",
"metadata": {},
Expand Down Expand Up @@ -356,6 +363,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "b9225a21-8499-43bc-8278-ac03f3848144",
"metadata": {},
Expand All @@ -381,8 +389,10 @@
" def __init__(self, core, model_path, device=\"AUTO\"):\n",
" self.core = core\n",
" self.model = core.read_model(model_path)\n",
" self._device = device\n",
" self.compiled_model = core.compile_model(self.model, device)\n",
"\n",
"\n",
" def __call__(self, input_tensor: torch.Tensor):\n",
" \"\"\"\n",
" inference step\n",
Expand Down Expand Up @@ -410,7 +420,7 @@
" None\n",
" \"\"\"\n",
" self.model.reshape({0: [1, 3, height, width]})\n",
" self.compiled_model = self.core.compile_model(self.model)\n",
" self.compiled_model = self.core.compile_model(self.model, self._device)\n",
"\n",
" def parameters(self):\n",
" Device = namedtuple(\"Device\", [\"device\"])\n",
Expand All @@ -421,6 +431,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "21005860-19df-4e5e-9c74-0c246a82c1e8",
"metadata": {},
Expand Down Expand Up @@ -497,6 +508,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "921ab34d-df91-4803-8ce8-0479f10c4c5d",
"metadata": {},
Expand All @@ -505,6 +517,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "9156837c-29ed-4031-a717-69298ed23fd2",
"metadata": {},
Expand Down Expand Up @@ -582,6 +595,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "cc7d5900-51ef-4053-b7fb-5ef1a62a88ec",
"metadata": {},
Expand Down Expand Up @@ -713,6 +727,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "863f833c-6428-4694-a576-f4fdbe7a20b6",
"metadata": {},
Expand Down Expand Up @@ -792,6 +807,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "801bbc8d-1085-487a-8ae5-9d69169306cc",
"metadata": {},
Expand Down Expand Up @@ -870,6 +886,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "9249c512-1c1e-4509-9bd4-f7a6e529f644",
"metadata": {},
Expand Down Expand Up @@ -1025,7 +1042,7 @@
" self.register_to_config(controlnet=core.compile_model(controlnet, device))\n",
" self.register_to_config(unet=core.compile_model(unet, device))\n",
" self.unet_out = self.unet.output(0)\n",
" self.vae_decoder = core.compile_model(vae_decoder)\n",
" self.vae_decoder = core.compile_model(vae_decoder, device)\n",
" self.vae_decoder_out = self.vae_decoder.output(0)\n",
"\n",
" def __call__(\n",
Expand Down Expand Up @@ -1333,6 +1350,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "176826c1-9ac1-44aa-bffb-8bf0f8e418a8",
"metadata": {},
Expand All @@ -1344,6 +1362,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "c724b19f-f7a3-4945-90ac-1d15b38d318c",
"metadata": {},
Expand Down Expand Up @@ -1445,6 +1464,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "9830878e",
"metadata": {},
Expand Down Expand Up @@ -1496,6 +1516,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "18c1ddb2",
"metadata": {},
Expand Down Expand Up @@ -1524,6 +1545,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "177b016b",
"metadata": {},
Expand Down Expand Up @@ -1687,6 +1709,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "16f0897e",
"metadata": {},
Expand Down Expand Up @@ -1748,6 +1771,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "17e92fb9",
"metadata": {},
Expand Down Expand Up @@ -1802,6 +1826,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "253bd28e",
"metadata": {},
Expand Down Expand Up @@ -1865,6 +1890,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "cdbf17dc",
"metadata": {},
Expand Down Expand Up @@ -1944,6 +1970,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "3dce0b40",
"metadata": {},
Expand All @@ -1961,6 +1988,8 @@
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets as widgets\n",
"\n",
"quantized_model_present = int8_pipe is not None\n",
"\n",
"use_quantized_model = widgets.Checkbox(\n",
Expand Down
6 changes: 5 additions & 1 deletion notebooks/qrcode-monster/qrcode-monster.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1022,8 +1022,10 @@
}
],
"source": [
"from notebook_utils import quantization_widget\n",
"\n",
"skip_for_device = \"GPU\" in device.value\n",
"to_quantize = widgets.Checkbox(value=not skip_for_device, description=\"Quantization\", disabled=skip_for_device)\n",
"to_quantize = quantization_widget(not skip_for_device)\n",
"to_quantize"
]
},
Expand Down Expand Up @@ -1544,6 +1546,8 @@
}
],
"source": [
"import ipywidgets as widgets\n",
"\n",
"quantized_model_present = int8_pipe is not None\n",
"\n",
"use_quantized_model = widgets.Checkbox(\n",
Expand Down
2 changes: 2 additions & 0 deletions notebooks/sdxl-turbo/sdxl-turbo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@
"\n",
"int8_pipe = None\n",
"\n",
"core = ov.Core()\n",
"\n",
"%load_ext skip_kernel_extension"
]
},
Expand Down

0 comments on commit fc07eb4

Please sign in to comment.