diff --git a/site/docs/getting-started/introduction.mdx b/site/docs/getting-started/introduction.mdx index 000b4b0bf1..56808c6105 100644 --- a/site/docs/getting-started/introduction.mdx +++ b/site/docs/getting-started/introduction.mdx @@ -4,3 +4,58 @@ sidebar_label: Introduction --- # Introduction to OpenVINO GenAI + +## What is OpenVINO GenAI? + +OpenVINOβ„’ GenAI is a library of the most popular Generative AI model pipelines, optimized execution methods, and samples that run on top of highly performant [OpenVINO Runtime](https://docs.openvino.ai/). +It provides simplified APIs for running generative models, hiding the complexity of the generation process and enabling developers to easily integrate state-of-the-art generative models into their applications with minimal code. + +As a lightweight solution designed for efficient inference, OpenVINO GenAI includes all the core functionality needed for generative model execution (e.g. tokenization via `openvino-tokenizers`) with no external dependencies required. +This library is friendly to PC and laptop execution, and optimized for resource consumption. + +## Key Features and Benefits + +- **πŸ“¦ Pre-built Generative AI Pipelines:** Ready-to-use pipelines for text generation (LLMs), image generation (Diffuser-based), speech processing (Whisper), and visual language models (VLMs). See all [supported use cases](/docs/category/use-cases). +- **πŸ‘£ Minimal Footprint:** Smaller binary size and reduced memory footprint compared to other frameworks. +- **πŸš€ Performance Optimization:** Hardware-specific optimizations for CPU, GPU, and NPU devices. +- **πŸ‘¨β€πŸ’» Programming Language Support:** Comprehensive APIs in both Python and C++. +- **πŸ—œοΈ Model Compression:** Support for 8-bit and 4-bit weight compression, including embedding layers. +- **πŸŽ“ Advanced Inference Capabilities:** In-place KV-cache, dynamic quantization, speculative sampling, and more. +- **🎨 Wide Model Compatibility:** Support for popular models including Llama, Mistral, Phi, Qwen, Stable Diffusion, Flux, Whisper, and others. Refer to the [Supported Models](/docs/supported-models) for more details. + +## Workflow Overview + +Using OpenVINO GenAI typically involves three main steps: + +1. **Model Preparation:** + - Convert model from other frameworks to the OpenVINO IR format (e.g. using `optimum-intel`), optionally applying weights compression. + - Download pre-converted model in OpenVINO IR format (e.g. from [OpenVINO Toolkit](https://huggingface.co/OpenVINO) organization on Hugging Face). + :::info + + You can use models from [Hugging Face](https://huggingface.co/) and [ModelScope](https://modelscope.cn/home) + + ::: +2. **Pipeline Setup:** Initialize the appropriate pipeline for your task (`LLMPipeline`, `Text2ImagePipeline`, `WhisperPipeline`, `VLMPipeline`, etc.) with the converted model. +3. **Inference:** Run the model with your inputs using the pipeline's simple API. + +![OpenVINO GenAI Workflow](/img/openvino-genai-workflow.svg) + +## Comparison with Alternatives + +Unlike base OpenVINO, which requires manual implementation of generation loops, tokenization, scheduling etc., OpenVINO GenAI provides these components in a ready-to-use package. + +Compared to Hugging Face Optimum Intel, OpenVINO GenAI offers a smaller footprint, fewer dependencies, and better performance optimization options, particularly for C++ applications. + +| Feature | OpenVINO GenAI | Base OpenVINO | Hugging Face Optimum Intel | +|-|-|-|-| +| Easy-to-use APIs | βœ… | ❌ | βœ… | +| Low footprint | βœ… | βœ… | ❌ | +| C++ support | βœ… | βœ… | ❌ | +| Pre-built pipelines | βœ… | ❌ | βœ… | +| Model variety | Medium | High | High | + +## System Requirements + +OpenVINO GenAI is built on top of OpenVINO Runtime and shares the same system requirements. + +Refer to the [OpenVINO System Requirements](https://docs.openvino.ai/2025/about-openvino/release-notes-openvino/system-requirements.html) for more details. diff --git a/site/docs/supported-models/_category_.json b/site/docs/supported-models/_category_.json new file mode 100644 index 0000000000..8c0ec25226 --- /dev/null +++ b/site/docs/supported-models/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "Supported Models", + "position": 4, + "link": { + "type": "doc", + "id": "supported-models/index" + } +} diff --git a/site/docs/supported-models/_components/base-models-table/index.tsx b/site/docs/supported-models/_components/base-models-table/index.tsx new file mode 100644 index 0000000000..e800c461d2 --- /dev/null +++ b/site/docs/supported-models/_components/base-models-table/index.tsx @@ -0,0 +1,38 @@ +import Link from '@docusaurus/Link'; +import { Children } from 'react'; + +type BaseModelsTableProps = { + headers: string[]; + rows: React.JSX.Element[]; +}; + +export function BaseModelsTable({ headers, rows }: BaseModelsTableProps): React.JSX.Element { + return ( + + + + {headers.map((v) => ( + + ))} + + + {Children.map(rows, (row) => row)} +
{v}
+ ); +} + +export const LinksCell = ({ links }: { links: string[] }) => ( + + + +); + +export const StatusCell = ({ value }: { value: boolean }) => ( + {value ? 'βœ…' : '❌'} +); diff --git a/site/docs/supported-models/_components/image-generation-models-table/index.tsx b/site/docs/supported-models/_components/image-generation-models-table/index.tsx new file mode 100644 index 0000000000..ad95b52003 --- /dev/null +++ b/site/docs/supported-models/_components/image-generation-models-table/index.tsx @@ -0,0 +1,29 @@ +import React from 'react'; +import { BaseModelsTable, LinksCell, StatusCell } from '../base-models-table'; +import { IMAGE_GENERATION_MODELS } from './models'; + +export default function ImageGenerationModelsTable(): React.JSX.Element { + const headers = [ + 'Architecture', + 'Text to Image', + 'Image to Image', + 'LoRA Support', + 'Example HuggingFace Models', + ]; + + const rows = IMAGE_GENERATION_MODELS.map( + ({ architecture, textToImage, imageToImage, loraSupport, links }) => ( + + + {architecture} + + + + + + + ) + ); + + return ; +} diff --git a/site/docs/supported-models/_components/image-generation-models-table/models.ts b/site/docs/supported-models/_components/image-generation-models-table/models.ts new file mode 100644 index 0000000000..bfe7a7a0c6 --- /dev/null +++ b/site/docs/supported-models/_components/image-generation-models-table/models.ts @@ -0,0 +1,85 @@ +type ImageGenerationModelType = { + architecture: string; + textToImage: boolean; + imageToImage: boolean; + loraSupport: boolean; + links: string[]; +}; + +export const IMAGE_GENERATION_MODELS: ImageGenerationModelType[] = [ + { + architecture: 'Latent Consistency Model', + textToImage: true, + imageToImage: true, + loraSupport: true, + links: ['https://huggingface.co/SimianLuo/LCM_Dreamshaper_v7'], + }, + { + architecture: 'Stable Diffusion', + textToImage: true, + imageToImage: true, + loraSupport: true, + links: [ + 'https://huggingface.co/CompVis/stable-diffusion-v1-1', + 'https://huggingface.co/CompVis/stable-diffusion-v1-2', + 'https://huggingface.co/CompVis/stable-diffusion-v1-3', + 'https://huggingface.co/CompVis/stable-diffusion-v1-4', + 'https://huggingface.co/junnyu/stable-diffusion-v1-4-paddle', + 'https://huggingface.co/jcplus/stable-diffusion-v1-5', + 'https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5', + 'https://huggingface.co/botp/stable-diffusion-v1-5', + 'https://huggingface.co/dreamlike-art/dreamlike-anime-1.0', + 'https://huggingface.co/stabilityai/stable-diffusion-2', + 'https://huggingface.co/stabilityai/stable-diffusion-2-base', + 'https://huggingface.co/stabilityai/stable-diffusion-2-1', + 'https://huggingface.co/bguisard/stable-diffusion-nano-2-1', + 'https://huggingface.co/justinpinkney/pokemon-stable-diffusion', + 'https://huggingface.co/stablediffusionapi/architecture-tuned-model', + 'https://huggingface.co/IDEA-CCNL/Taiyi-Stable-Diffusion-1B-Chinese-EN-v0.1', + 'https://huggingface.co/ZeroCool94/stable-diffusion-v1-5', + 'https://huggingface.co/pcuenq/stable-diffusion-v1-4', + 'https://huggingface.co/rinna/japanese-stable-diffusion', + 'https://huggingface.co/benjamin-paine/stable-diffusion-v1-5', + 'https://huggingface.co/philschmid/stable-diffusion-v1-4-endpoints', + 'https://huggingface.co/naclbit/trinart_stable_diffusion_v2', + 'https://huggingface.co/Fictiverse/Stable_Diffusion_PaperCut_Model', + ], + }, + { + architecture: 'Stable Diffusion XL', + textToImage: true, + imageToImage: true, + loraSupport: true, + links: [ + 'https://huggingface.co/stabilityai/stable-diffusion-xl-base-0.9', + 'https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0', + 'https://huggingface.co/stabilityai/sdxl-turbo', + ], + }, + { + architecture: 'Stable Diffusion 3', + textToImage: true, + imageToImage: false, + loraSupport: false, + links: [ + 'https://huggingface.co/stabilityai/stable-diffusion-3-medium-diffusers', + 'https://huggingface.co/stabilityai/stable-diffusion-3.5-medium', + 'https://huggingface.co/stabilityai/stable-diffusion-3.5-large', + 'https://huggingface.co/stabilityai/stable-diffusion-3.5-large-turbo', + ], + }, + { + architecture: 'Flux', + textToImage: true, + imageToImage: false, + loraSupport: false, + links: [ + 'https://huggingface.co/black-forest-labs/FLUX.1-schnell', + 'https://huggingface.co/Freepik/flux.1-lite-8B-alpha', + 'https://huggingface.co/black-forest-labs/FLUX.1-dev', + 'https://huggingface.co/shuttleai/shuttle-3-diffusion', + 'https://huggingface.co/shuttleai/shuttle-3.1-aesthetic', + 'https://huggingface.co/Shakker-Labs/AWPortrait-FL', + ], + }, +]; diff --git a/site/docs/supported-models/_components/inpainting-models-table/index.tsx b/site/docs/supported-models/_components/inpainting-models-table/index.tsx new file mode 100644 index 0000000000..5ff5eaa067 --- /dev/null +++ b/site/docs/supported-models/_components/inpainting-models-table/index.tsx @@ -0,0 +1,19 @@ +import React from 'react'; +import { BaseModelsTable, LinksCell, StatusCell } from '../base-models-table'; +import { INPAINTING_MODELS } from './models'; + +export default function InpaintingModelsTable(): React.JSX.Element { + const headers = ['Architecture', 'LoRA Support', 'Example HuggingFace Models']; + + const rows = INPAINTING_MODELS.map(({ architecture, loraSupport, links }) => ( + + + {architecture} + + + + + )); + + return ; +} diff --git a/site/docs/supported-models/_components/inpainting-models-table/models.ts b/site/docs/supported-models/_components/inpainting-models-table/models.ts new file mode 100644 index 0000000000..368963a700 --- /dev/null +++ b/site/docs/supported-models/_components/inpainting-models-table/models.ts @@ -0,0 +1,23 @@ +type InpaintingModelType = { + architecture: string; + loraSupport: boolean; + links: string[]; +}; + +export const INPAINTING_MODELS: InpaintingModelType[] = [ + { + architecture: 'Stable Diffusion', + loraSupport: true, + links: [ + 'https://huggingface.co/stabilityai/stable-diffusion-2-inpainting', + 'https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-inpainting', + 'https://huggingface.co/botp/stable-diffusion-v1-5-inpainting', + 'https://huggingface.co/parlance/dreamlike-diffusion-1.0-inpainting', + ], + }, + { + architecture: 'Stable Diffusion XL', + loraSupport: true, + links: ['https://huggingface.co/diffusers/stable-diffusion-xl-1.0-inpainting-0.1'], + }, +]; diff --git a/site/docs/supported-models/_components/llm-models-table/index.tsx b/site/docs/supported-models/_components/llm-models-table/index.tsx new file mode 100644 index 0000000000..23979368c9 --- /dev/null +++ b/site/docs/supported-models/_components/llm-models-table/index.tsx @@ -0,0 +1,27 @@ +import React from 'react'; +import { BaseModelsTable, LinksCell } from '../base-models-table'; +import { LLM_MODELS } from './models'; + +export default function LLMModelsTable(): React.JSX.Element { + const headers = ['Architecture', 'Models', 'Example HuggingFace Models']; + + const rows = LLM_MODELS.map(({ architecture, models }) => ( + <> + + + {architecture} + + {models[0].name} + + + {models.slice(1).map(({ name, links }) => ( + + {name} + + + ))} + + )); + + return ; +} diff --git a/site/docs/supported-models/_components/llm-models-table/models.ts b/site/docs/supported-models/_components/llm-models-table/models.ts new file mode 100644 index 0000000000..a54809f1d7 --- /dev/null +++ b/site/docs/supported-models/_components/llm-models-table/models.ts @@ -0,0 +1,124 @@ +type LLMModelType = { + architecture: string; + models: Array<{ + name: string; + links: string[]; + }>; +}; + +export const LLM_MODELS: LLMModelType[] = [ + { + architecture: 'ChatGLMModel', + models: [ + { + name: 'ChatGLM', + links: ['https://huggingface.co/THUDM/chatglm3-6b'], + }, + ], + }, + { + architecture: 'GemmaForCausalLM', + models: [ + { + name: 'Gemma', + links: ['https://huggingface.co/google/gemma-2b-it'], + }, + ], + }, + { + architecture: 'GPTNeoXForCausalLM', + models: [ + { + name: 'Dolly', + links: ['https://huggingface.co/databricks/dolly-v2-3b'], + }, + { + name: 'RedPajama', + links: ['https://huggingface.co/ikala/redpajama-3b-chat'], + }, + ], + }, + { + architecture: 'LlamaForCausalLM', + models: [ + { + name: 'Llama 3', + links: [ + 'https://huggingface.co/meta-llama/Meta-Llama-3-8B', + 'https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct', + 'https://huggingface.co/meta-llama/Meta-Llama-3-70B', + 'https://huggingface.co/meta-llama/Meta-Llama-3-70B-Instruct', + ], + }, + { + name: 'Llama 2', + links: [ + 'https://huggingface.co/meta-llama/Llama-2-13b-chat-hf', + 'https://huggingface.co/meta-llama/Llama-2-13b-hf', + 'https://huggingface.co/meta-llama/Llama-2-7b-chat-hf', + 'https://huggingface.co/meta-llama/Llama-2-7b-hf', + 'https://huggingface.co/meta-llama/Llama-2-70b-chat-hf', + 'https://huggingface.co/meta-llama/Llama-2-70b-hf', + 'https://huggingface.co/microsoft/Llama2-7b-WhoIsHarryPotter', + ], + }, + { + name: 'OpenLLaMA', + links: [ + 'https://huggingface.co/openlm-research/open_llama_13b', + 'https://huggingface.co/openlm-research/open_llama_3b', + 'https://huggingface.co/openlm-research/open_llama_3b_v2', + 'https://huggingface.co/openlm-research/open_llama_7b', + 'https://huggingface.co/openlm-research/open_llama_7b_v2', + ], + }, + { + name: 'TinyLlama', + links: ['https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0'], + }, + ], + }, + { + architecture: 'MistralForCausalLM', + models: [ + { + name: 'Mistral', + links: ['https://huggingface.co/mistralai/Mistral-7B-v0.1'], + }, + { + name: 'Notus', + links: ['https://huggingface.co/argilla/notus-7b-v1'], + }, + { + name: 'Zephyr', + links: ['https://huggingface.co/HuggingFaceH4/zephyr-7b-bet1'], + }, + ], + }, + { + architecture: 'PhiForCausalLM', + models: [ + { + name: 'Phi', + links: [ + 'https://huggingface.co/microsoft/phi-2', + 'https://huggingface.co/microsoft/phi-1_5', + ], + }, + ], + }, + { + architecture: 'QWenLMHeadModel', + models: [ + { + name: 'Qwen', + links: [ + 'https://huggingface.co/Qwen/Qwen-7B-Chat', + 'https://huggingface.co/Qwen/Qwen-7B-Chat-Int4', + 'https://huggingface.co/Qwen/Qwen1.5-7B-Chat', + 'https://huggingface.co/Qwen/Qwen1.5-7B-Chat-GPTQ-Int4', + ], + }, + ], + }, +]; diff --git a/site/docs/supported-models/_components/vlm-models-table/index.tsx b/site/docs/supported-models/_components/vlm-models-table/index.tsx new file mode 100644 index 0000000000..1bb4adb619 --- /dev/null +++ b/site/docs/supported-models/_components/vlm-models-table/index.tsx @@ -0,0 +1,29 @@ +import React from 'react'; +import { BaseModelsTable, LinksCell, StatusCell } from '../base-models-table'; +import { VLM_MODELS } from './models'; + +export default function VLMModelsTable(): React.JSX.Element { + const headers = ['Architecture', 'Models', 'LoRA Support', 'Example HuggingFace Models']; + + const rows = VLM_MODELS.map(({ architecture, models }) => ( + <> + + + {architecture} + + {models[0].name} + + + + {models.slice(1).map(({ name, loraSupport, links }) => ( + + {name} + + + + ))} + + )); + + return ; +} diff --git a/site/docs/supported-models/_components/vlm-models-table/models.ts b/site/docs/supported-models/_components/vlm-models-table/models.ts new file mode 100644 index 0000000000..90256b1aad --- /dev/null +++ b/site/docs/supported-models/_components/vlm-models-table/models.ts @@ -0,0 +1,79 @@ +type VLMModelType = { + architecture: string; + models: Array<{ + name: string; + loraSupport: boolean; + links: string[]; + }>; +}; + +export const VLM_MODELS: VLMModelType[] = [ + { + architecture: 'InternVL2', + models: [ + { + name: 'InternVL2', + loraSupport: false, + links: [ + 'https://huggingface.co/OpenGVLab/InternVL2-1B', + 'https://huggingface.co/OpenGVLab/InternVL2-2B', + 'https://huggingface.co/OpenGVLab/InternVL2-4B', + 'https://huggingface.co/OpenGVLab/InternVL2-8B', + 'https://huggingface.co/OpenGVLab/InternVL2_5-1B', + 'https://huggingface.co/OpenGVLab/InternVL2_5-2B', + 'https://huggingface.co/OpenGVLab/InternVL2_5-4B', + 'https://huggingface.co/OpenGVLab/InternVL2_5-8B', + ], + }, + ], + }, + { + architecture: 'LLaVA', + models: [ + { + name: 'LLaVA-v1.5', + loraSupport: false, + links: ['https://huggingface.co/llava-hf/llava-1.5-7b-hf'], + }, + ], + }, + { + architecture: 'LLaVA-NeXT', + models: [ + { + name: 'LLaVA-v1.6', + loraSupport: false, + links: [ + 'https://huggingface.co/llava-hf/llava-v1.6-mistral-7b-hf', + 'https://huggingface.co/llava-hf/llava-v1.6-vicuna-7b-hf', + 'https://huggingface.co/llava-hf/llama3-llava-next-8b-hf', + ], + }, + ], + }, + { + architecture: 'MiniCPMV', + models: [ + { + name: 'MiniCPM-V-2_6', + loraSupport: false, + links: ['https://huggingface.co/openbmb/MiniCPM-V-2_6'], + }, + ], + }, + { + architecture: 'Qwen2-VL', + models: [ + { + name: 'Qwen2-VL', + loraSupport: false, + links: [ + 'https://huggingface.co/Qwen/Qwen2-VL-2B-Instruct', + 'https://huggingface.co/Qwen/Qwen2-VL-7B-Instruct', + 'https://huggingface.co/Qwen/Qwen2-VL-2B', + 'https://huggingface.co/Qwen/Qwen2-VL-7B', + ], + }, + ], + }, +]; diff --git a/site/docs/supported-models/_components/whisper-models-table/index.tsx b/site/docs/supported-models/_components/whisper-models-table/index.tsx new file mode 100644 index 0000000000..b48b1dfb54 --- /dev/null +++ b/site/docs/supported-models/_components/whisper-models-table/index.tsx @@ -0,0 +1,29 @@ +import React from 'react'; +import { BaseModelsTable, LinksCell, StatusCell } from '../base-models-table'; +import { WHISPER_MODELS } from './models'; + +export default function WhisperModelsTable(): React.JSX.Element { + const headers = ['Architecture', 'Models', 'LoRA Support', 'Example HuggingFace Models']; + + const rows = WHISPER_MODELS.map(({ architecture, models }) => ( + <> + + + {architecture} + + {models[0].name} + + + + {models.slice(1).map(({ name, loraSupport, links }) => ( + + {name} + + + + ))} + + )); + + return ; +} diff --git a/site/docs/supported-models/_components/whisper-models-table/models.ts b/site/docs/supported-models/_components/whisper-models-table/models.ts new file mode 100644 index 0000000000..44177796b7 --- /dev/null +++ b/site/docs/supported-models/_components/whisper-models-table/models.ts @@ -0,0 +1,40 @@ +type WhisperModelType = { + architecture: string; + models: Array<{ + name: string; + loraSupport: boolean; + links: string[]; + }>; +}; + +export const WHISPER_MODELS: WhisperModelType[] = [ + { + architecture: 'WhisperForConditionalGeneration', + models: [ + { + name: 'Whisper', + loraSupport: false, + links: [ + 'https://huggingface.co/openai/whisper-tiny', + 'https://huggingface.co/openai/whisper-tiny.en', + 'https://huggingface.co/openai/whisper-base', + 'https://huggingface.co/openai/whisper-base.en', + 'https://huggingface.co/openai/whisper-small', + 'https://huggingface.co/openai/whisper-small.en', + 'https://huggingface.co/openai/whisper-medium', + 'https://huggingface.co/openai/whisper-medium.en', + 'https://huggingface.co/openai/whisper-large-v3', + ], + }, + { + name: 'Distil-Whisper', + loraSupport: false, + links: [ + 'https://huggingface.co/distil-whisper/distil-small.en', + 'https://huggingface.co/distil-whisper/distil-medium.en', + 'https://huggingface.co/distil-whisper/distil-large-v3', + ], + }, + ], + }, +]; diff --git a/site/docs/supported-models/index.mdx b/site/docs/supported-models/index.mdx new file mode 100644 index 0000000000..d2093326d5 --- /dev/null +++ b/site/docs/supported-models/index.mdx @@ -0,0 +1,69 @@ +import ImageGenerationModelsTable from './_components/image-generation-models-table'; +import InpaintingModelsTable from './_components/inpainting-models-table'; +import LLMModelsTable from './_components/llm-models-table'; +import VLMModelsTable from './_components/vlm-models-table'; +import WhisperModelsTable from './_components/whisper-models-table'; + + +# Supported Models + +:::info + +Other models with similar architectures may also work successfully even if not explicitly validated. +Consider testing any unlisted models to verify compatibility with your specific use case. + +::: + +## Large Language Models (LLMs) + + + +:::info + +LoRA adapters are supported. + +::: + +::::info + +The pipeline can work with other similar topologies produced by `optimum-intel` with the same model signature. +The model is required to have the following inputs after the conversion: + +1. `input_ids` contains the tokens. +2. `attention_mask` is filled with `1`. +3. `beam_idx` selects beams. +4. `position_ids` (optional) encodes a position of currently generating token in the sequence and a single `logits` output. + +:::note + +Models should belong to the same family and have the same tokenizers. + +::: + +:::: + +## Image Generation Models + + + +### Inpainting Models + +In addition to image generation models, `InpaintingPipeline` supports specialized inpainting models: + + + +## Visual Language Models (VLMs) + + + +## Speech Processing Models (Whisper-based) + + + +:::info + +Some models may require access request submission on the Hugging Face page to be downloaded. + +If https://huggingface.co/ is down, the conversion step won't be able to download the models. + +::: diff --git a/site/docs/use-cases/1-LLM-pipeline/_sections/_run_model/index.mdx b/site/docs/use-cases/1-LLM-pipeline/_sections/_run_model/index.mdx index dd9637d7be..242baf4771 100644 --- a/site/docs/use-cases/1-LLM-pipeline/_sections/_run_model/index.mdx +++ b/site/docs/use-cases/1-LLM-pipeline/_sections/_run_model/index.mdx @@ -29,7 +29,7 @@ It will automatically load the main model, tokenizer, detokenizer and default ge -:::note +:::tip Use CPU or GPU as devices without any other code change. diff --git a/site/docs/use-cases/1-LLM-pipeline/_sections/_usage_options/_speculative_decoding.mdx b/site/docs/use-cases/1-LLM-pipeline/_sections/_usage_options/_speculative_decoding.mdx index 1fbbc6d415..6fdb6227f8 100644 --- a/site/docs/use-cases/1-LLM-pipeline/_sections/_usage_options/_speculative_decoding.mdx +++ b/site/docs/use-cases/1-LLM-pipeline/_sections/_usage_options/_speculative_decoding.mdx @@ -1,6 +1,6 @@ ### Accelerate Generation via Speculative Decoding -Speculative decoding (or [assisted-generation](https://huggingface.co/blog/assisted-generation#understanding-text-generation-latency) in HF terminology) is a recent technique, that allows to speed up token generation when an additional smaller draft model is used alongside with the main model. +Speculative decoding (or [assisted-generation](https://huggingface.co/blog/assisted-generation#understanding-text-generation-latency) in Hugging Face terminology) is a recent technique, that allows to speed up token generation when an additional smaller draft model is used alongside with the main model. This reduces the number of infer requests to the main model, increasing performance.
diff --git a/site/docs/use-cases/2-Generating-Images.md b/site/docs/use-cases/2-Generating-Images.md deleted file mode 100644 index 990cd46747..0000000000 --- a/site/docs/use-cases/2-Generating-Images.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -sidebar_position: 1 ---- - -# Generating Images Using Diffusers diff --git a/site/docs/use-cases/2-Image-Generation/_sections/_run_model/_code_example_cpp.mdx b/site/docs/use-cases/2-Image-Generation/_sections/_run_model/_code_example_cpp.mdx new file mode 100644 index 0000000000..24054cd985 --- /dev/null +++ b/site/docs/use-cases/2-Image-Generation/_sections/_run_model/_code_example_cpp.mdx @@ -0,0 +1,16 @@ +import CodeBlock from '@theme/CodeBlock'; + + +{`#include "openvino/genai/image_generation/text2image_pipeline.hpp" +#include "imwrite.hpp" + +int main(int argc, char* argv[]) { + const std::string models_path = argv[1], prompt = argv[2]; + + ov::genai::Text2ImagePipeline pipe(models_path, "${props.device || 'CPU'}"); + ov::Tensor image = pipe.generate(prompt); + + imwrite("image.bmp", image, true); +} +`} + diff --git a/site/docs/use-cases/2-Image-Generation/_sections/_run_model/_code_example_python.mdx b/site/docs/use-cases/2-Image-Generation/_sections/_run_model/_code_example_python.mdx new file mode 100644 index 0000000000..f32ac7023a --- /dev/null +++ b/site/docs/use-cases/2-Image-Generation/_sections/_run_model/_code_example_python.mdx @@ -0,0 +1,13 @@ +import CodeBlock from '@theme/CodeBlock'; + + +{`import openvino_genai as ov_genai +from PIL import Image + +pipe = ov_genai.Text2ImagePipeline(model_path, "${props.device || 'CPU'}") +image_tensor = pipe.generate(prompt) + +image = Image.fromarray(image_tensor.data[0]) +image.save("image.bmp") +`} + diff --git a/site/docs/use-cases/2-Image-Generation/_sections/_run_model/index.mdx b/site/docs/use-cases/2-Image-Generation/_sections/_run_model/index.mdx new file mode 100644 index 0000000000..9b2bf5cc91 --- /dev/null +++ b/site/docs/use-cases/2-Image-Generation/_sections/_run_model/index.mdx @@ -0,0 +1,43 @@ +import CodeExampleCPP from './_code_example_cpp.mdx'; +import CodeExamplePython from './_code_example_python.mdx'; + +## Run Model Using OpenVINOβ„’ GenAI + +OpenVINO GenAI introduces `Text2ImagePipeline` for inference of text-to-image models such as Stable Diffusion 1.5, 2.1, XL, LCM, Flux, and more. +See all supported [image generation models](/docs/supported-models/#image-generation-models). + + + + + + + + + + + + + + + + :::info + + Code below requires installation of C++ compatible package. + See [here](https://docs.openvino.ai/2025/get-started/install-openvino/install-openvino-genai.html#archive-installation) for additional setup details, + or [How to Build OpenVINOβ„’ GenAI APP in C++](https://medium.com/openvino-toolkit/how-to-build-openvino-genai-app-in-c-32dcbe42fa67) blog for full instruction. + + ::: + + + + + + + + + +:::tip + +Use CPU or GPU as devices without any other code change. + +::: diff --git a/site/docs/use-cases/2-Image-Generation/_sections/_usage_options/index.mdx b/site/docs/use-cases/2-Image-Generation/_sections/_usage_options/index.mdx new file mode 100644 index 0000000000..9a5c86098a --- /dev/null +++ b/site/docs/use-cases/2-Image-Generation/_sections/_usage_options/index.mdx @@ -0,0 +1,74 @@ +## Additional Usage Options + +:::tip +Check out our [Python](https://github.com/openvinotoolkit/openvino.genai/tree/master/samples/python/) and [C++](https://github.com/openvinotoolkit/openvino.genai/tree/master/samples/cpp) samples. +::: + +### Use Different Generation Parameters + +You can adjust several parameters to control the image generation process, including dimensions and the number of inference steps: + + + + ```python + import openvino_genai as ov_genai + from PIL import Image + + pipe = ov_genai.Text2ImagePipeline(model_path, "CPU") + image_tensor = pipe.generate( + prompt, + # highlight-start + width=512, + height=512, + num_images_per_prompt=1, + num_inference_steps=30, + guidance_scale=7.5 + # highlight-end + ) + + image = Image.fromarray(image_tensor.data[0]) + image.save("image.bmp") + ``` + + + ```cpp + #include "openvino/genai/image_generation/text2image_pipeline.hpp" + #include "imwrite.hpp" + + int main(int argc, char* argv[]) { + const std::string models_path = argv[1], prompt = argv[2]; + + ov::genai::Text2ImagePipeline pipe(models_path, "CPU"); + ov::Tensor image = pipe.generate( + prompt, + // highlight-start + ov::genai::width(512), + ov::genai::height(512), + ov::genai::num_images_per_prompt(1), + ov::genai::num_inference_steps(30), + ov::genai::guidance_scale(7.5f) + // highlight-end + ); + + imwrite("image.bmp", image, true); + } + ``` + + + +:::info Understanding Image Generation Parameters + +- `width`: The width of resulting image(s). +- `height`: The height of resulting image(s). +- `num_images_per_prompt`: Specifies how many image variations to generate in a single request for the same prompt. +- `num_inference_steps`: Defines denoising iteration count. Higher values increase quality and generation time, lower values generate faster with less detail. +- `guidance_scale`: Balances prompt adherence vs. creativity. Higher values follow prompt more strictly, lower values allow more creative freedom. +- `rng_seed`: Controls randomness for reproducible results. Same seed produces identical images across runs. + +For the full list of generation parameters, refer to the [API reference](https://docs.openvino.ai/2025/api/genai_api/_autosummary/openvino_genai.Text2ImagePipeline.html#openvino_genai.Text2ImagePipeline.generate). + +::: + +### Working with LoRA Adapters + +TBD diff --git a/site/docs/use-cases/2-Image-Generation/index.mdx b/site/docs/use-cases/2-Image-Generation/index.mdx new file mode 100644 index 0000000000..7cd3500a23 --- /dev/null +++ b/site/docs/use-cases/2-Image-Generation/index.mdx @@ -0,0 +1,11 @@ +--- +sidebar_position: 1 +--- +import RunModelSection from './_sections/_run_model/index.mdx'; +import UsageOptionsSection from './_sections/_usage_options/index.mdx'; + +# Image Generation Using Diffusers + + + + diff --git a/site/docs/use-cases/_category_.json b/site/docs/use-cases/_category_.json index f2ecedef93..0d32a40f4b 100644 --- a/site/docs/use-cases/_category_.json +++ b/site/docs/use-cases/_category_.json @@ -1,5 +1,5 @@ { - "label": "Supported Use Cases", + "label": "Use Cases", "position": 3, "link": { "type": "generated-index", diff --git a/site/docusaurus.config.ts b/site/docusaurus.config.ts index 2e9b741cef..eb00c167d3 100644 --- a/site/docusaurus.config.ts +++ b/site/docusaurus.config.ts @@ -55,7 +55,7 @@ const config: Config = { }, // Please change this to your repo. // Remove this to remove the "edit this page" links. - editUrl: `https://github.com/${organizationName}/${projectName}/tree/main/site`, + editUrl: `https://github.com/${organizationName}/${projectName}/tree/master/site`, }, blog: false, theme: { diff --git a/site/src/components/image-generation.tsx b/site/src/components/image-generation.tsx index f8cf3401ff..29b154b58c 100644 --- a/site/src/components/image-generation.tsx +++ b/site/src/components/image-generation.tsx @@ -2,63 +2,19 @@ import { ExploreCodeSamples } from '@site/src/components/GoToLink/explore-code-s import { GoToDocumentation } from '@site/src/components/GoToLink/go-to-documentation'; import { LanguageTabs, TabItemCpp, TabItemPython } from '@site/src/components/LanguageTabs'; import { Section } from '@site/src/components/Section'; -import CodeBlock from '@theme/CodeBlock'; import { SectionImage } from './Section/section-image'; import ImagePlaceholder from '@site/static/img/image-generation-placeholder.webp'; +import CodeExampleCpp from '@site/docs/use-cases/2-Image-Generation/_sections/_run_model/_code_example_cpp.mdx'; +import CodeExamplePython from '@site/docs/use-cases/2-Image-Generation/_sections/_run_model/_code_example_python.mdx'; + const FEATURES = [ 'Alter parameters (width, height, iterations) and compile model for static size', 'Load LoRA adapters (in safetensor format) and dynamically switch between them', 'Generate multiple images per one request', ]; -const pythonCodeBlock = ( - - {`import argparse -from PIL import Image -import openvino_genai - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument('model_dir') - parser.add_argument('prompt') - args = parser.parse_args() - - device = 'CPU' # GPU, NPU can be used as well - pipe = openvino_genai.Text2ImagePipeline(args.model_dir, device) - image_tensor = pipe.generate( - args.prompt, - width=512, - height=512, - num_inference_steps=20 - ) - - image = Image.fromarray(image_tensor.data[0]) - image.save("image.bmp")`} - -); - -const cppCodeBlock = ( - - {`#include "openvino/genai/image_generation/text2image_pipeline.hpp" -#include "imwrite.hpp" -int main(int argc, char* argv[]) { - - const std::string models_path = argv[1], prompt = argv[2]; - const std::string device = "CPU"; // GPU, NPU can be used as well - - ov::genai::Text2ImagePipeline pipe(models_path, device); - ov::Tensor image = pipe.generate(prompt, - ov::genai::width(512), - ov::genai::height(512), - ov::genai::num_inference_steps(20)); - - imwrite("image.bmp", image, true); -}`} - -); - export const ImageGeneration = () => { return ( @@ -75,8 +31,12 @@ export const ImageGeneration = () => {
- {pythonCodeBlock} - {cppCodeBlock} + + + + + +
diff --git a/site/src/css/custom.css b/site/src/css/custom.css index b6b9026ba1..6d59491471 100644 --- a/site/src/css/custom.css +++ b/site/src/css/custom.css @@ -10,7 +10,6 @@ @import './menu.css'; @import './footer.css'; @import './toc.css'; -@import './breadcrumbs.css'; :root { --black: #000000; diff --git a/site/static/img/openvino-genai-workflow.svg b/site/static/img/openvino-genai-workflow.svg new file mode 100644 index 0000000000..1517985d4c --- /dev/null +++ b/site/static/img/openvino-genai-workflow.svg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:703732cd6a85f2cbcfd0915d63c10483114f05b71b834d2228501700074d0053 +size 1053573