Skip to content

Commit 2931147

Browse files
added finetuned model deployment tutorial in readme. (#648)
Signed-off-by: Ye, Xinyu <[email protected]>
1 parent 2fbce3e commit 2931147

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

comps/finetuning/README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ docker run --runtime=habana -e HABANA_VISIBLE_DEVICES=all -p 8015:8015 -e OMPI_M
8686

8787
## 🚀3. Consume Finetuning Service
8888

89-
## 3.1 Upload a training file
89+
### 3.1 Upload a training file
9090

9191
Download a training file, such as `alpaca_data.json` for instruction tuning and upload it to the server with below command, this file can be downloaded in [here](https://github.com/tatsu-lab/stanford_alpaca/blob/main/alpaca_data.json):
9292

@@ -97,9 +97,9 @@ curl http://${your_ip}:8015/v1/files -X POST -H "Content-Type: multipart/form-da
9797

9898
For reranking and embedding models finetuning, the training file [toy_finetune_data.jsonl](https://github.com/FlagOpen/FlagEmbedding/blob/master/examples/finetune/toy_finetune_data.jsonl) is an toy example.
9999

100-
## 3.2 Create fine-tuning job
100+
### 3.2 Create fine-tuning job
101101

102-
### 3.2.1 Instruction Tuning
102+
#### 3.2.1 Instruction Tuning
103103

104104
After a training file like `alpaca_data.json` is uploaded, use the following command to launch a finetuning job using `meta-llama/Llama-2-7b-chat-hf` as base model:
105105

@@ -114,7 +114,7 @@ curl http://${your_ip}:8015/v1/fine_tuning/jobs \
114114
}'
115115
```
116116

117-
### 3.2.2 Reranking Model Training
117+
#### 3.2.2 Reranking Model Training
118118

119119
Use the following command to launch a finetuning job for reranking model finetuning, such as `BAAI/bge-reranker-large`:
120120

@@ -133,7 +133,7 @@ curl http://${your_ip}:8015/v1/fine_tuning/jobs \
133133
}'
134134
```
135135

136-
### 3.2.3 Embedding Model Training
136+
#### 3.2.3 Embedding Model Training
137137

138138
Use the following command to launch a finetuning job for embedding model finetuning, such as `BAAI/bge-base-en-v1.5`:
139139

@@ -173,7 +173,7 @@ curl http://${your_ip}:8015/v1/fine_tuning/jobs \
173173

174174
```
175175

176-
### 3.2.4 LLM Pretraining
176+
#### 3.2.4 LLM Pretraining
177177

178178
Use the following command to launch a job for LLM pretraining, such as `meta-llama/Llama-2-7b-hf`:
179179

@@ -199,7 +199,7 @@ Below is an example for the format of the pretraining dataset:
199199
{"text": "A boy with a blue tank top sitting watching three dogs."}
200200
```
201201

202-
## 3.3 Manage fine-tuning job
202+
### 3.3 Manage fine-tuning job
203203

204204
Below commands show how to list finetuning jobs, retrieve a finetuning job, cancel a finetuning job and list checkpoints of a finetuning job.
205205

@@ -217,6 +217,10 @@ curl http://localhost:8015/v1/fine_tuning/jobs/cancel -X POST -H "Content-Type:
217217
curl http://${your_ip}:8015/v1/finetune/list_checkpoints -X POST -H "Content-Type: application/json" -d '{"fine_tuning_job_id": ${fine_tuning_job_id}}'
218218
```
219219

220+
### 3.4 Leverage fine-tuned model
221+
222+
After fine-tuning job is done, fine-tuned model can be chosen from listed checkpoints, then the fine-tuned model can be used in other microservices. For example, fine-tuned reranking model can be used in [reranks](../reranks/README.md) microservice by assign its path to the environment variable `RERANK_MODEL_ID`, fine-tuned embedding model can be used in [embeddings](../embeddings/README.md) microservice by assign its path to the environment variable `model`, LLMs after instruction tuning can be used in [llms](../llms/README.md) microservice by assign its path to the environment variable `your_hf_llm_model`.
223+
220224
## 🚀4. Descriptions for Finetuning parameters
221225

222226
We utilize [OpenAI finetuning parameters](https://platform.openai.com/docs/api-reference/fine-tuning) and extend it with more customizable parameters, see the definitions at [finetune_config](https://github.com/opea-project/GenAIComps/blob/main/comps/finetuning/finetune_config.py).

0 commit comments

Comments
 (0)