Skip to content

Commit

Permalink
fix table of content style and dependencies install in sd torchdynamo (
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova authored Jan 19, 2024
1 parent d3545d0 commit 0429d63
Showing 1 changed file with 35 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,23 @@
"\n",
"1. Create pipeline with PyTorch models.\n",
"2. Add OpenVINO optimization using OpenVINO TorchDynamo backend.\n",
"3. Run Stable Diffusion pipeline with OpenVINO."
"3. Run Stable Diffusion pipeline with OpenVINO.\n",
"\n",
"#### Table of contents:\n",
"- [Prerequisites](#Prerequisites)\n",
"- [Stable Diffusion with Diffusers library](#Stable-Diffusion-with-Diffusers-library)\n",
"- [OpenVINO TorchDynamo backend](#OpenVINO-TorchDynamo-backend)\n",
" - [Run Image generation](#Run-Image-generation)\n",
"- [Interactive demo](#Interactive-demo)\n",
"- [Support for Automatic1111 Stable Diffusion WebUI](#Support-for-Automatic1111-Stable-Diffusion-WebUI)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Table of content:\n",
"- [Prerequisites](#Prerequisites-Uparrow)\n",
"- [Stable Diffusion with Diffusers library](#Stable-Diffusion-with-Diffusers-library-Uparrow)\n",
"- [OpenVINO TorchDynamo backend](OpenVINO-TorchDynamo-backend-Uparrow)\n",
"- [Interactive demo](#Run-Text-to-Image-or-Image-to-Image-generation-Uparrow)\n",
"- [Support for Automatic1111 Stable Diffusion WebUI](Support-for-Automatic1111-Stable-Diffusion-WebUI-Uparrow)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Prerequisites [$\\Uparrow$](#Table-of-content:)\n"
"## Prerequisites\n",
"[back to top ⬆️](#Table-of-contents:)"
]
},
{
Expand All @@ -45,7 +42,8 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install -q torch transformers diffusers gradio ipywidgets\n",
"%pip uninstall openvino-dev openvino openvino-nightly\n",
"%pip install -q torch transformers diffusers gradio ipywidgets --extra-index-url https://download.pytorch.org/whl/cpu\n",
"%pip install -q openvino-nightly"
]
},
Expand All @@ -68,7 +66,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Stable Diffusion with Diffusers library [$\\Uparrow$](#Table-of-content:)\n",
"## Stable Diffusion with Diffusers library\n",
"[back to top ⬆️](#Table-of-contents:)\n",
"\n",
"To work with Stable Diffusion v2.1, we will use Hugging Face Diffusers library. To experiment with Stable Diffusion models, Diffusers exposes the [StableDiffusionPipeline](https://huggingface.co/docs/diffusers/using-diffusers/conditional_image_generation) and [StableDiffusionImg2ImgPipeline](https://huggingface.co/docs/diffusers/using-diffusers/img2img) similar to the other [Diffusers pipelines](https://huggingface.co/docs/diffusers/api/pipelines/overview). The code below demonstrates how to create the `StableDiffusionPipeline` using `stable-diffusion-2-1-base` model:"
]
Expand All @@ -89,7 +88,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## OpenVINO TorchDynamo backend [$\\Uparrow$](#Table-of-content:)\n",
"## OpenVINO TorchDynamo backend\n",
"[back to top ⬆️](#Table-of-contents:)\n",
"\n",
"The [OpenVINO TorchDynamo backend](https://docs.openvino.ai/2023.1/pytorch_2_0_torch_compile.html) lets you enable [OpenVINO](https://docs.openvino.ai/2023.1/home.html) support for PyTorch models with minimal changes to the original PyTorch script. It speeds up PyTorch code by JIT-compiling it into optimized kernels. By default, Torch code runs in eager-mode, but with the use of torch.compile it goes through the following steps:\n",
"1. Graph acquisition - the model is rewritten as blocks of subgraphs that are either:\n",
Expand Down Expand Up @@ -200,7 +200,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Run Image generation\n"
"### Run Image generation\n",
"[back to top ⬆️](#Table-of-contents:)\n"
]
},
{
Expand Down Expand Up @@ -238,7 +239,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Interactive demo [$\\Uparrow$](#Table-of-content:)\n",
"# Interactive demo\n",
"[back to top ⬆️](#Table-of-contents:)\n",
"\n",
"Now you can start the demo, choose the inference mode, define prompts (and input image for Image-to-Image generation) and run inference pipeline.\n",
"Optionally, you can also change some input parameters."
]
Expand Down Expand Up @@ -383,16 +386,18 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Support for Automatic1111 Stable Diffusion WebUI [$\\Uparrow$](#Table-of-content:)\n",
"## Support for Automatic1111 Stable Diffusion WebUI\n",
"[back to top ⬆️](#Table-of-contents:)\n",
"\n",
"Automatic1111 Stable Diffusion WebUI is an open-source repository that hosts a browser-based interface for the Stable Diffusion based image generation. It allows users to create realistic and creative images from text prompts. Stable Diffusion WebUI is supported on Intel CPUs, Intel integrated GPUs, and Intel discrete GPUs by leveraging OpenVINO torch.compile capability. Detailed instructions are available in[ Stable Diffusion WebUI repository](https://github.com/openvinotoolkit/stable-diffusion-webui/wiki/Installation-on-Intel-Silicon)."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "new_env",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "new_env"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -404,7 +409,14 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.8.10"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {},
"version_major": 2,
"version_minor": 0
}
}
},
"nbformat": 4,
Expand Down

0 comments on commit 0429d63

Please sign in to comment.