Skip to content
프로젝트

소개

간단한 C++/Python API와 OpenVINO Runtime을 사용해 생성형 AI 모델을 실행합니다.

AI 및 머신러닝

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
+1
in 7 days
+6
in 15 days
+14
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

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.

This library is friendly to PC and laptop execution, and optimized for resource consumption. It requires no external dependencies to run generative models as it already includes all the core functionality (e.g. tokenization via openvino-tokenizers).

Text generation using LLaMa 3.2 model running on Intel ARC770 dGPU

Getting Started

Explore blogs to setup your first hands-on experience with OpenVINO GenAI:

Quick Start

  1. Install OpenVINO GenAI from PyPI:
    pip install openvino-genai
    
  2. Obtain model, e.g. export model to OpenVINO IR format from Hugging Face (see Model Preparation Guide for more details):
    optimum-cli export openvino --model TinyLlama/TinyLlama-1.1B-Chat-v1.0 --weight-format int4 --trust-remote-code TinyLlama_1_1b_v1_ov
    
    Alternatively, use genai-cli (preview), the export tool shipped with OpenVINO GenAI. It takes the same options as optimum-cli export openvino:
    pip install openvino-genai[export]
    genai-cli export -m TinyLlama/TinyLlama-1.1B-Chat-v1.0 --weight-format int4 TinyLlama_1_1b_v1_ov
    
  3. Run inference:
    import openvino_genai as ov_genai
    
    pipe = ov_genai.LLMPipeline("TinyLlama_1_1b_v1_ov", "CPU")  # Use CPU or GPU as devices without any other code change
    print(pipe.generate("What is OpenVINO?", max_new_tokens=100))
    

Supported Generative AI Scenarios

OpenVINO™ GenAI library provides very lightweight C++, Python, and Node.js APIs to run the following Generative AI Scenarios:

Library efficiently supports LoRA adapters for Text, Image and Video generation scenarios:

  • Load multiple adapters per model
  • Select active adapters for every generation
  • Mix multiple adapters with coefficients via alpha blending

All scenarios are run on top of OpenVINO Runtime that supports inference on CPU, GPU and NPU. See here for platform support matrix.

Supported Generative AI Optimization Methods

OpenVINO™ GenAI library provides a transparent way to use state-of-the-art generation optimizations:

  • Speculative decoding that employs two models of different sizes and uses the large model to periodically correct the results of the small model. See here for more detailed overview
  • KVCache token eviction algorithm that reduces the size of the KVCache by pruning less impacting tokens.
  • Sparse attention, which accelerates prefill by attending only to the most important regions of the attention matrix. OpenVINO GenAI currently supports two modes: Tri-shape and XAttention. See here for more details.

Additionally, OpenVINO™ GenAI library implements a continuous batching approach to use OpenVINO within LLM serving. The continuous batching library could be used in LLM serving frameworks and supports the following features:

  • Prefix caching that caches fragments of previous generation requests and corresponding KVCache entries internally and uses them in case of repeated query.

Continuous batching functionality is used within OpenVINO Model Server (OVMS) to serve LLMs, see here for more details.

Additional Resources

License

The OpenVINO™ GenAI repository is licensed under Apache License Version 2.0. By contributing to the project, you agree to the license and copyright terms therein and release your contribution under these terms.

관련 프로젝트 살펴보기

불러오는 중…