From 21b0b021771c8b1d799caee8e27dd0012b17692a Mon Sep 17 00:00:00 2001 From: Xinyu Ye Date: Mon, 19 Aug 2024 14:18:50 +0800 Subject: [PATCH] changed import relations. Signed-off-by: Xinyu Ye --- comps/finetuning/finetune_runner.py | 4 ++-- comps/finetuning/finetuning_service.py | 4 ++-- comps/finetuning/handlers.py | 7 ++----- comps/finetuning/llm_on_ray/finetune/finetune.py | 6 +++--- comps/finetuning/requirements.txt | 10 ++++++++++ 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/comps/finetuning/finetune_runner.py b/comps/finetuning/finetune_runner.py index 2fd00cb57..1ddfc4642 100644 --- a/comps/finetuning/finetune_runner.py +++ b/comps/finetuning/finetune_runner.py @@ -6,7 +6,7 @@ from pydantic_yaml import parse_yaml_raw_as from transformers import TrainerCallback, TrainerControl, TrainerState, TrainingArguments -from .llm_on_ray.finetune.finetune_config import FinetuneConfig +from comps.finetuning.llm_on_ray.finetune.finetune_config import FinetuneConfig class FineTuneCallback(TrainerCallback): @@ -29,7 +29,7 @@ def main(): callback = FineTuneCallback() finetune_config["Training"]["callbacks"] = [callback] - from .llm_on_ray.finetune.finetune import main as llm_on_ray_finetune_main + from comps.finetuning.llm_on_ray.finetune.finetune import main as llm_on_ray_finetune_main llm_on_ray_finetune_main(finetune_config) diff --git a/comps/finetuning/finetuning_service.py b/comps/finetuning/finetuning_service.py index c27ab724c..92fa42907 100644 --- a/comps/finetuning/finetuning_service.py +++ b/comps/finetuning/finetuning_service.py @@ -3,14 +3,14 @@ import uvicorn from fastapi import BackgroundTasks, FastAPI -from handlers import ( +from comps.finetuning.handlers import ( handle_cancel_finetuning_job, handle_create_finetuning_jobs, handle_list_finetuning_jobs, handle_retrieve_finetuning_job, ) -from .models import FineTuningJob, FineTuningJobList, FineTuningJobsRequest +from comps.finetuning.models import FineTuningJob, FineTuningJobList, FineTuningJobsRequest app = FastAPI() diff --git a/comps/finetuning/handlers.py b/comps/finetuning/handlers.py index a7e6951ca..0ae5c6c36 100644 --- a/comps/finetuning/handlers.py +++ b/comps/finetuning/handlers.py @@ -10,12 +10,9 @@ from fastapi import BackgroundTasks, HTTPException from pydantic_yaml import parse_yaml_raw_as, to_yaml_file from ray.job_submission import JobSubmissionClient -from ray.train.base_trainer import TrainingFailedError -from ray.tune.logger import LoggerCallback -from .llm_on_ray.finetune.finetune import main -from .llm_on_ray.finetune.finetune_config import FinetuneConfig -from .models import FineTuningJob, FineTuningJobEvent, FineTuningJobList, FineTuningJobsRequest +from comps.finetuning.llm_on_ray.finetune.finetune_config import FinetuneConfig +from comps.finetuning.models import FineTuningJob, FineTuningJobList, FineTuningJobsRequest MODEL_CONFIG_FILE_MAP = { "meta-llama/Llama-2-7b-chat-hf": "./models/llama-2-7b-chat-hf.yaml", diff --git a/comps/finetuning/llm_on_ray/finetune/finetune.py b/comps/finetuning/llm_on_ray/finetune/finetune.py index 263226f0f..57fe2e114 100644 --- a/comps/finetuning/llm_on_ray/finetune/finetune.py +++ b/comps/finetuning/llm_on_ray/finetune/finetune.py @@ -34,9 +34,9 @@ from ray.air.config import ScalingConfig from ray.train.torch import TorchTrainer -from ...llm_on_ray import common -from .data_process import DataProcessor -from .finetune_config import FinetuneConfig +from comps.finetuning.llm_on_ray import common +from comps.finetuning.llm_on_ray.finetune.data_process import DataProcessor +from comps.finetuning.llm_on_ray.finetune.finetune_config import FinetuneConfig def adapt_transformers_to_device(config: Dict): diff --git a/comps/finetuning/requirements.txt b/comps/finetuning/requirements.txt index 188cac773..c8f2f37d1 100644 --- a/comps/finetuning/requirements.txt +++ b/comps/finetuning/requirements.txt @@ -1,8 +1,18 @@ +aiohttp datasets +docarray fastapi +httpx +opentelemetry-api +opentelemetry-exporter-otlp +opentelemetry-sdk peft +prometheus-fastapi-instrumentator pydantic pydantic_yaml +pyyaml ray[all] +requests +shortuuid transformers uvicorn