Code Monkey home page Code Monkey logo

fastapi_llm_streaming's Introduction

FastAPI_LLM_Streaming

This repository provides the necessary tools to deploy streaming inference endpoints for large language models (LLMs) hosted on Hugging Face, using FastAPI. It leverages the power of Hugging Face models and Intel's optimization libraries to offer efficient and scalable real-time inference capabilities.

Overview

The project includes a Python script (serve.py) for setting up a FastAPI server that can handle streaming requests to LLMs, providing an efficient way to interact with models for real-time inference. It's optimized for Intel hardware, utilizing the intel_extension_for_transformers library to enhance performance on compatible CPUs.

Installation

To get started, clone this repository and install the required dependencies.

git clone https://github.com/eduand-alvarez/FastAPI_LLM_Streaming.git
cd FastAPI_LLM_Streaming
pip install -r requirements.txt

Usage

  1. Start the FastAPI server:

Run the serve.py script to start the server:

python serve.py

This command starts the FastAPI application on port 5004, making it accessible on your network.

  1. Interacting with the API:

Once the server is running, you can make HTTP GET requests to the /query-stream/ endpoint to interact with the deployed LLM. The request should include the query parameter and the selected_model parameter to specify the model you wish to use for inference.

Supported Models

Currently, the server is configured to support specific models from Hugging Face. These models are defined within the serve.py script and can be easily extended by modifying the ITREXLoader function within loader.py.

fastapi_llm_streaming's People

Contributors

eduand-alvarez avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.