Low-cost, Low-latency, High-quality Large Language Model Inference Based on Edge-cloud Collaboration
pip install -r requirement.txt
(Customize) Find your models here and download it.
./llama-70b-chat-hf/ # cloud-LLM
./llama-7b-chat-hf/ # edge-LLM
(Customize) Evaluate your results with modify the hyper-parameter in ECLLM.py.
python ECLLM.py
Please prepare your model first refer to Model Download in Quick Start.
(Customize) Organize your train data in the following format.
{
"index": "1", # index
"instruction": "", # prompt or user query
"input": "", # user query
"output": "", # answer
"language": "en" # optional
}
Finetune your model with finetune.sh or with the script as below.
CUDA_VISIBLE_DEVICES=0,1,2,3 \
nohup python finetune.py \
--base_model './llama-7b-chat-hf' \
--data_path './dataset/train/boolq.json' \
--output_dir './output/boolq_chat_ep3/' \
> ./output/boolq_chat_ep3/train.log 2>&1
Please prepare your finetuned model first refer to Finetune.
(Customize) Organize your dev data in the following format.
{
"index": "1", # index
"instruction": "", # prompt or user query
"input": "", # user query
"output": "", # None
"language": "en" # optional
}
Finetune your model with finetune.sh or with the script as below.
CUDA_VISIBLE_DEVICES=0,1 \
nohup python generate.py \
--base_model './llama-7b-chat-hf' \
--lora_weights './output/gsm8k_chat_ep3/checkpoint-120' \
--data_path './dataset/dev/gsm8k_dev.json' \
--result_path './dataset/7b/gsm8k.json' \
--load_8bit False \
> ./dataset/7b/gsm8k.log 2>&1
The docker container is used for edge-cloud collaborative deployement.
./Dokerfile
./Communication/edge
./communication/cloud