From 27e60ee68adee93341d39f5698d704c59ff6c973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A7=84=ED=98=84?= Date: Wed, 4 Sep 2024 22:26:22 +0900 Subject: [PATCH] =?UTF-8?q?Chore:=20conda=EB=A1=9C=20=EC=9D=98=EC=A1=B4?= =?UTF-8?q?=EC=84=B1=20=EA=B4=80=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - READ.me 및 노션 문서에 세팅 방법 적어둠 - conda로 관리하는 것이 Cuda 설치 등 더 유연함 - gpu 서버 또한 conda로 가상 환경 설정 예정 --- ai/README.md | 23 +++++++++++++++-------- ai/environment.yml | 15 +++++++++++++++ ai/requirements.txt | 11 ++++++++--- 3 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 ai/environment.yml diff --git a/ai/README.md b/ai/README.md index c0cfba8..60fad15 100644 --- a/ai/README.md +++ b/ai/README.md @@ -1,15 +1,22 @@ # FastAPI를 이용한 AI 모델 관련 API -## app +## conda 환경 세팅 +```bash +conda env create -f environment.yml +conda activate worlabel_ai_env +``` -### api -- fastapi 호출 함수 정의 +## FastAPI Project 구조 -### schemas +### app/api +- api 호출 라우터 정의 + +### app/schemas - api의 request/response 등 Pydantic 모델 정의 -### services -- 필요한 ai 서비스들을 정의 +### app/services +- AI 관련 패키지를 이용하는 메서드 정의 + +### app/utils +- 프로젝트 전역에서 이용하는 formatter 등 정의 -### utils -- 프로젝트 전역에서 이용하는 formatter 등 정의 \ No newline at end of file diff --git a/ai/environment.yml b/ai/environment.yml new file mode 100644 index 0000000..ccd77ce --- /dev/null +++ b/ai/environment.yml @@ -0,0 +1,15 @@ +name: worlabel_ai_env +channels: + - conda-forge + - nvidia + - pytorch + - defaults +dependencies: + - python=3.10.10 + - pytorch + - torchvision + - torchaudio + - pytorch-cuda=12.1 + - fastapi + - uvicorn + - ultralytics \ No newline at end of file diff --git a/ai/requirements.txt b/ai/requirements.txt index 2216eb5..a2cb5ad 100644 --- a/ai/requirements.txt +++ b/ai/requirements.txt @@ -1,7 +1,12 @@ fastapi==0.104.1 uvicorn==0.30.6 -torch==2.4.0 -f https://download.pytorch.org/whl/cpu -torchaudio==2.4.0 -f https://download.pytorch.org/whl/cpu -torchvision==0.19.0 -f https://download.pytorch.org/whl/cpu ultralytics==8.2.82 ultralytics-thop==2.0.5 + +--extra-index-url https://download.pytorch.org/whl/cu121 +torch==2.4.0+cu121 +--extra-index-url https://download.pytorch.org/whl/cu121 +torchaudio==2.4.0+cu121 +--extra-index-url https://download.pytorch.org/whl/cu121 +torchvision==0.19.0+cu121 +