Skip to content

feat(ai): 개발에서는 YOLO 예열을 끄고 첫 요청에 올린다 - #38

Open
rjsgud49 wants to merge 1 commit into
mainfrom
cursor/ai-warmup-opt-in-77ad
Open

rjsgud49 wants to merge 1 commit into
mainfrom
cursor/ai-warmup-opt-in-77ad

Conversation

@rjsgud49

Copy link
Copy Markdown
Member

왜

로컬 npm run ai 가 기동하자마자 YOLO/PyTorch 가중치를 올려, Docker Desktop·WSL2·Cursor가 같이 떠 있는 8~16GB Windows PC가 멈췄습니다. /health 도 클래스 수를 세려고 모델을 읽었습니다.

무엇을 바꿨나

  • AI_WARMUP 이 없으면 개발은 예열하지 않고, 첫 추론 요청에서 가중치를 읽습니다.
  • NODE_ENV/ENV/ENVIRONMENT 가 production 이거나 AI_WARMUP=true 이면 예전처럼 기동 시 예열합니다. 운영 env 예시는 fishing/ai/production.env.example 입니다.
  • 개발에서만 torch.set_num_threads 를 기본 1로 제한합니다. TORCH_NUM_THREADS 로 바꿀 수 있고, 운영은 값을 지정하지 않으면 PyTorch 기본값을 유지합니다.
  • /health 는 가중치를 로드하지 않습니다. 예열 전에는 yoloClassCount 가 비어 있을 수 있습니다.

검증

  • npm test --prefix apps/api — 이 PR은 API를 바꾸지 않음
  • npm run build --prefix apps/api — 이 PR은 API를 바꾸지 않음
  • 웹을 바꿨다면 npm run build --prefix apps/web
  • AI를 바꿨다면 python3 -m unittest discover -s ai/tests -t ai (15 tests OK)

화면

해당 없음

Open in Web Open in Cursor 

AI_WARMUP이 없으면 개발은 가중치를 기동 때 올리지 않고, 운영(NODE_ENV=production)은 예전처럼 예열한다. 개발에서만 torch 스레드를 1로 제한한다.

Co-authored-by: park gun hyung <qkrrjsgud49@gmail.com>
@cursor
cursor Bot force-pushed the cursor/ai-warmup-opt-in-77ad branch from 67ad4ac to 494eace Compare October 22, 2026 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant