Giter Club home page Giter Club logo

llama2's Introduction

Llama-2 Streaming API

A HuggingFace Transformers streaming response API written in python using FastAPI.

Uses NPM for scripting and pip for python dependencies.

Requirements

  • Python 3.10.x || 3.11.x (other versions may work but are not tested)
  • pip requirements
    • fastapi
    • uvicorn
    • gunicorn
    • transformers
    • torch
  • gptq requirements (pip)
    • auto-gptq
    • optimum
  • Hardware
    • Nvidia GPU with minimum 8GB vram (12+ recommended for running 13B+ param models)
    • 16GB+ System RAM
    • A reasonable amount of free storage for the model weights (13B GPTQ Models require around 8GB of space each)

Installation

You can install torch with either the npm script or the torch install website

git clone https://github.com/alexng353/llama2

npm run venv:setup
npm run venv:activate

npm run setup
npm run pip:install-rquired
npm run pip:install-gptq

# install torch
# platform: linux, macos, windows
# version: default, cu121, cu118 (macos only supports default. windows and linux use cu121 as default)
npm run torch:install-{platform}-{version}

Usage

npm run start

Development

npm run dev

Routes

  • /chat - Give it a single prompt with the ?prompt= query parameter and it will return a stream of responses.

Modifying Settings

This application comes with reasonable defaults for running on a local machine.

./src/llama.py includes a class called MODELS which contains a default list of models that I think would be most popular. To change the model, go line 13 of ./src/server.py and use either a model from the MODELS class or a any huggingface model name.

Any model from TheBloke's GPTQ Quantisations will work, non-gptq models are untested but may work with modifications to the code.

# ...

MODEL = MODELS.LLAMA_2_13B_CHAT_GPTQ # <- change this

# ...

Attributions

llama2's People

Contributors

alexng353 avatar

Stargazers

 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.