From 7d2cd6b4ff13efbb2fa658c843ab1426d591e994 Mon Sep 17 00:00:00 2001 From: lkk <33276950+lkk12014402@users.noreply.github.com> Date: Thu, 5 Sep 2024 08:20:40 +0800 Subject: [PATCH] update finetuning doc (#615) * revert code because of overwriting by other pr. * update finetuning doc. --------- Co-authored-by: root Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- comps/finetuning/README.md | 10 ++-- comps/finetuning/datasets/.gitkeep | 0 comps/finetuning/handlers.py | 5 -- comps/finetuning/jobs/.gitkeep | 0 comps/finetuning/lanuch.sh | 12 ---- comps/finetuning/llm_on_ray/common/logging.py | 56 ------------------- 6 files changed, 4 insertions(+), 79 deletions(-) delete mode 100644 comps/finetuning/datasets/.gitkeep delete mode 100644 comps/finetuning/jobs/.gitkeep delete mode 100644 comps/finetuning/lanuch.sh delete mode 100644 comps/finetuning/llm_on_ray/common/logging.py diff --git a/comps/finetuning/README.md b/comps/finetuning/README.md index 4232c82be..a88339e05 100644 --- a/comps/finetuning/README.md +++ b/comps/finetuning/README.md @@ -92,12 +92,10 @@ Assuming a training file `alpaca_data.json` is uploaded, it can be downloaded in ```bash # upload a training file - curl http://${your_ip}:8015/v1/files -X POST -H "Content-Type: multipart/form-data" -F "file=@./alpaca_data.json" -F purpose="fine-tune" # create a finetuning job curl http://${your_ip}:8015/v1/fine_tuning/jobs \ - -X POST \ -H "Content-Type: application/json" \ -d '{ @@ -106,17 +104,13 @@ curl http://${your_ip}:8015/v1/fine_tuning/jobs \ }' # list finetuning jobs - 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}}' # 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}}' @@ -125,3 +119,7 @@ curl http://${your_ip}:8015/v1/finetune/list_checkpoints -X POST -H "Content-Typ ``` + +# 🚀4. Descriptions for Finetuning parameters + +We utilize [OpenAI finetuning parameters](https://platform.openai.com/docs/api-reference/fine-tuning) and extend it with more customizable parameters. diff --git a/comps/finetuning/datasets/.gitkeep b/comps/finetuning/datasets/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/comps/finetuning/handlers.py b/comps/finetuning/handlers.py index f501f511b..b97231485 100644 --- a/comps/finetuning/handlers.py +++ b/comps/finetuning/handlers.py @@ -54,9 +54,7 @@ def update_job_status(job_id: FineTuningJobID): status = str(job_status).lower() # Ray status "stopped" is OpenAI status "cancelled" status = "cancelled" if status == "stopped" else status - logger.info(f"Status of job {job_id} is '{status}'") - running_finetuning_jobs[job_id].status = status if status == "finished" or status == "cancelled" or status == "failed": break @@ -102,7 +100,6 @@ def handle_create_finetuning_jobs(request: FineTuningParams, background_tasks: B ) finetune_config.General.output_dir = os.path.join(OUTPUT_DIR, job.id) if os.getenv("DEVICE", ""): - logger.info(f"specific device: {os.getenv('DEVICE')}") finetune_config.Training.device = os.getenv("DEVICE") @@ -176,9 +173,7 @@ async def save_content_to_local_disk(save_path: str, content): content = await content.read() fout.write(content) except Exception as e: - logger.info(f"Write file failed. Exception: {e}") - raise Exception(status_code=500, detail=f"Write file {save_path} failed. Exception: {e}") diff --git a/comps/finetuning/jobs/.gitkeep b/comps/finetuning/jobs/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/comps/finetuning/lanuch.sh b/comps/finetuning/lanuch.sh deleted file mode 100644 index a7e249b6f..000000000 --- a/comps/finetuning/lanuch.sh +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -if [[ -n "$RAY_PORT" ]];then - export RAY_ADDRESS=http://127.0.0.1:$RAY_PORT - ray start --head --port $RAY_PORT -else - export RAY_ADDRESS=http://127.0.0.1:8265 - ray start --head -fi - -python finetuning_service.py diff --git a/comps/finetuning/llm_on_ray/common/logging.py b/comps/finetuning/llm_on_ray/common/logging.py deleted file mode 100644 index e2aec567a..000000000 --- a/comps/finetuning/llm_on_ray/common/logging.py +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 -# -# Copyright 2023 The LLM-on-Ray Authors. - -import functools -import logging -import logging.config -import traceback - -__all__ = ["logger", "get_logger"] - -use_accelerate_log = False -logger_name = "common" - -logging_config = { - "version": 1, - "loggers": { - "root": {"level": "INFO", "handlers": ["consoleHandler"]}, - "common": { - "level": "INFO", - "handlers": ["consoleHandler"], - "qualname": "common", - "propagate": 0, - }, - }, - "handlers": { - "consoleHandler": { - "class": "logging.StreamHandler", - "level": "INFO", - "formatter": "standardFormatter", - }, - }, - "formatters": { - "standardFormatter": { - "format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s", - "datefmt": "", - } - }, -} - -if logging_config is not None: - try: - logging.config.dictConfig(logging_config) - except Exception: - traceback.print_exc() - exit(1) - -if use_accelerate_log: - import accelerate - - get_logger = functools.partial(accelerate.logging.get_logger, name=logger_name) -else: - get_logger = functools.partial(logging.getLogger, name=logger_name) - -logger = get_logger()