aliasfoxkde / Alpaca-LoRA-Serve

Alpaca-LoRA as Chatbot service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Alpaca-LoRA as a service

Demonstrate Alpaca-LoRA as a Chatbot service with Alpaca-LoRA and Gradio. Main features include:

  • it enables batch inference by aggregating requests until the previous requests are finished (fixed at 4)

  • it achieves context aware by keeping chatting history with the following string:

f"""
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Input: {input} # Surrounding information to AI
### Instruction: {prompt1} # First instruction/prompt given by user
### Response {response1} # First response on the first prompt by AI
### Instruction: {prompt2} # Second instruction/prompt given by user
### Response: {response2} # Second response on the first prompt by AI
....
"""
  • it provides an additional script to run various configurations to see how it affects the generation quality and speed

  • it currently supports the following Alpaca-LoRA:

Instructions

  1. Prerequisites

Note that the code only works Python >= 3.9

$ conda create -n alpaca-serve python=3.9
$ conda activate alpaca-serve
  1. Install dependencies
$ pip install -r requirements.txt
  1. Run Gradio application
$ BASE_URL=decapoda-research/llama-7b-hf
$ FINETUNED_CKPT_URL=tloen/alpaca-lora-7b
$
$ python app.py --base_url $BASE_URL --ft_ckpt_url $FINETUNED_CKPT_URL --port 6006

Screenshots

About

Alpaca-LoRA as Chatbot service

License:Apache License 2.0


Languages

Language:Python 73.5%Language:Jupyter Notebook 26.5%