From edcc50fe97123f6bde434c359dd4066ee7d4a0ec Mon Sep 17 00:00:00 2001 From: XinyuYe-Intel Date: Sat, 14 Sep 2024 09:42:23 +0800 Subject: [PATCH] Added gaudi example for rerank model finetuning (#794) Signed-off-by: Ye, Xinyu --- InstructionTuning/README.md | 17 +++++----- .../docker_compose/intel/cpu/xeon/README.md | 2 +- .../docker_compose/intel/hpu/gaudi/README.md | 2 +- RerankFinetuning/README.md | 8 +++-- .../docker_compose/intel/hpu/gaudi/README.md | 31 +++++++++++++++++++ 5 files changed, 46 insertions(+), 14 deletions(-) create mode 100644 RerankFinetuning/docker_compose/intel/hpu/gaudi/README.md diff --git a/InstructionTuning/README.md b/InstructionTuning/README.md index a81ec2f98..cbc7db376 100644 --- a/InstructionTuning/README.md +++ b/InstructionTuning/README.md @@ -20,16 +20,16 @@ Download a training file `alpaca_data.json` and upload it to the server with bel ```bash # upload a training file -curl http://${your_ip}:8005/v1/finetune/upload_training_files -X POST -H "Content-Type: multipart/form-data" -F "files=@./alpaca_data.json" +curl http://${your_ip}:8015/v1/files -X POST -H "Content-Type: multipart/form-data" -F "file=@./alpaca_data.json" -F purpose="fine-tune" ``` ### 2. Create fine-tuning job -After a training file `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: +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: ```bash # create a finetuning job -curl http://${your_ip}:8005/v1/fine_tuning/jobs \ +curl http://${your_ip}:8015/v1/fine_tuning/jobs \ -X POST \ -H "Content-Type: application/json" \ -d '{ @@ -44,17 +44,14 @@ Below commands show how to list finetuning jobs, retrieve a finetuning job, canc ```bash # list finetuning jobs -curl http://${your_ip}:8005/v1/fine_tuning/jobs -X GET +curl http://${your_ip}:8015/v1/fine_tuning/jobs -X GET # retrieve one finetuning job -curl http://localhost:8005/v1/fine_tuning/jobs/retrieve -X POST -H "Content-Type: application/json" -d '{ - "fine_tuning_job_id": ${fine_tuning_job_id}}' +curl http://${your_ip}:8015/v1/fine_tuning/jobs/retrieve -X POST -H "Content-Type: application/json" -d '{"fine_tuning_job_id": ${fine_tuning_job_id}}' # cancel one finetuning job - -curl http://localhost:8005/v1/fine_tuning/jobs/cancel -X POST -H "Content-Type: application/json" -d '{ - "fine_tuning_job_id": ${fine_tuning_job_id}}' +curl http://${your_ip}:8015/v1/fine_tuning/jobs/cancel -X POST -H "Content-Type: application/json" -d '{"fine_tuning_job_id": ${fine_tuning_job_id}}' # list checkpoints of a finetuning job -curl http://${your_ip}:8005/v1/finetune/list_checkpoints -X POST -H "Content-Type: application/json" -d '{"fine_tuning_job_id": ${fine_tuning_job_id}}' +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}}' ``` diff --git a/InstructionTuning/docker_compose/intel/cpu/xeon/README.md b/InstructionTuning/docker_compose/intel/cpu/xeon/README.md index 48a1ff2cf..a2c31acbd 100644 --- a/InstructionTuning/docker_compose/intel/cpu/xeon/README.md +++ b/InstructionTuning/docker_compose/intel/cpu/xeon/README.md @@ -27,5 +27,5 @@ docker build -t opea/finetuning:latest --build-arg https_proxy=$https_proxy --bu Start docker container with below command: ```bash -docker run -d --name="finetuning-server" -p 8005:8005 --runtime=runc --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy opea/finetuning:latest +docker run -d --name="finetuning-server" -p 8015:8015 --runtime=runc --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy opea/finetuning:latest ``` diff --git a/InstructionTuning/docker_compose/intel/hpu/gaudi/README.md b/InstructionTuning/docker_compose/intel/hpu/gaudi/README.md index 302a54219..30c72cc4e 100644 --- a/InstructionTuning/docker_compose/intel/hpu/gaudi/README.md +++ b/InstructionTuning/docker_compose/intel/hpu/gaudi/README.md @@ -27,5 +27,5 @@ Start docker container with below command: ```bash export HF_TOKEN=${your_huggingface_token} -docker run --runtime=habana -e HABANA_VISIBLE_DEVICES=all -p 8005:8005 -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --net=host --ipc=host -e https_proxy=$https_proxy -e http_proxy=$http_proxy -e no_proxy=$no_proxy -e HF_TOKEN=$HF_TOKEN opea/finetuning-gaudi:latest +docker run --runtime=habana -e HABANA_VISIBLE_DEVICES=all -p 8015:8015 -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --net=host --ipc=host -e https_proxy=$https_proxy -e http_proxy=$http_proxy -e no_proxy=$no_proxy -e HF_TOKEN=$HF_TOKEN opea/finetuning-gaudi:latest ``` diff --git a/RerankFinetuning/README.md b/RerankFinetuning/README.md index 59b3d2136..4b0cd327c 100644 --- a/RerankFinetuning/README.md +++ b/RerankFinetuning/README.md @@ -8,6 +8,10 @@ Rerank model finetuning is the process of further training rerank model on a dat Refer to the [Xeon Guide](./docker_compose/intel/cpu/xeon/README.md) for detail. +### Deploy Rerank Model Finetuning Service on Gaudi + +Refer to the [Gaudi Guide](./docker_compose/intel/hpu/gaudi/README.md) for detail. + ## Consume Rerank Model Finetuning Service ### 1. Upload a training file @@ -47,10 +51,10 @@ Below commands show how to list finetuning jobs, retrieve a finetuning job, canc curl http://${your_ip}:8015/v1/fine_tuning/jobs -X GET # retrieve one finetuning job -curl http://localhost:8015/v1/fine_tuning/jobs/retrieve -X POST -H "Content-Type: application/json" -d '{"fine_tuning_job_id": ${fine_tuning_job_id}}' +curl http://${your_ip}:8015/v1/fine_tuning/jobs/retrieve -X POST -H "Content-Type: application/json" -d '{"fine_tuning_job_id": ${fine_tuning_job_id}}' # cancel one finetuning job -curl http://localhost:8015/v1/fine_tuning/jobs/cancel -X POST -H "Content-Type: application/json" -d '{"fine_tuning_job_id": ${fine_tuning_job_id}}' +curl http://${your_ip}:8015/v1/fine_tuning/jobs/cancel -X POST -H "Content-Type: application/json" -d '{"fine_tuning_job_id": ${fine_tuning_job_id}}' # list checkpoints of a finetuning job 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}}' diff --git a/RerankFinetuning/docker_compose/intel/hpu/gaudi/README.md b/RerankFinetuning/docker_compose/intel/hpu/gaudi/README.md new file mode 100644 index 000000000..07983cc58 --- /dev/null +++ b/RerankFinetuning/docker_compose/intel/hpu/gaudi/README.md @@ -0,0 +1,31 @@ +# Deploy Rerank Model Finetuning Service on Gaudi + +This document outlines the deployment process for a rerank model finetuning service utilizing the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice on Intel Xeon server. The steps include Docker image creation, container deployment. We will publish the Docker images to Docker Hub, it will simplify the deployment process for this service. + +## 🚀 Build Docker Images + +First of all, you need to build Docker Images locally. This step can be ignored after the Docker images published to Docker hub. + +### 1. Source Code install GenAIComps + +```bash +git clone https://github.com/opea-project/GenAIComps.git +cd GenAIComps +``` + +### 2. Build Docker Image + +Build docker image with below command: + +```bash +docker build -t opea/finetuning-gaudi:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/finetuning/Dockerfile.intel_hpu . +``` + +### 3. Run Docker with CLI + +Start docker container with below command: + +```bash +export HF_TOKEN=${your_huggingface_token} +docker run --runtime=habana -e HABANA_VISIBLE_DEVICES=all -p 8015:8015 -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --net=host --ipc=host -e https_proxy=$https_proxy -e http_proxy=$http_proxy -e no_proxy=$no_proxy -e HF_TOKEN=$HF_TOKEN opea/finetuning-gaudi:latest +```