A HuggingFace Transformers streaming response API written in python using FastAPI.
Uses NPM for scripting and pip for python dependencies.
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}
npm run start
npm run dev
/chat - Give it a single prompt with the ?prompt= query parameter and it will return a stream of responses.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
# ...
A HuggingFace Transformers streaming response API written in python using FastAPI.
Uses NPM for scripting and pip for python dependencies.
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}
npm run start
npm run dev
/chat - Give it a single prompt with the ?prompt= query parameter and it will return a stream of responses.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
# ...