From 1617ec95ec5836abbfe68ecb2df6e7ff7f1dda86 Mon Sep 17 00:00:00 2001 From: AGX Date: Sat, 30 Aug 2025 01:58:17 +0900 Subject: [PATCH] =?UTF-8?q?Discord=20=EC=9B=B9=ED=9B=85=20URL=EC=9D=84=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=ED=95=98=EA=B3=A0=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=ED=95=98=EB=8A=94=20API=20=EC=97=94=EB=93=9C=ED=8F=AC=EC=9D=B8?= =?UTF-8?q?=ED=8A=B8=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=98=EC=98=80?= =?UTF-8?q?=EC=8A=B5=EB=8B=88=EB=8B=A4.=20=EB=A7=88=EC=9D=B4=ED=81=AC?= =?UTF-8?q?=EB=A1=9C=20=EB=B0=B0=EC=B9=98=20=EC=B2=98=EB=A6=AC=EB=A5=BC=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C=20=EC=84=A4=EC=A0=95=EC=9D=84=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=ED=95=98=EA=B3=A0,=20=EC=9D=B8=ED=8E=98=EC=9D=B8?= =?UTF-8?q?=ED=8C=85=20=EB=B0=8F=20=EB=B0=B0=EA=B2=BD=20=EC=A0=9C=EA=B1=B0?= =?UTF-8?q?=20=EC=9E=91=EC=97=85=EC=97=90=EC=84=9C=20=EB=B0=B0=EC=B9=98=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=EB=A5=BC=20=EC=A7=80=EC=9B=90=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EB=A1=9C=EC=A7=81=EC=9D=84=20=EA=B0=9C?= =?UTF-8?q?=EC=84=A0=ED=95=98=EC=98=80=EC=8A=B5=EB=8B=88=EB=8B=A4.=20?= =?UTF-8?q?=EC=84=9C=EB=B2=84=20=EC=8B=9C=EC=9E=91=20=EB=B0=8F=20=EC=A2=85?= =?UTF-8?q?=EB=A3=8C=20=EC=8B=9C=20Discord=20=EC=95=8C=EB=A6=BC=EC=9D=84?= =?UTF-8?q?=20=EC=A0=84=EC=86=A1=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=ED=95=98=EC=98=80=EC=9C=BC=EB=A9=B0,=20=EB=AA=A8?= =?UTF-8?q?=EB=8D=B8=20=EC=B2=98=EB=A6=AC=20=EC=8B=9C=EA=B0=84=20=ED=86=B5?= =?UTF-8?q?=EA=B3=84=EB=A5=BC=20=EA=B8=B0=EB=A1=9D=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=EC=9D=84=20=EA=B0=9C=EC=84=A0=ED=95=98?= =?UTF-8?q?=EC=98=80=EC=8A=B5=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/endpoints.py | 89 +- app/core/batch_manager.py | 141 ++++ app/core/config.py | 21 + app/core/stats_manager.py | 27 +- app/core/worker_manager.py | 69 +- app/models/simple_lama.py | 163 ++-- app/utils/discord_notifier.py | 27 +- logs/main.log | 1475 +++++++++++++++++++++++++++++++++ logs/main_server.log | 192 +++-- logs/main_server.pid | 2 +- logs/monitoring.log | 4 +- logs/monitoring.pid | 2 +- main.py | 34 +- status.json | 54 +- web/index.html | 260 ++++++ web/index.html.bak | 0 16 files changed, 2329 insertions(+), 231 deletions(-) create mode 100644 app/core/batch_manager.py create mode 100644 web/index.html create mode 100644 web/index.html.bak diff --git a/app/api/endpoints.py b/app/api/endpoints.py index 6d3e3c2..f4eb9dc 100644 --- a/app/api/endpoints.py +++ b/app/api/endpoints.py @@ -6,7 +6,7 @@ import time import logging from datetime import datetime from typing import List -from fastapi import APIRouter, HTTPException, Response, Query +from fastapi import APIRouter, HTTPException, Response, Query, Request from fastapi.responses import JSONResponse, StreamingResponse import cv2 @@ -26,12 +26,43 @@ import base64 import io from ..monitoring.dashboard import monitoring_data from .stats import router as stats_router +from ..core.stats_manager import stats_manager +from ..core.batch_manager import batch_manager +from pathlib import Path logger = logging.getLogger(__name__) router = APIRouter() router.include_router(stats_router, prefix="/api/v1", tags=["Stats"]) +WEBHOOK_URL_FILE = Path(settings.PROJECT_ROOT) / "webhook_url.txt" + + +def get_webhook_url() -> str: + if WEBHOOK_URL_FILE.exists(): + return WEBHOOK_URL_FILE.read_text().strip() + return "" + +def save_webhook_url(url: str): + WEBHOOK_URL_FILE.write_text(url) + + +@router.get("/api/v1/webhook", summary="Get Discord Webhook URL") +async def get_webhook(): + """저장된 Discord 웹훅 URL을 조회합니다.""" + return {"url": get_webhook_url()} + +@router.post("/api/v1/webhook", summary="Set Discord Webhook URL") +async def set_webhook(request: Request): + """Discord 웹훅 URL을 저장합니다.""" + data = await request.json() + url = data.get("url", "") + save_webhook_url(url) + # Update settings in runtime if needed, or notifier can read from file directly + settings.DISCORD_WEBHOOK_URL = url + logger.info(f"Discord 웹훅 URL이 업데이트되었습니다: {url}") + return {"message": "Webhook URL이 성공적으로 저장되었습니다."} + def encode_image_to_format(image, format: ImageFormat = ImageFormat.png, quality: int = 95): """이미지를 지정된 형식으로 인코딩""" @@ -104,16 +135,17 @@ def create_response( @router.get("/api/v1/health", response_model=HealthResponse, name="health_check") -async def health_check(): +async def health_check(request: Request): """서버 상태 확인""" - start_time = getattr(settings, 'start_time', time.time()) - uptime = time.time() - start_time + start_time = getattr(request.app.state, 'start_time', time.time()) + current_time = time.time() + uptime_seconds = current_time - start_time return HealthResponse( - status="healthy", - timestamp=datetime.now().isoformat(), - version="1.0.0", - uptime=uptime + status="ok", + uptime=uptime_seconds, + timestamp=datetime.fromtimestamp(current_time).isoformat(), + version="1.0.0" ) @@ -199,17 +231,32 @@ async def inpaint_image( model_name = request.model_name or "simple-lama" # 워커에서 인페인팅 실행 - result = await worker_manager.process_inpaint( - image=image, - mask=mask, - model_name=model_name, - prompt=request.prompt, - negative_prompt=request.negative_prompt, - sd_seed=request.sd_seed, - num_inference_steps=request.num_inference_steps, - guidance_scale=request.guidance_scale, - strength=request.strength - ) + if settings.USE_MICRO_BATCHING and model_name == "simple-lama": + # SimpleLama는 배치 관리자를 통해 처리 + job_data = { + "image": image, + "mask": mask, + "prompt": request.prompt, + "negative_prompt": request.negative_prompt, + "sd_seed": request.sd_seed, + "num_inference_steps": request.num_inference_steps, + "guidance_scale": request.guidance_scale, + "strength": request.strength, + } + result = await batch_manager.add_job(job_data) + else: + # 다른 모델들은 기존 워커 매니저를 통해 단일 처리 + result = await worker_manager.process_inpaint( + image=image, + mask=mask, + model_name=model_name, + prompt=request.prompt, + negative_prompt=request.negative_prompt, + sd_seed=request.sd_seed, + num_inference_steps=request.num_inference_steps, + guidance_scale=request.guidance_scale, + strength=request.strength + ) if result is None: raise HTTPException(status_code=500, detail="인페인팅 처리 실패") @@ -286,7 +333,9 @@ async def remove_background( ) # 모델 선택 - model_name = request.model_name or "rembg" + model_name = request.model_name + if not model_name or model_name == "rembg": + model_name = "birefnet-general-lite" # 워커에서 배경 제거 실행 result_image, result_mask = await worker_manager.process_remove_bg( diff --git a/app/core/batch_manager.py b/app/core/batch_manager.py new file mode 100644 index 0000000..2ccc23a --- /dev/null +++ b/app/core/batch_manager.py @@ -0,0 +1,141 @@ +import asyncio +import time +from typing import List, Dict, Any, Tuple +from asyncio import Future, Queue, Task +import uuid +import logging + +from .config import settings +from .worker_manager import worker_manager +from .session_pool import ModelType + +logger = logging.getLogger(__name__) + +class BatchJob: + """배치 처리를 위한 개별 작업 단위""" + def __init__(self, job_id: str, job_data: Dict[str, Any]): + self.job_id = job_id + self.job_data = job_data + self.future = asyncio.get_running_loop().create_future() + +class BatchManager: + """ + 마이크로 배치를 관리하는 클래스. + - 요청을 큐에 수집합니다. + - 백그라운드 태스크를 통해 큐를 감시하며 배치를 생성합니다. + - 생성된 배치를 WorkerManager에 전달하여 처리합니다. + - 처리 결과를 각 요청에 전달합니다. + """ + def __init__(self): + self._queue: Queue[BatchJob] = Queue() + self._batch_creation_task: Task | None = None + self._active = False + + async def start(self): + """배치 관리자를 시작합니다.""" + if self._active: + logger.warning("BatchManager is already running.") + return + + logger.info("Starting BatchManager...") + self._active = True + self._batch_creation_task = asyncio.create_task(self._batch_creation_loop()) + logger.info("BatchManager started successfully.") + + async def stop(self): + """배치 관리자를 중지합니다.""" + if not self._active: + logger.warning("BatchManager is not running.") + return + + logger.info("Stopping BatchManager...") + self._active = False + if self._batch_creation_task: + self._batch_creation_task.cancel() + try: + await self._batch_creation_task + except asyncio.CancelledError: + pass # Task cancellation is expected + logger.info("BatchManager stopped.") + + async def add_job(self, job_data: Dict[str, Any]) -> Any: + """ + API 엔드포인트에서 호출하는 메서드. + 작업을 큐에 추가하고 결과가 나올 때까지 대기합니다. + """ + if not self._active: + raise RuntimeError("BatchManager is not running.") + + job_id = str(uuid.uuid4()) + job = BatchJob(job_id=job_id, job_data=job_data) + + await self._queue.put(job) + logger.debug(f"Job {job.job_id} added to the batch queue. Queue size: {self._queue.qsize()}") + + # 작업 결과를 기다립니다. + result = await job.future + return result + + async def _batch_creation_loop(self): + """ + 백그라운드에서 실행되며 큐를 감시하여 배치를 생성하는 루프. + """ + while self._active: + try: + # 첫 번째 작업을 기다립니다. 타임아웃이 발생하면 루프를 계속합니다. + first_job = await asyncio.wait_for(self._queue.get(), timeout=1.0) + except asyncio.TimeoutError: + continue + + batch = [first_job] + batch_size = settings.MICRO_BATCH_SIZE + timeout = settings.MICRO_BATCH_TIMEOUT_MS / 1000.0 # 초 단위로 변환 + + # 타임아웃까지 또는 배치가 꽉 찰 때까지 작업을 추가로 수집합니다. + start_time = time.monotonic() + while len(batch) < batch_size and (time.monotonic() - start_time) < timeout: + try: + # 남은 시간만큼만 대기합니다. + remaining_time = timeout - (time.monotonic() - start_time) + if remaining_time <= 0: + break + job = await asyncio.wait_for(self._queue.get(), timeout=remaining_time) + batch.append(job) + except asyncio.TimeoutError: + break # 대기 시간 초과 + + logger.info(f"Creating a new batch with {len(batch)} jobs.") + # 배치를 처리할 별도의 태스크를 생성하여 루프가 다른 배치를 만드는 것을 막지 않도록 합니다. + asyncio.create_task(self._process_batch(batch)) + + async def _process_batch(self, batch: List[BatchJob]): + """ + 생성된 배치를 WorkerManager에 전달하여 처리하고 결과를 전파합니다. + """ + batch_data = [job.job_data for job in batch] + + try: + # WorkerManager에 배치 처리를 요청합니다. + # worker_manager의 process_inpaint는 이제 배치 데이터를 처리할 수 있어야 합니다. + results = await worker_manager.process_inpaint_batch(batch_data) + + if len(results) != len(batch): + raise ValueError(f"Result count ({len(results)}) does not match batch size ({len(batch)}).") + + # 결과를 각 작업의 Future에 설정합니다. + for job, result in zip(batch, results): + if isinstance(result, Exception): + job.future.set_exception(result) + else: + job.future.set_result(result) + logger.info(f"Successfully processed batch of {len(batch)} jobs.") + + except Exception as e: + logger.error(f"Failed to process batch: {e}", exc_info=True) + # 모든 작업에 예외를 전파합니다. + for job in batch: + if not job.future.done(): + job.future.set_exception(e) + +# 전역 BatchManager 인스턴스 +batch_manager = BatchManager() diff --git a/app/core/config.py b/app/core/config.py index 15dbb60..881ba3f 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -5,6 +5,10 @@ import os import platform from typing import Dict, Any, Optional, ClassVar from pydantic_settings import BaseSettings +from pathlib import Path +import logging + +logger = logging.getLogger(__name__) class Settings(BaseSettings): @@ -30,6 +34,11 @@ class Settings(BaseSettings): # 유휴 세션 자동 제거 시간 (초). 0이면 비활성화. SESSION_IDLE_TIMEOUT: int = 1800 # 30분 + # --- 마이크로 배치 설정 --- + USE_MICRO_BATCHING: bool = True # SimpleLama에 대한 배치 처리 활성화 + MICRO_BATCH_SIZE: int = 4 # 최대 배치 크기 + MICRO_BATCH_TIMEOUT_MS: int = 100 # 배치 생성을 위한 최대 대기 시간 (밀리초) + # --- 서버 환경 설정 (클래스 내부로 이동) --- APP_VERSION: str = "3.0.0-dynamic-pool" APP_NAME: str = "Inpaint & RemoveBG Server" @@ -108,3 +117,15 @@ class Settings(BaseSettings): settings = Settings() + +# 파일에서 웹훅 URL 로드 (환경 변수보다 우선순위 낮음) +if not settings.DISCORD_WEBHOOK_URL: + try: + webhook_file = Path(settings.PROJECT_ROOT) / "webhook_url.txt" + if webhook_file.exists(): + url = webhook_file.read_text().strip() + if url: + settings.DISCORD_WEBHOOK_URL = url + logger.info(f"파일에서 Discord 웹훅 URL을 로드했습니다: {url[:30]}...") + except Exception as e: + logger.warning(f"webhook_url.txt 파일 로드 실패: {e}") diff --git a/app/core/stats_manager.py b/app/core/stats_manager.py index d362c42..b84a734 100644 --- a/app/core/stats_manager.py +++ b/app/core/stats_manager.py @@ -22,23 +22,24 @@ class StatsManager: 'max_time': 0.0, } - def record_time(self, model_name: str, duration: float): + def record_time(self, model_name: str, duration: float, count: int = 1): """처리 시간을 기록합니다.""" + if model_name not in self.model_keys: + # logger.warning(f"Unknown model for stats: {model_name}") # Assuming logger is defined elsewhere + return + with self.lock: - # 개별 모델 통계 업데이트 - if model_name in self.data: - stats = self.data[model_name] - stats['count'] += 1 - stats['total_time'] += duration - stats['min_time'] = min(stats['min_time'], duration) - stats['max_time'] = max(stats['max_time'], duration) + # 모델별 통계 업데이트 + self.data[model_name]['count'] += count + self.data[model_name]['total_time'] += duration * count # 전체 시간에 (평균시간 * 개수) 를 더함 + self.data[model_name]['min_time'] = min(self.data[model_name]['min_time'], duration) + self.data[model_name]['max_time'] = max(self.data[model_name]['max_time'], duration) # 전체 통계 업데이트 - total_stats = self.data['total'] - total_stats['count'] += 1 - total_stats['total_time'] += duration - total_stats['min_time'] = min(total_stats['min_time'], duration) - total_stats['max_time'] = max(total_stats['max_time'], duration) + self.data['total']['count'] += count + self.data['total']['total_time'] += duration * count + self.data['total']['min_time'] = min(self.data['total']['min_time'], duration) + self.data['total']['max_time'] = max(self.data['total']['max_time'], duration) def get_stats(self) -> dict: """현재까지의 통계를 계산하여 반환합니다.""" diff --git a/app/core/worker_manager.py b/app/core/worker_manager.py index 79b4f61..a2737ea 100644 --- a/app/core/worker_manager.py +++ b/app/core/worker_manager.py @@ -329,39 +329,62 @@ class WorkerManager: } async def process_inpaint(self, **kwargs) -> Optional[np.ndarray]: - """인페인팅 작업을 처리합니다.""" - try: + # 배치 처리를 사용하지 않는 모델 (예: Migan)을 위한 메서드 + model_name = kwargs.get('model_name', 'migan') + if model_name == 'migan': + model_type = ModelType.MIGAN + stats_model_key = 'migan' + else: + # SimpleLama는 이제 배치 처리를 통해서만 호출되어야 함 + logger.error(f"Unsupported model for single inpaint: {model_name}. Use process_inpaint_batch for simple-lama.") + raise ValueError(f"Unsupported model for single inpaint: {model_name}") + + async def _inpaint(): from ..core.session_pool import session_pool, ModelType - - model_name = kwargs.get('model_name', 'simple-lama') - - # 모델명에 따라 세션 타입 및 통계 키 결정 - if model_name == 'migan': - model_type = ModelType.MIGAN - stats_model_key = 'migan' - else: - # 기본값은 simple_lama - model_type = ModelType.SIMPLE_LAMA - stats_model_key = 'simple_lama' - - # 세션 풀에서 모델 세션 가져와서 처리 async with session_pool.get_session(model_type) as session: start_time = time.time() - # session.model 에서 실제 모델 객체의 메서드를 호출해야 함 + # Migan은 단일 이미지만 처리하므로 기존 로직 유지 result = await session.model.inpaint( - image=kwargs['image'], - mask=kwargs['mask'] + image=kwargs["image"], + mask=kwargs["mask"], ) duration = time.time() - start_time stats_manager.record_time(stats_model_key, duration) logger.info(f"'{model_name}' inpainting processed in {duration:.3f}s") + return result + + # _execute_task 대신 직접 실행 + return await _inpaint() + + async def process_inpaint_batch(self, batch_data: List[Dict[str, Any]]) -> List[np.ndarray]: + """SimpleLama 배치 인페인팅 작업을 처리합니다.""" + if not batch_data: + return [] + + # 태스크를 직접 실행하도록 수정 + from ..core.session_pool import session_pool, ModelType + model_type = ModelType.SIMPLE_LAMA + stats_model_key = 'simple_lama' + batch_size = len(batch_data) + + async with session_pool.get_session(model_type) as session: + start_time = time.time() - return result + images = [item['image'] for item in batch_data] + masks = [item['mask'] for item in batch_data] - except Exception as e: - logger.error(f"인페인팅 처리 실패: {e}", exc_info=True) - return None - + # 수정된 inpaint 메서드 호출 + results = await session.model.inpaint( + images=images, + masks=masks, + ) + + duration = time.time() - start_time + # 통계 기록: 배치 전체 처리 시간 / 배치 크기 + stats_manager.record_time(stats_model_key, duration / batch_size, count=batch_size) + logger.info(f"'simple-lama' batch of {batch_size} processed in {duration:.3f}s (avg: {duration/batch_size:.3f}s/image)") + return results + async def process_remove_bg(self, **kwargs) -> Optional[Tuple[np.ndarray, np.ndarray]]: """배경 제거 작업을 처리합니다.""" try: diff --git a/app/models/simple_lama.py b/app/models/simple_lama.py index 1eee3c0..0a2f25c 100644 --- a/app/models/simple_lama.py +++ b/app/models/simple_lama.py @@ -6,19 +6,27 @@ import numpy as np import cv2 from PIL import Image import logging -from typing import Union, Tuple +from typing import Union, Tuple, List import asyncio from concurrent.futures import ThreadPoolExecutor +from simple_lama_inpainting import SimpleLama +# 사용하지 않는 import 정리 +# from ..utils.image_utils import ( +# decode_base64_to_image, +# encode_image_to_base64, +# get_image_size, +# resize_image_if_needed, +# ) logger = logging.getLogger(__name__) class SimpleLamaInpainter: - def __init__(self, model_path: str = None, device: str = "cuda", fp16: bool = True): + def __init__(self, model_path: str, device: str = "cpu", fp16: bool = False): self.model_path = model_path - self.device = device - self.fp16 = fp16 - self.model = None + self._device = torch.device(device) + self._fp16 = fp16 + self._model = None self.loaded = False async def load_model(self): @@ -31,18 +39,17 @@ class SimpleLamaInpainter: # 실제 simple-lama-inpainting 라이브러리 사용 try: - from simple_lama_inpainting import SimpleLama - self.model = SimpleLama(device=self.device) + self._model = SimpleLama(device=self._device) logger.info("실제 SimpleLama 모델 로딩 완료") except ImportError as e: logger.warning(f"SimpleLama 라이브러리 import 실패: {e}") logger.info("fallback 모드로 전환합니다...") # fallback으로 시뮬레이션 모드 사용 - self.model = {"type": "simple_lama_fallback", "device": self.device, "fp16": self.fp16} + self._model = {"type": "simple_lama_fallback", "device": self._device, "fp16": self._fp16} except Exception as e: logger.error(f"SimpleLama 모델 초기화 실패: {e}") logger.info("fallback 모드로 전환합니다...") - self.model = {"type": "simple_lama_fallback", "device": self.device, "fp16": self.fp16} + self._model = {"type": "simple_lama_fallback", "device": self._device, "fp16": self._fp16} self.loaded = True logger.info("Simple LAMA model loaded successfully") @@ -68,10 +75,10 @@ class SimpleLamaInpainter: # 텐서로 변환 (B, C, H, W) tensor = torch.from_numpy(image).permute(2, 0, 1).unsqueeze(0) - if self.fp16: + if self._fp16: tensor = tensor.half() - return tensor.to(self.device) + return tensor.to(self._device) def preprocess_mask(self, mask: Union[Image.Image, np.ndarray]) -> torch.Tensor: """마스크를 전처리합니다.""" @@ -88,10 +95,10 @@ class SimpleLamaInpainter: # 텐서로 변환 (B, 1, H, W) tensor = torch.from_numpy(mask).unsqueeze(0).unsqueeze(0) - if self.fp16: + if self._fp16: tensor = tensor.half() - return tensor.to(self.device) + return tensor.to(self._device) def postprocess_result(self, tensor: torch.Tensor) -> np.ndarray: """결과를 후처리합니다.""" @@ -108,73 +115,89 @@ class SimpleLamaInpainter: return result - async def inpaint(self, image: Union[Image.Image, np.ndarray], - mask: Union[Image.Image, np.ndarray]) -> np.ndarray: - """인페인팅을 수행합니다.""" + async def inpaint( + self, + images: List[np.ndarray], + masks: List[np.ndarray], + **kwargs, + ) -> List[np.ndarray]: if not self.loaded: await self.load_model() - try: - # 전처리 - image_tensor = self.preprocess_image(image) - mask_tensor = self.preprocess_mask(mask) - - # 실제 모델 추론 - with torch.no_grad(): - if hasattr(self.model, '__call__') and not isinstance(self.model, dict): - # 실제 SimpleLama 모델 사용 - logger.info("실제 SimpleLama 모델로 인페인팅 수행") - - # SimpleLama는 PIL Image를 받으므로 변환 - if isinstance(image, np.ndarray): - pil_image = Image.fromarray(image) - else: - pil_image = image - - if isinstance(mask, np.ndarray): - pil_mask = Image.fromarray(mask) - else: - pil_mask = mask - - # 실제 추론 수행 - result_pil = self.model(pil_image, pil_mask) - result_np = np.array(result_pil) - - return result_np - else: - # Fallback: 시뮬레이션 모드 - logger.warning("Fallback 모드: 시뮬레이션 인페인팅 사용") - result = await self._simulate_inpainting(image_tensor, mask_tensor) - result_np = self.postprocess_result(result) - return result_np - - except Exception as e: - logger.error(f"Inpainting failed: {e}") - raise - - async def _simulate_inpainting(self, image_tensor: torch.Tensor, - mask_tensor: torch.Tensor) -> torch.Tensor: - """인페인팅 시뮬레이션 (실제 구현에서는 제거)""" - # 비동기 처리 시뮬레이션 - await asyncio.sleep(0.1) + if not self.is_ready: + raise RuntimeError("SimpleLama model is not loaded yet.") + + # 모델이 GPU에 있는지 확인 + if self._device.type != 'cpu': + torch.cuda.empty_cache() + + # 전처리 + pil_images = [Image.fromarray(img) for img in images] + pil_masks = [Image.fromarray(mask) for mask in masks] - # 마스크 영역을 이미지의 평균 색상으로 채우기 - result = image_tensor.clone() - mask_bool = mask_tensor.bool() + preprocessed_images = [] + preprocessed_masks = [] + for img, mask in zip(pil_images, pil_masks): + img_tensor, mask_tensor = self._preprocess(img, mask) + preprocessed_images.append(img_tensor) + preprocessed_masks.append(mask_tensor) + + image_batch = torch.stack(preprocessed_images).to(self._device) + mask_batch = torch.stack(preprocessed_masks).to(self._device) + + # 모델 호출 + logger.info(f"실제 SimpleLama 모델로 {len(images)}개 이미지 인페인팅 수행") + with torch.no_grad(): + # 라이브러리의 __call__ 대신 내부 torch 모델을 직접 호출 + inpainted_batch = self._model.model(image_batch, mask_batch) + + # 후처리 + result_images = [] + for inpainted_tensor in inpainted_batch: + result_pil = self._postprocess(inpainted_tensor) + result_images.append(np.array(result_pil)) + + return result_images + + def _preprocess(self, image: Image.Image, mask: Image.Image): + """단일 이미지를 모델 입력 텐서로 전처리합니다.""" + # simple_lama_inpainting.models.lama.py의 전처리 로직 참고 + image = image.convert("RGB") + mask = mask.convert("L") - # 각 채널별 평균 계산 - for c in range(3): - channel_mean = image_tensor[0, c][~mask_bool[0, 0]].mean() - result[0, c][mask_bool[0, 0]] = channel_mean - - return result + # 원본 크기 저장 + original_size = image.size + + # 이미지 리사이즈 (모델 요구사항에 맞게) + resized_image = image.resize((512, 512), Image.Resampling.LANCZOS) + resized_mask = mask.resize((512, 512), Image.Resampling.NEAREST) + + image_tensor = torch.from_numpy(np.array(resized_image, dtype=np.float32) / 255.0).permute(2, 0, 1).unsqueeze(0).squeeze(0) + mask_tensor = torch.from_numpy(np.array(resized_mask, dtype=np.float32) / 255.0).unsqueeze(0).unsqueeze(0).squeeze(0) + + return image_tensor, mask_tensor + + def _postprocess(self, tensor: torch.Tensor) -> Image.Image: + """모델 출력 텐서를 PIL 이미지로 후처리합니다.""" + # simple_lama_inpainting.models.lama.py의 후처리 로직 참고 + result_np = tensor.permute(1, 2, 0).cpu().numpy() + result_np = np.clip(result_np * 255, 0, 255).astype(np.uint8) + + # 원본 크기로 복원 (여기서는 512x512 결과를 그대로 사용) + # 필요하다면 원본 크기 정보를 받아 리사이즈하는 로직 추가 + return Image.fromarray(result_np) + + + @property + def is_ready(self) -> bool: + return self._model is not None def get_model_info(self) -> dict: """모델 정보를 반환합니다.""" return { "model_type": "simple_lama", - "device": self.device, - "fp16": self.fp16, + "device": self._device, + "fp16": self._fp16, "loaded": self.loaded, "model_path": self.model_path } diff --git a/app/utils/discord_notifier.py b/app/utils/discord_notifier.py index 8da4b3c..9810742 100644 --- a/app/utils/discord_notifier.py +++ b/app/utils/discord_notifier.py @@ -5,18 +5,35 @@ import logging import requests import socket from datetime import datetime +from pathlib import Path from ..core.config import settings logger = logging.getLogger(__name__) +WEBHOOK_URL_FILE = Path(settings.PROJECT_ROOT) / "webhook_url.txt" + +def get_webhook_url() -> str: + """환경 변수 또는 파일에서 웹훅 URL을 가져옵니다.""" + # 1. 환경 변수 확인 + if settings.DISCORD_WEBHOOK_URL: + return settings.DISCORD_WEBHOOK_URL + + # 2. 파일 확인 + if WEBHOOK_URL_FILE.exists(): + return WEBHOOK_URL_FILE.read_text().strip() + + return "" + + def send_discord_notification(message: str, level: str = "info"): - """ - Discord 웹훅으로 알림을 보냅니다. - """ - webhook_url = settings.DISCORD_WEBHOOK_URL + """Discord 웹훅으로 알림을 보냅니다.""" + + webhook_url = get_webhook_url() + if not webhook_url: - logger.warning("Discord 웹훅 URL이 설정되지 않아 알림을 보낼 수 없습니다.") + if "시작" in message or "종료" in message: + logger.warning("Discord 웹훅 URL이 설정되지 않아 알림을 보낼 수 없습니다.") return hostname = socket.gethostname() diff --git a/logs/main.log b/logs/main.log index e999f1e..570f13b 100644 --- a/logs/main.log +++ b/logs/main.log @@ -5430,3 +5430,1478 @@ RuntimeError: Padding size should be less than the corresponding input dimension 2025-08-29 23:47:15,235 - app.core.session_pool - INFO - Idle session reaper started. Timeout: 1800s, Check Interval: 60s 2025-08-29 23:47:15,235 - uvicorn.error - INFO - Application startup complete. 2025-08-29 23:47:15,236 - uvicorn.error - INFO - Uvicorn running on http://0.0.0.0:8008 (Press CTRL+C to quit) +2025-08-30 00:23:19,530 - uvicorn.error - INFO - Shutting down +2025-08-30 00:23:19,632 - uvicorn.error - INFO - Waiting for application shutdown. +2025-08-30 00:23:19,634 - main - INFO - 🛑 인페인팅 서버 종료 중... +2025-08-30 00:23:19,634 - app.core.worker_manager - INFO - Stopping worker manager... +2025-08-30 00:23:19,635 - app.core.worker_manager - INFO - Worker manager stopped +2025-08-30 00:23:19,635 - main - INFO - ✅ 워커 매니저 중지 완료 +2025-08-30 00:23:19,636 - main - INFO - 👋 인페인팅 서버 종료 완료 +2025-08-30 00:23:19,637 - uvicorn.error - INFO - Application shutdown complete. +2025-08-30 00:23:19,637 - uvicorn.error - INFO - Finished server process [56165] +2025-08-30 00:56:31,018 - uvicorn.error - INFO - Started server process [65709] +2025-08-30 00:56:31,018 - uvicorn.error - INFO - Waiting for application startup. +2025-08-30 00:56:31,021 - main - INFO - 🚀 인페인팅 서버 시작 중... +2025-08-30 00:56:31,026 - uvicorn.error - ERROR - Traceback (most recent call last): + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 705, in lifespan + async with self.lifespan_context(app) as maybe_state: + File "/usr/lib/python3.8/contextlib.py", line 171, in __aenter__ + return await self.gen.__anext__() + File "/home/ckh08045/work/inpaintServer/./main.py", line 211, in lifespan + settings.start_time = time.time() + File "/home/ckh08045/.local/lib/python3.8/site-packages/pydantic/main.py", line 925, in __setattr__ + raise ValueError(f'"{self.__class__.__name__}" object has no field "{name}"') +ValueError: "Settings" object has no field "start_time" + +2025-08-30 00:56:31,027 - uvicorn.error - ERROR - Application startup failed. Exiting. +2025-08-30 00:59:17,812 - uvicorn.error - INFO - Started server process [66225] +2025-08-30 00:59:17,813 - uvicorn.error - INFO - Waiting for application startup. +2025-08-30 00:59:17,816 - main - INFO - 🚀 인페인팅 서버 시작 중... +2025-08-30 00:59:17,817 - main - INFO - ✅ 공유 객체를 app.state에 저장 완료 +2025-08-30 00:59:17,817 - main - INFO - 🔄 상태 저장 백그라운드 작업 생성 중... +2025-08-30 00:59:17,818 - main - INFO - ✅ 상태 저장 백그라운드 작업 생성 완료 +2025-08-30 00:59:17,818 - main - INFO - 🚀 세션 풀 초기화 (CUDA 자동 감지) +2025-08-30 00:59:17,818 - app.core.session_pool - INFO - Initializing dynamic session pools... +2025-08-30 00:59:17,819 - app.core.session_pool - INFO - Pre-loading 2 sessions for simple_lama +2025-08-30 00:59:17,819 - main - INFO - 🔄 상태 저장 백그라운드 작업 시작됨 +2025-08-30 00:59:17,821 - app.core.session_pool - INFO - Creating new session simple_lama_0 for simple_lama... +2025-08-30 00:59:21,077 - app.core.session_pool - ERROR - Failed to create session simple_lama_0: cannot import name 'get_image_size' from 'app.utils.image_utils' (/home/ckh08045/work/inpaintServer/./app/utils/image_utils.py) +Traceback (most recent call last): + File "/home/ckh08045/work/inpaintServer/./app/core/session_pool.py", line 123, in _create_session + model = await self._load_model(model_type) + File "/home/ckh08045/work/inpaintServer/./app/core/session_pool.py", line 140, in _load_model + return await self._load_simple_lama_model() + File "/home/ckh08045/work/inpaintServer/./app/core/session_pool.py", line 150, in _load_simple_lama_model + from ..models.simple_lama import SimpleLamaInpainter + File "/home/ckh08045/work/inpaintServer/./app/models/simple_lama.py", line 13, in + from ..utils.image_utils import ( +ImportError: cannot import name 'get_image_size' from 'app.utils.image_utils' (/home/ckh08045/work/inpaintServer/./app/utils/image_utils.py) +2025-08-30 00:59:21,080 - app.core.session_pool - INFO - Creating new session simple_lama_1 for simple_lama... +2025-08-30 00:59:21,081 - app.core.session_pool - ERROR - Failed to create session simple_lama_1: cannot import name 'get_image_size' from 'app.utils.image_utils' (/home/ckh08045/work/inpaintServer/./app/utils/image_utils.py) +Traceback (most recent call last): + File "/home/ckh08045/work/inpaintServer/./app/core/session_pool.py", line 123, in _create_session + model = await self._load_model(model_type) + File "/home/ckh08045/work/inpaintServer/./app/core/session_pool.py", line 140, in _load_model + return await self._load_simple_lama_model() + File "/home/ckh08045/work/inpaintServer/./app/core/session_pool.py", line 150, in _load_simple_lama_model + from ..models.simple_lama import SimpleLamaInpainter + File "/home/ckh08045/work/inpaintServer/./app/models/simple_lama.py", line 13, in + from ..utils.image_utils import ( +ImportError: cannot import name 'get_image_size' from 'app.utils.image_utils' (/home/ckh08045/work/inpaintServer/./app/utils/image_utils.py) +2025-08-30 00:59:21,083 - app.core.session_pool - ERROR - Failed to create initial session simple_lama_0: cannot import name 'get_image_size' from 'app.utils.image_utils' (/home/ckh08045/work/inpaintServer/./app/utils/image_utils.py) +2025-08-30 00:59:21,084 - app.core.session_pool - ERROR - Failed to create initial session simple_lama_1: cannot import name 'get_image_size' from 'app.utils.image_utils' (/home/ckh08045/work/inpaintServer/./app/utils/image_utils.py) +2025-08-30 00:59:21,084 - app.core.session_pool - INFO - Pre-loading 2 sessions for migan +2025-08-30 00:59:21,087 - app.core.session_pool - INFO - Creating new session migan_0 for migan... +2025-08-30 00:59:21,165 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 00:59:21,166 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 00:59:21,167 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 00:59:27,170 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 00:59:27,171 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 00:59:27,172 - app.core.session_pool - INFO - Successfully created session migan_0 +2025-08-30 00:59:27,172 - app.core.session_pool - INFO - Creating new session migan_1 for migan... +2025-08-30 00:59:27,173 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 00:59:27,173 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 00:59:27,173 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 00:59:28,453 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 00:59:28,454 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 00:59:28,454 - app.core.session_pool - INFO - Successfully created session migan_1 +2025-08-30 00:59:28,455 - app.core.session_pool - INFO - Pre-loading 2 sessions for rembg +2025-08-30 00:59:28,457 - app.core.session_pool - INFO - Creating new session rembg_0 for rembg... +2025-08-30 00:59:28,457 - app.core.session_pool - INFO - Creating new session rembg_1 for rembg... +2025-08-30 00:59:28,459 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 00:59:30,280 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 00:59:30,281 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 00:59:30,282 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 00:59:30,282 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 00:59:43,508 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 00:59:43,509 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 00:59:43,509 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 00:59:43,509 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 00:59:43,510 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 00:59:43,510 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 00:59:43,511 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 00:59:56,449 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 00:59:56,450 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 00:59:56,451 - app.core.session_pool - INFO - Successfully created session rembg_0 +2025-08-30 00:59:56,451 - app.core.session_pool - INFO - Successfully created session rembg_1 +2025-08-30 00:59:56,453 - app.core.session_pool - INFO - Session pools initialized successfully +2025-08-30 00:59:56,454 - main - INFO - ✅ 세션 풀 초기화 완료 +2025-08-30 00:59:56,454 - app.core.worker_manager - INFO - Starting worker manager... +2025-08-30 00:59:56,455 - app.core.worker_manager - INFO - Worker manager started with 10 workers +2025-08-30 00:59:56,455 - main - INFO - ✅ 워커 매니저 시작 완료 +2025-08-30 00:59:56,455 - app.core.batch_manager - INFO - Starting BatchManager... +2025-08-30 00:59:56,456 - app.core.batch_manager - INFO - BatchManager started successfully. +2025-08-30 00:59:56,456 - main - INFO - ✅ 배치 관리자 시작 완료 +2025-08-30 00:59:56,456 - main - INFO - 🎉 인페인팅 서버 시작 완료! +2025-08-30 00:59:56,457 - app.utils.discord_notifier - WARNING - Discord 웹훅 URL이 설정되지 않아 알림을 보낼 수 없습니다. +2025-08-30 00:59:56,457 - app.core.session_pool - INFO - Idle session reaper started. Timeout: 1800s, Check Interval: 60s +2025-08-30 00:59:56,458 - uvicorn.error - INFO - Application startup complete. +2025-08-30 00:59:56,459 - uvicorn.error - INFO - Uvicorn running on http://0.0.0.0:8008 (Press CTRL+C to quit) +2025-08-30 00:59:56,462 - uvicorn.error - ERROR - Traceback (most recent call last): + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 714, in lifespan + await receive() + File "/home/ckh08045/.local/lib/python3.8/site-packages/uvicorn/lifespan/on.py", line 135, in receive + return await self.receive_queue.get() + File "/usr/lib/python3.8/asyncio/queues.py", line 163, in get + await getter +asyncio.exceptions.CancelledError + +2025-08-30 01:00:56,650 - uvicorn.error - INFO - Started server process [66666] +2025-08-30 01:00:56,651 - uvicorn.error - INFO - Waiting for application startup. +2025-08-30 01:00:56,654 - main - INFO - 🚀 인페인팅 서버 시작 중... +2025-08-30 01:00:56,655 - main - INFO - ✅ 공유 객체를 app.state에 저장 완료 +2025-08-30 01:00:56,655 - main - INFO - 🔄 상태 저장 백그라운드 작업 생성 중... +2025-08-30 01:00:56,655 - main - INFO - ✅ 상태 저장 백그라운드 작업 생성 완료 +2025-08-30 01:00:56,656 - main - INFO - 🚀 세션 풀 초기화 (CUDA 자동 감지) +2025-08-30 01:00:56,656 - app.core.session_pool - INFO - Initializing dynamic session pools... +2025-08-30 01:00:56,656 - app.core.session_pool - INFO - Pre-loading 2 sessions for simple_lama +2025-08-30 01:00:56,657 - main - INFO - 🔄 상태 저장 백그라운드 작업 시작됨 +2025-08-30 01:00:56,658 - app.core.session_pool - INFO - Creating new session simple_lama_0 for simple_lama... +2025-08-30 01:00:59,900 - app.models.simple_lama - INFO - Loading Simple LAMA model... +2025-08-30 01:01:04,244 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 +2025-08-30 01:01:04,246 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully +2025-08-30 01:01:04,246 - app.core.session_pool - INFO - Successfully created session simple_lama_0 +2025-08-30 01:01:04,247 - app.core.session_pool - INFO - Creating new session simple_lama_1 for simple_lama... +2025-08-30 01:01:04,248 - app.models.simple_lama - INFO - Loading Simple LAMA model... +2025-08-30 01:01:06,025 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 +2025-08-30 01:01:06,026 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully +2025-08-30 01:01:06,026 - app.core.session_pool - INFO - Successfully created session simple_lama_1 +2025-08-30 01:01:06,027 - app.core.session_pool - INFO - Pre-loading 2 sessions for migan +2025-08-30 01:01:06,028 - app.core.session_pool - INFO - Creating new session migan_0 for migan... +2025-08-30 01:01:06,091 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 01:01:06,091 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 01:01:06,092 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:01:08,887 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:01:08,888 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 01:01:08,888 - app.core.session_pool - INFO - Successfully created session migan_0 +2025-08-30 01:01:08,889 - app.core.session_pool - INFO - Creating new session migan_1 for migan... +2025-08-30 01:01:08,889 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 01:01:08,889 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 01:01:08,890 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:01:10,146 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:01:10,147 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 01:01:10,147 - app.core.session_pool - INFO - Successfully created session migan_1 +2025-08-30 01:01:10,148 - app.core.session_pool - INFO - Pre-loading 2 sessions for rembg +2025-08-30 01:01:10,150 - app.core.session_pool - INFO - Creating new session rembg_0 for rembg... +2025-08-30 01:01:10,150 - app.core.session_pool - INFO - Creating new session rembg_1 for rembg... +2025-08-30 01:01:10,152 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 01:01:12,128 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 01:01:12,129 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 01:01:12,129 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 01:01:12,130 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:01:25,211 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 01:01:25,212 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 01:01:25,212 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 01:01:25,213 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 01:01:25,213 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 01:01:25,214 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 01:01:25,215 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:01:37,757 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 01:01:37,758 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 01:01:37,759 - app.core.session_pool - INFO - Successfully created session rembg_0 +2025-08-30 01:01:37,759 - app.core.session_pool - INFO - Successfully created session rembg_1 +2025-08-30 01:01:37,761 - app.core.session_pool - INFO - Session pools initialized successfully +2025-08-30 01:01:37,761 - main - INFO - ✅ 세션 풀 초기화 완료 +2025-08-30 01:01:37,762 - app.core.worker_manager - INFO - Starting worker manager... +2025-08-30 01:01:37,762 - app.core.worker_manager - INFO - Worker manager started with 10 workers +2025-08-30 01:01:37,763 - main - INFO - ✅ 워커 매니저 시작 완료 +2025-08-30 01:01:37,763 - app.core.batch_manager - INFO - Starting BatchManager... +2025-08-30 01:01:37,764 - app.core.batch_manager - INFO - BatchManager started successfully. +2025-08-30 01:01:37,764 - main - INFO - ✅ 배치 관리자 시작 완료 +2025-08-30 01:01:37,764 - main - INFO - 🎉 인페인팅 서버 시작 완료! +2025-08-30 01:01:37,764 - app.utils.discord_notifier - WARNING - Discord 웹훅 URL이 설정되지 않아 알림을 보낼 수 없습니다. +2025-08-30 01:01:37,765 - app.core.session_pool - INFO - Idle session reaper started. Timeout: 1800s, Check Interval: 60s +2025-08-30 01:01:37,765 - uvicorn.error - INFO - Application startup complete. +2025-08-30 01:01:37,766 - uvicorn.error - INFO - Uvicorn running on http://0.0.0.0:8008 (Press CTRL+C to quit) +2025-08-30 01:01:39,919 - uvicorn.error - ERROR - Exception in ASGI application + + Exception Group Traceback (most recent call last): + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_utils.py", line 82, in collapse_excgroups + | yield + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 193, in __call__ + | response_sent.set() + | File "/home/ckh08045/.local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 685, in __aexit__ + | raise BaseExceptionGroup( + | exceptiongroup.ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) + +-+---------------- 1 ---------------- + | Traceback (most recent call last): + | File "/home/ckh08045/.local/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi + | result = await app(self.scope, self.receive, self.send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__ + | return await self.app(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/applications.py", line 1054, in __call__ + | await super().__call__(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/applications.py", line 116, in __call__ + | await self.middleware_stack(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 186, in __call__ + | raise exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 164, in __call__ + | await self.app(scope, receive, _send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/cors.py", line 83, in __call__ + | await self.app(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 193, in __call__ + | response_sent.set() + | File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__ + | self.gen.throw(type, value, traceback) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_utils.py", line 88, in collapse_excgroups + | raise exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 191, in __call__ + | response = await self.dispatch_func(request, call_next) + | File "/home/ckh08045/work/inpaintServer/./main.py", line 298, in collect_api_stats + | response = await call_next(request) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 165, in call_next + | raise app_exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 151, in coro + | await self.app(scope, receive_or_disconnect, send_no_error) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 62, in __call__ + | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app + | raise exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app + | await app(scope, receive, sender) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 746, in __call__ + | await route.handle(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 288, in handle + | await self.app(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 75, in app + | await wrap_app_handling_exceptions(app, request)(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app + | raise exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app + | await app(scope, receive, sender) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 70, in app + | response = await func(request) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 299, in app + | raise e + | File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 294, in app + | raw_response = await run_endpoint_function( + | File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 191, in run_endpoint_function + | return await dependant.call(**values) + | File "/home/ckh08045/work/inpaintServer/./app/api/endpoints.py", line 114, in health_check + | return HealthResponse( + | File "/home/ckh08045/.local/lib/python3.8/site-packages/pydantic/main.py", line 214, in __init__ + | validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self) + | pydantic_core._pydantic_core.ValidationError: 3 validation errors for HealthResponse + | timestamp + | Field required [type=missing, input_value={'status': 'ok', 'uptime': '00:00:43'}, input_type=dict] + | For further information visit https://errors.pydantic.dev/2.10/v/missing + | version + | Field required [type=missing, input_value={'status': 'ok', 'uptime': '00:00:43'}, input_type=dict] + | For further information visit https://errors.pydantic.dev/2.10/v/missing + | uptime + | Input should be a valid number, unable to parse string as a number [type=float_parsing, input_value='00:00:43', input_type=str] + | For further information visit https://errors.pydantic.dev/2.10/v/float_parsing + +------------------------------------ + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "/home/ckh08045/.local/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi + result = await app(self.scope, self.receive, self.send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__ + return await self.app(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/applications.py", line 1054, in __call__ + await super().__call__(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/applications.py", line 116, in __call__ + await self.middleware_stack(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 186, in __call__ + raise exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 164, in __call__ + await self.app(scope, receive, _send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/cors.py", line 83, in __call__ + await self.app(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 193, in __call__ + response_sent.set() + File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__ + self.gen.throw(type, value, traceback) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_utils.py", line 88, in collapse_excgroups + raise exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 191, in __call__ + response = await self.dispatch_func(request, call_next) + File "/home/ckh08045/work/inpaintServer/./main.py", line 298, in collect_api_stats + response = await call_next(request) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 165, in call_next + raise app_exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 151, in coro + await self.app(scope, receive_or_disconnect, send_no_error) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 62, in __call__ + await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app + raise exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app + await app(scope, receive, sender) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 746, in __call__ + await route.handle(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 288, in handle + await self.app(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 75, in app + await wrap_app_handling_exceptions(app, request)(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app + raise exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app + await app(scope, receive, sender) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 70, in app + response = await func(request) + File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 299, in app + raise e + File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 294, in app + raw_response = await run_endpoint_function( + File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 191, in run_endpoint_function + return await dependant.call(**values) + File "/home/ckh08045/work/inpaintServer/./app/api/endpoints.py", line 114, in health_check + return HealthResponse( + File "/home/ckh08045/.local/lib/python3.8/site-packages/pydantic/main.py", line 214, in __init__ + validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self) +pydantic_core._pydantic_core.ValidationError: 3 validation errors for HealthResponse +timestamp + Field required [type=missing, input_value={'status': 'ok', 'uptime': '00:00:43'}, input_type=dict] + For further information visit https://errors.pydantic.dev/2.10/v/missing +version + Field required [type=missing, input_value={'status': 'ok', 'uptime': '00:00:43'}, input_type=dict] + For further information visit https://errors.pydantic.dev/2.10/v/missing +uptime + Input should be a valid number, unable to parse string as a number [type=float_parsing, input_value='00:00:43', input_type=str] + For further information visit https://errors.pydantic.dev/2.10/v/float_parsing +2025-08-30 01:01:39,956 - uvicorn.error - ERROR - Exception in ASGI application + + Exception Group Traceback (most recent call last): + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_utils.py", line 82, in collapse_excgroups + | yield + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 193, in __call__ + | response_sent.set() + | File "/home/ckh08045/.local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 685, in __aexit__ + | raise BaseExceptionGroup( + | exceptiongroup.ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) + +-+---------------- 1 ---------------- + | Traceback (most recent call last): + | File "/home/ckh08045/.local/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi + | result = await app(self.scope, self.receive, self.send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__ + | return await self.app(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/applications.py", line 1054, in __call__ + | await super().__call__(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/applications.py", line 116, in __call__ + | await self.middleware_stack(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 186, in __call__ + | raise exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 164, in __call__ + | await self.app(scope, receive, _send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/cors.py", line 83, in __call__ + | await self.app(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 193, in __call__ + | response_sent.set() + | File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__ + | self.gen.throw(type, value, traceback) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_utils.py", line 88, in collapse_excgroups + | raise exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 191, in __call__ + | response = await self.dispatch_func(request, call_next) + | File "/home/ckh08045/work/inpaintServer/./main.py", line 298, in collect_api_stats + | response = await call_next(request) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 165, in call_next + | raise app_exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 151, in coro + | await self.app(scope, receive_or_disconnect, send_no_error) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 62, in __call__ + | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app + | raise exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app + | await app(scope, receive, sender) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 746, in __call__ + | await route.handle(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 288, in handle + | await self.app(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 75, in app + | await wrap_app_handling_exceptions(app, request)(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app + | raise exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app + | await app(scope, receive, sender) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 70, in app + | response = await func(request) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 299, in app + | raise e + | File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 294, in app + | raw_response = await run_endpoint_function( + | File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 191, in run_endpoint_function + | return await dependant.call(**values) + | File "/home/ckh08045/work/inpaintServer/./app/api/endpoints.py", line 114, in health_check + | return HealthResponse( + | File "/home/ckh08045/.local/lib/python3.8/site-packages/pydantic/main.py", line 214, in __init__ + | validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self) + | pydantic_core._pydantic_core.ValidationError: 3 validation errors for HealthResponse + | timestamp + | Field required [type=missing, input_value={'status': 'ok', 'uptime': '00:00:43'}, input_type=dict] + | For further information visit https://errors.pydantic.dev/2.10/v/missing + | version + | Field required [type=missing, input_value={'status': 'ok', 'uptime': '00:00:43'}, input_type=dict] + | For further information visit https://errors.pydantic.dev/2.10/v/missing + | uptime + | Input should be a valid number, unable to parse string as a number [type=float_parsing, input_value='00:00:43', input_type=str] + | For further information visit https://errors.pydantic.dev/2.10/v/float_parsing + +------------------------------------ + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "/home/ckh08045/.local/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi + result = await app(self.scope, self.receive, self.send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__ + return await self.app(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/applications.py", line 1054, in __call__ + await super().__call__(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/applications.py", line 116, in __call__ + await self.middleware_stack(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 186, in __call__ + raise exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 164, in __call__ + await self.app(scope, receive, _send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/cors.py", line 83, in __call__ + await self.app(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 193, in __call__ + response_sent.set() + File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__ + self.gen.throw(type, value, traceback) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_utils.py", line 88, in collapse_excgroups + raise exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 191, in __call__ + response = await self.dispatch_func(request, call_next) + File "/home/ckh08045/work/inpaintServer/./main.py", line 298, in collect_api_stats + response = await call_next(request) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 165, in call_next + raise app_exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 151, in coro + await self.app(scope, receive_or_disconnect, send_no_error) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 62, in __call__ + await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app + raise exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app + await app(scope, receive, sender) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 746, in __call__ + await route.handle(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 288, in handle + await self.app(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 75, in app + await wrap_app_handling_exceptions(app, request)(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app + raise exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app + await app(scope, receive, sender) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 70, in app + response = await func(request) + File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 299, in app + raise e + File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 294, in app + raw_response = await run_endpoint_function( + File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 191, in run_endpoint_function + return await dependant.call(**values) + File "/home/ckh08045/work/inpaintServer/./app/api/endpoints.py", line 114, in health_check + return HealthResponse( + File "/home/ckh08045/.local/lib/python3.8/site-packages/pydantic/main.py", line 214, in __init__ + validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self) +pydantic_core._pydantic_core.ValidationError: 3 validation errors for HealthResponse +timestamp + Field required [type=missing, input_value={'status': 'ok', 'uptime': '00:00:43'}, input_type=dict] + For further information visit https://errors.pydantic.dev/2.10/v/missing +version + Field required [type=missing, input_value={'status': 'ok', 'uptime': '00:00:43'}, input_type=dict] + For further information visit https://errors.pydantic.dev/2.10/v/missing +uptime + Input should be a valid number, unable to parse string as a number [type=float_parsing, input_value='00:00:43', input_type=str] + For further information visit https://errors.pydantic.dev/2.10/v/float_parsing +2025-08-30 01:02:10,879 - uvicorn.error - INFO - Shutting down +2025-08-30 01:02:10,984 - uvicorn.error - INFO - Waiting for application shutdown. +2025-08-30 01:02:10,987 - main - INFO - 🛑 인페인팅 서버 종료 중... +2025-08-30 01:02:10,988 - app.core.worker_manager - INFO - Stopping worker manager... +2025-08-30 01:02:10,989 - app.core.worker_manager - INFO - Worker manager stopped +2025-08-30 01:02:10,990 - main - INFO - ✅ 워커 매니저 중지 완료 +2025-08-30 01:02:10,991 - app.core.batch_manager - INFO - Stopping BatchManager... +2025-08-30 01:02:10,992 - app.core.batch_manager - INFO - BatchManager stopped. +2025-08-30 01:02:10,993 - main - INFO - ✅ 배치 관리자 중지 완료 +2025-08-30 01:02:10,993 - main - INFO - 👋 인페인팅 서버 종료 완료 +2025-08-30 01:02:10,994 - app.utils.discord_notifier - WARNING - Discord 웹훅 URL이 설정되지 않아 알림을 보낼 수 없습니다. +2025-08-30 01:02:10,996 - uvicorn.error - INFO - Application shutdown complete. +2025-08-30 01:02:10,997 - uvicorn.error - INFO - Finished server process [66666] +2025-08-30 01:03:06,674 - uvicorn.error - INFO - Started server process [67469] +2025-08-30 01:03:06,675 - uvicorn.error - INFO - Waiting for application startup. +2025-08-30 01:03:06,678 - main - INFO - 🚀 인페인팅 서버 시작 중... +2025-08-30 01:03:06,679 - main - INFO - ✅ 공유 객체를 app.state에 저장 완료 +2025-08-30 01:03:06,679 - main - INFO - 🔄 상태 저장 백그라운드 작업 생성 중... +2025-08-30 01:03:06,679 - main - INFO - ✅ 상태 저장 백그라운드 작업 생성 완료 +2025-08-30 01:03:06,680 - main - INFO - 🚀 세션 풀 초기화 (CUDA 자동 감지) +2025-08-30 01:03:06,680 - app.core.session_pool - INFO - Initializing dynamic session pools... +2025-08-30 01:03:06,680 - app.core.session_pool - INFO - Pre-loading 2 sessions for simple_lama +2025-08-30 01:03:06,681 - main - INFO - 🔄 상태 저장 백그라운드 작업 시작됨 +2025-08-30 01:03:06,682 - app.core.session_pool - INFO - Creating new session simple_lama_0 for simple_lama... +2025-08-30 01:03:09,896 - app.models.simple_lama - INFO - Loading Simple LAMA model... +2025-08-30 01:03:14,043 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 +2025-08-30 01:03:14,044 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully +2025-08-30 01:03:14,045 - app.core.session_pool - INFO - Successfully created session simple_lama_0 +2025-08-30 01:03:14,046 - app.core.session_pool - INFO - Creating new session simple_lama_1 for simple_lama... +2025-08-30 01:03:14,046 - app.models.simple_lama - INFO - Loading Simple LAMA model... +2025-08-30 01:03:15,629 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 +2025-08-30 01:03:15,630 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully +2025-08-30 01:03:15,630 - app.core.session_pool - INFO - Successfully created session simple_lama_1 +2025-08-30 01:03:15,631 - app.core.session_pool - INFO - Pre-loading 2 sessions for migan +2025-08-30 01:03:15,633 - app.core.session_pool - INFO - Creating new session migan_0 for migan... +2025-08-30 01:03:15,695 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 01:03:15,696 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 01:03:15,696 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:03:18,674 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:03:18,675 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 01:03:18,676 - app.core.session_pool - INFO - Successfully created session migan_0 +2025-08-30 01:03:18,676 - app.core.session_pool - INFO - Creating new session migan_1 for migan... +2025-08-30 01:03:18,677 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 01:03:18,677 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 01:03:18,677 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:03:19,891 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:03:19,892 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 01:03:19,893 - app.core.session_pool - INFO - Successfully created session migan_1 +2025-08-30 01:03:19,894 - app.core.session_pool - INFO - Pre-loading 2 sessions for rembg +2025-08-30 01:03:19,896 - app.core.session_pool - INFO - Creating new session rembg_0 for rembg... +2025-08-30 01:03:19,896 - app.core.session_pool - INFO - Creating new session rembg_1 for rembg... +2025-08-30 01:03:19,898 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 01:03:21,890 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 01:03:21,890 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 01:03:21,891 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 01:03:21,891 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:03:34,920 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 01:03:34,921 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 01:03:34,921 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 01:03:34,922 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 01:03:34,922 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 01:03:34,923 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 01:03:34,923 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:03:47,544 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 01:03:47,545 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 01:03:47,546 - app.core.session_pool - INFO - Successfully created session rembg_0 +2025-08-30 01:03:47,546 - app.core.session_pool - INFO - Successfully created session rembg_1 +2025-08-30 01:03:47,548 - app.core.session_pool - INFO - Session pools initialized successfully +2025-08-30 01:03:47,548 - main - INFO - ✅ 세션 풀 초기화 완료 +2025-08-30 01:03:47,549 - app.core.worker_manager - INFO - Starting worker manager... +2025-08-30 01:03:47,550 - app.core.worker_manager - INFO - Worker manager started with 10 workers +2025-08-30 01:03:47,550 - main - INFO - ✅ 워커 매니저 시작 완료 +2025-08-30 01:03:47,550 - app.core.batch_manager - INFO - Starting BatchManager... +2025-08-30 01:03:47,551 - app.core.batch_manager - INFO - BatchManager started successfully. +2025-08-30 01:03:47,551 - main - INFO - ✅ 배치 관리자 시작 완료 +2025-08-30 01:03:47,551 - main - INFO - 🎉 인페인팅 서버 시작 완료! +2025-08-30 01:03:47,552 - app.utils.discord_notifier - WARNING - Discord 웹훅 URL이 설정되지 않아 알림을 보낼 수 없습니다. +2025-08-30 01:03:47,552 - app.core.session_pool - INFO - Idle session reaper started. Timeout: 1800s, Check Interval: 60s +2025-08-30 01:03:47,552 - uvicorn.error - INFO - Application startup complete. +2025-08-30 01:03:47,554 - uvicorn.error - INFO - Uvicorn running on http://0.0.0.0:8008 (Press CTRL+C to quit) +2025-08-30 01:03:49,992 - uvicorn.error - ERROR - Exception in ASGI application + + Exception Group Traceback (most recent call last): + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_utils.py", line 82, in collapse_excgroups + | yield + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 193, in __call__ + | response_sent.set() + | File "/home/ckh08045/.local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 685, in __aexit__ + | raise BaseExceptionGroup( + | exceptiongroup.ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) + +-+---------------- 1 ---------------- + | Traceback (most recent call last): + | File "/home/ckh08045/.local/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi + | result = await app(self.scope, self.receive, self.send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__ + | return await self.app(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/applications.py", line 1054, in __call__ + | await super().__call__(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/applications.py", line 116, in __call__ + | await self.middleware_stack(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 186, in __call__ + | raise exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 164, in __call__ + | await self.app(scope, receive, _send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/cors.py", line 83, in __call__ + | await self.app(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 193, in __call__ + | response_sent.set() + | File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__ + | self.gen.throw(type, value, traceback) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_utils.py", line 88, in collapse_excgroups + | raise exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 191, in __call__ + | response = await self.dispatch_func(request, call_next) + | File "/home/ckh08045/work/inpaintServer/./main.py", line 298, in collect_api_stats + | response = await call_next(request) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 165, in call_next + | raise app_exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 151, in coro + | await self.app(scope, receive_or_disconnect, send_no_error) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 62, in __call__ + | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app + | raise exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app + | await app(scope, receive, sender) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 746, in __call__ + | await route.handle(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 288, in handle + | await self.app(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 75, in app + | await wrap_app_handling_exceptions(app, request)(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app + | raise exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app + | await app(scope, receive, sender) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 70, in app + | response = await func(request) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 299, in app + | raise e + | File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 294, in app + | raw_response = await run_endpoint_function( + | File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 191, in run_endpoint_function + | return await dependant.call(**values) + | File "/home/ckh08045/work/inpaintServer/./app/api/endpoints.py", line 114, in health_check + | return HealthResponse( + | File "/home/ckh08045/.local/lib/python3.8/site-packages/pydantic/main.py", line 214, in __init__ + | validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self) + | pydantic_core._pydantic_core.ValidationError: 3 validation errors for HealthResponse + | timestamp + | Field required [type=missing, input_value={'status': 'ok', 'uptime': '00:00:43'}, input_type=dict] + | For further information visit https://errors.pydantic.dev/2.10/v/missing + | version + | Field required [type=missing, input_value={'status': 'ok', 'uptime': '00:00:43'}, input_type=dict] + | For further information visit https://errors.pydantic.dev/2.10/v/missing + | uptime + | Input should be a valid number, unable to parse string as a number [type=float_parsing, input_value='00:00:43', input_type=str] + | For further information visit https://errors.pydantic.dev/2.10/v/float_parsing + +------------------------------------ + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "/home/ckh08045/.local/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi + result = await app(self.scope, self.receive, self.send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__ + return await self.app(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/applications.py", line 1054, in __call__ + await super().__call__(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/applications.py", line 116, in __call__ + await self.middleware_stack(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 186, in __call__ + raise exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 164, in __call__ + await self.app(scope, receive, _send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/cors.py", line 83, in __call__ + await self.app(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 193, in __call__ + response_sent.set() + File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__ + self.gen.throw(type, value, traceback) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_utils.py", line 88, in collapse_excgroups + raise exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 191, in __call__ + response = await self.dispatch_func(request, call_next) + File "/home/ckh08045/work/inpaintServer/./main.py", line 298, in collect_api_stats + response = await call_next(request) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 165, in call_next + raise app_exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 151, in coro + await self.app(scope, receive_or_disconnect, send_no_error) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 62, in __call__ + await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app + raise exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app + await app(scope, receive, sender) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 746, in __call__ + await route.handle(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 288, in handle + await self.app(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 75, in app + await wrap_app_handling_exceptions(app, request)(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app + raise exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app + await app(scope, receive, sender) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 70, in app + response = await func(request) + File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 299, in app + raise e + File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 294, in app + raw_response = await run_endpoint_function( + File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 191, in run_endpoint_function + return await dependant.call(**values) + File "/home/ckh08045/work/inpaintServer/./app/api/endpoints.py", line 114, in health_check + return HealthResponse( + File "/home/ckh08045/.local/lib/python3.8/site-packages/pydantic/main.py", line 214, in __init__ + validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self) +pydantic_core._pydantic_core.ValidationError: 3 validation errors for HealthResponse +timestamp + Field required [type=missing, input_value={'status': 'ok', 'uptime': '00:00:43'}, input_type=dict] + For further information visit https://errors.pydantic.dev/2.10/v/missing +version + Field required [type=missing, input_value={'status': 'ok', 'uptime': '00:00:43'}, input_type=dict] + For further information visit https://errors.pydantic.dev/2.10/v/missing +uptime + Input should be a valid number, unable to parse string as a number [type=float_parsing, input_value='00:00:43', input_type=str] + For further information visit https://errors.pydantic.dev/2.10/v/float_parsing +2025-08-30 01:03:50,029 - uvicorn.error - ERROR - Exception in ASGI application + + Exception Group Traceback (most recent call last): + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_utils.py", line 82, in collapse_excgroups + | yield + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 193, in __call__ + | response_sent.set() + | File "/home/ckh08045/.local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 685, in __aexit__ + | raise BaseExceptionGroup( + | exceptiongroup.ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) + +-+---------------- 1 ---------------- + | Traceback (most recent call last): + | File "/home/ckh08045/.local/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi + | result = await app(self.scope, self.receive, self.send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__ + | return await self.app(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/applications.py", line 1054, in __call__ + | await super().__call__(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/applications.py", line 116, in __call__ + | await self.middleware_stack(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 186, in __call__ + | raise exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 164, in __call__ + | await self.app(scope, receive, _send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/cors.py", line 83, in __call__ + | await self.app(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 193, in __call__ + | response_sent.set() + | File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__ + | self.gen.throw(type, value, traceback) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_utils.py", line 88, in collapse_excgroups + | raise exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 191, in __call__ + | response = await self.dispatch_func(request, call_next) + | File "/home/ckh08045/work/inpaintServer/./main.py", line 298, in collect_api_stats + | response = await call_next(request) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 165, in call_next + | raise app_exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 151, in coro + | await self.app(scope, receive_or_disconnect, send_no_error) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 62, in __call__ + | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app + | raise exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app + | await app(scope, receive, sender) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 746, in __call__ + | await route.handle(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 288, in handle + | await self.app(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 75, in app + | await wrap_app_handling_exceptions(app, request)(scope, receive, send) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app + | raise exc + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app + | await app(scope, receive, sender) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 70, in app + | response = await func(request) + | File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 299, in app + | raise e + | File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 294, in app + | raw_response = await run_endpoint_function( + | File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 191, in run_endpoint_function + | return await dependant.call(**values) + | File "/home/ckh08045/work/inpaintServer/./app/api/endpoints.py", line 114, in health_check + | return HealthResponse( + | File "/home/ckh08045/.local/lib/python3.8/site-packages/pydantic/main.py", line 214, in __init__ + | validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self) + | pydantic_core._pydantic_core.ValidationError: 3 validation errors for HealthResponse + | timestamp + | Field required [type=missing, input_value={'status': 'ok', 'uptime': '00:00:43'}, input_type=dict] + | For further information visit https://errors.pydantic.dev/2.10/v/missing + | version + | Field required [type=missing, input_value={'status': 'ok', 'uptime': '00:00:43'}, input_type=dict] + | For further information visit https://errors.pydantic.dev/2.10/v/missing + | uptime + | Input should be a valid number, unable to parse string as a number [type=float_parsing, input_value='00:00:43', input_type=str] + | For further information visit https://errors.pydantic.dev/2.10/v/float_parsing + +------------------------------------ + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "/home/ckh08045/.local/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi + result = await app(self.scope, self.receive, self.send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__ + return await self.app(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/applications.py", line 1054, in __call__ + await super().__call__(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/applications.py", line 116, in __call__ + await self.middleware_stack(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 186, in __call__ + raise exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 164, in __call__ + await self.app(scope, receive, _send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/cors.py", line 83, in __call__ + await self.app(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 193, in __call__ + response_sent.set() + File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__ + self.gen.throw(type, value, traceback) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_utils.py", line 88, in collapse_excgroups + raise exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 191, in __call__ + response = await self.dispatch_func(request, call_next) + File "/home/ckh08045/work/inpaintServer/./main.py", line 298, in collect_api_stats + response = await call_next(request) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 165, in call_next + raise app_exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/base.py", line 151, in coro + await self.app(scope, receive_or_disconnect, send_no_error) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 62, in __call__ + await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app + raise exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app + await app(scope, receive, sender) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 746, in __call__ + await route.handle(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 288, in handle + await self.app(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 75, in app + await wrap_app_handling_exceptions(app, request)(scope, receive, send) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app + raise exc + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app + await app(scope, receive, sender) + File "/home/ckh08045/.local/lib/python3.8/site-packages/starlette/routing.py", line 70, in app + response = await func(request) + File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 299, in app + raise e + File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 294, in app + raw_response = await run_endpoint_function( + File "/home/ckh08045/.local/lib/python3.8/site-packages/fastapi/routing.py", line 191, in run_endpoint_function + return await dependant.call(**values) + File "/home/ckh08045/work/inpaintServer/./app/api/endpoints.py", line 114, in health_check + return HealthResponse( + File "/home/ckh08045/.local/lib/python3.8/site-packages/pydantic/main.py", line 214, in __init__ + validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self) +pydantic_core._pydantic_core.ValidationError: 3 validation errors for HealthResponse +timestamp + Field required [type=missing, input_value={'status': 'ok', 'uptime': '00:00:43'}, input_type=dict] + For further information visit https://errors.pydantic.dev/2.10/v/missing +version + Field required [type=missing, input_value={'status': 'ok', 'uptime': '00:00:43'}, input_type=dict] + For further information visit https://errors.pydantic.dev/2.10/v/missing +uptime + Input should be a valid number, unable to parse string as a number [type=float_parsing, input_value='00:00:43', input_type=str] + For further information visit https://errors.pydantic.dev/2.10/v/float_parsing +2025-08-30 01:15:31,973 - uvicorn.error - INFO - Shutting down +2025-08-30 01:15:32,076 - uvicorn.error - INFO - Waiting for application shutdown. +2025-08-30 01:15:32,077 - main - INFO - 🛑 인페인팅 서버 종료 중... +2025-08-30 01:15:32,077 - app.core.worker_manager - INFO - Stopping worker manager... +2025-08-30 01:15:32,078 - app.core.worker_manager - INFO - Worker manager stopped +2025-08-30 01:15:32,078 - main - INFO - ✅ 워커 매니저 중지 완료 +2025-08-30 01:15:32,079 - app.core.batch_manager - INFO - Stopping BatchManager... +2025-08-30 01:15:32,079 - app.core.batch_manager - INFO - BatchManager stopped. +2025-08-30 01:15:32,080 - main - INFO - ✅ 배치 관리자 중지 완료 +2025-08-30 01:15:32,080 - main - INFO - 👋 인페인팅 서버 종료 완료 +2025-08-30 01:15:32,080 - app.utils.discord_notifier - WARNING - Discord 웹훅 URL이 설정되지 않아 알림을 보낼 수 없습니다. +2025-08-30 01:15:32,081 - uvicorn.error - INFO - Application shutdown complete. +2025-08-30 01:15:32,082 - uvicorn.error - INFO - Finished server process [67469] +2025-08-30 01:16:00,385 - uvicorn.error - INFO - Started server process [69326] +2025-08-30 01:16:00,386 - uvicorn.error - INFO - Waiting for application startup. +2025-08-30 01:16:00,389 - main - INFO - 🚀 인페인팅 서버 시작 중... +2025-08-30 01:16:00,390 - main - INFO - ✅ 공유 객체를 app.state에 저장 완료 +2025-08-30 01:16:00,390 - main - INFO - 🔄 상태 저장 백그라운드 작업 생성 중... +2025-08-30 01:16:00,390 - main - INFO - ✅ 상태 저장 백그라운드 작업 생성 완료 +2025-08-30 01:16:00,391 - main - INFO - 🚀 세션 풀 초기화 (CUDA 자동 감지) +2025-08-30 01:16:00,391 - app.core.session_pool - INFO - Initializing dynamic session pools... +2025-08-30 01:16:00,392 - app.core.session_pool - INFO - Pre-loading 2 sessions for simple_lama +2025-08-30 01:16:00,392 - main - INFO - 🔄 상태 저장 백그라운드 작업 시작됨 +2025-08-30 01:16:00,394 - app.core.session_pool - INFO - Creating new session simple_lama_0 for simple_lama... +2025-08-30 01:16:03,609 - app.models.simple_lama - INFO - Loading Simple LAMA model... +2025-08-30 01:16:07,807 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 +2025-08-30 01:16:07,808 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully +2025-08-30 01:16:07,810 - app.core.session_pool - INFO - Successfully created session simple_lama_0 +2025-08-30 01:16:07,811 - app.core.session_pool - INFO - Creating new session simple_lama_1 for simple_lama... +2025-08-30 01:16:07,812 - app.models.simple_lama - INFO - Loading Simple LAMA model... +2025-08-30 01:16:09,506 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 +2025-08-30 01:16:09,507 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully +2025-08-30 01:16:09,507 - app.core.session_pool - INFO - Successfully created session simple_lama_1 +2025-08-30 01:16:09,508 - app.core.session_pool - INFO - Pre-loading 2 sessions for migan +2025-08-30 01:16:09,510 - app.core.session_pool - INFO - Creating new session migan_0 for migan... +2025-08-30 01:16:09,574 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 01:16:09,575 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 01:16:09,575 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:16:12,504 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:16:12,505 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 01:16:12,505 - app.core.session_pool - INFO - Successfully created session migan_0 +2025-08-30 01:16:12,506 - app.core.session_pool - INFO - Creating new session migan_1 for migan... +2025-08-30 01:16:12,506 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 01:16:12,506 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 01:16:12,507 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:16:13,765 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:16:13,766 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 01:16:13,766 - app.core.session_pool - INFO - Successfully created session migan_1 +2025-08-30 01:16:13,767 - app.core.session_pool - INFO - Pre-loading 2 sessions for rembg +2025-08-30 01:16:13,769 - app.core.session_pool - INFO - Creating new session rembg_0 for rembg... +2025-08-30 01:16:13,769 - app.core.session_pool - INFO - Creating new session rembg_1 for rembg... +2025-08-30 01:16:13,771 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 01:16:15,732 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 01:16:15,732 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 01:16:15,733 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 01:16:15,733 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:16:28,881 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 01:16:28,882 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 01:16:28,882 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 01:16:28,883 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 01:16:28,883 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 01:16:28,884 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 01:16:28,884 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:16:41,334 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 01:16:41,334 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 01:16:41,335 - app.core.session_pool - INFO - Successfully created session rembg_0 +2025-08-30 01:16:41,336 - app.core.session_pool - INFO - Successfully created session rembg_1 +2025-08-30 01:16:41,338 - app.core.session_pool - INFO - Session pools initialized successfully +2025-08-30 01:16:41,338 - main - INFO - ✅ 세션 풀 초기화 완료 +2025-08-30 01:16:41,338 - app.core.worker_manager - INFO - Starting worker manager... +2025-08-30 01:16:41,339 - app.core.worker_manager - INFO - Worker manager started with 10 workers +2025-08-30 01:16:41,340 - main - INFO - ✅ 워커 매니저 시작 완료 +2025-08-30 01:16:41,340 - app.core.batch_manager - INFO - Starting BatchManager... +2025-08-30 01:16:41,341 - app.core.batch_manager - INFO - BatchManager started successfully. +2025-08-30 01:16:41,341 - main - INFO - ✅ 배치 관리자 시작 완료 +2025-08-30 01:16:41,341 - main - INFO - 🎉 인페인팅 서버 시작 완료! +2025-08-30 01:16:41,341 - app.utils.discord_notifier - WARNING - Discord 웹훅 URL이 설정되지 않아 알림을 보낼 수 없습니다. +2025-08-30 01:16:41,342 - app.core.session_pool - INFO - Idle session reaper started. Timeout: 1800s, Check Interval: 60s +2025-08-30 01:16:41,342 - uvicorn.error - INFO - Application startup complete. +2025-08-30 01:16:41,344 - uvicorn.error - INFO - Uvicorn running on http://0.0.0.0:8008 (Press CTRL+C to quit) +2025-08-30 01:21:29,203 - uvicorn.error - INFO - Shutting down +2025-08-30 01:21:29,305 - uvicorn.error - INFO - Waiting for application shutdown. +2025-08-30 01:21:29,306 - main - INFO - 🛑 인페인팅 서버 종료 중... +2025-08-30 01:21:29,307 - app.core.worker_manager - INFO - Stopping worker manager... +2025-08-30 01:21:29,307 - app.core.worker_manager - INFO - Worker manager stopped +2025-08-30 01:21:29,308 - main - INFO - ✅ 워커 매니저 중지 완료 +2025-08-30 01:21:29,308 - app.core.batch_manager - INFO - Stopping BatchManager... +2025-08-30 01:21:29,309 - app.core.batch_manager - INFO - BatchManager stopped. +2025-08-30 01:21:29,310 - main - INFO - ✅ 배치 관리자 중지 완료 +2025-08-30 01:21:29,311 - main - INFO - 👋 인페인팅 서버 종료 완료 +2025-08-30 01:21:29,311 - app.utils.discord_notifier - WARNING - Discord 웹훅 URL이 설정되지 않아 알림을 보낼 수 없습니다. +2025-08-30 01:21:29,313 - uvicorn.error - INFO - Application shutdown complete. +2025-08-30 01:21:29,314 - uvicorn.error - INFO - Finished server process [69326] +2025-08-30 01:34:15,804 - uvicorn.error - INFO - Started server process [72953] +2025-08-30 01:34:15,805 - uvicorn.error - INFO - Waiting for application startup. +2025-08-30 01:34:15,806 - main - INFO - 🚀 인페인팅 서버 시작 중... +2025-08-30 01:34:15,806 - main - INFO - ✅ 공유 객체를 app.state에 저장 완료 +2025-08-30 01:34:15,807 - main - INFO - 🔄 상태 저장 백그라운드 작업 생성 중... +2025-08-30 01:34:15,807 - main - INFO - ✅ 상태 저장 백그라운드 작업 생성 완료 +2025-08-30 01:34:15,807 - main - INFO - 🚀 세션 풀 초기화 (CUDA 자동 감지) +2025-08-30 01:34:15,808 - app.core.session_pool - INFO - Initializing dynamic session pools... +2025-08-30 01:34:15,808 - app.core.session_pool - INFO - Pre-loading 2 sessions for simple_lama +2025-08-30 01:34:15,809 - main - INFO - 🔄 상태 저장 백그라운드 작업 시작됨 +2025-08-30 01:34:15,810 - app.core.session_pool - INFO - Creating new session simple_lama_0 for simple_lama... +2025-08-30 01:34:19,077 - app.models.simple_lama - INFO - Loading Simple LAMA model... +2025-08-30 01:34:23,295 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 +2025-08-30 01:34:23,297 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully +2025-08-30 01:34:23,298 - app.core.session_pool - INFO - Successfully created session simple_lama_0 +2025-08-30 01:34:23,299 - app.core.session_pool - INFO - Creating new session simple_lama_1 for simple_lama... +2025-08-30 01:34:23,300 - app.models.simple_lama - INFO - Loading Simple LAMA model... +2025-08-30 01:34:25,166 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 +2025-08-30 01:34:25,166 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully +2025-08-30 01:34:25,167 - app.core.session_pool - INFO - Successfully created session simple_lama_1 +2025-08-30 01:34:25,167 - app.core.session_pool - INFO - Pre-loading 2 sessions for migan +2025-08-30 01:34:25,169 - app.core.session_pool - INFO - Creating new session migan_0 for migan... +2025-08-30 01:34:25,235 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 01:34:25,235 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 01:34:25,236 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:34:28,263 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:34:28,264 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 01:34:28,264 - app.core.session_pool - INFO - Successfully created session migan_0 +2025-08-30 01:34:28,265 - app.core.session_pool - INFO - Creating new session migan_1 for migan... +2025-08-30 01:34:28,265 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 01:34:28,266 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 01:34:28,266 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:34:29,518 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:34:29,519 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 01:34:29,520 - app.core.session_pool - INFO - Successfully created session migan_1 +2025-08-30 01:34:29,521 - app.core.session_pool - INFO - Pre-loading 2 sessions for rembg +2025-08-30 01:34:29,522 - app.core.session_pool - INFO - Creating new session rembg_0 for rembg... +2025-08-30 01:34:29,523 - app.core.session_pool - INFO - Creating new session rembg_1 for rembg... +2025-08-30 01:34:29,525 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 01:34:31,515 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 01:34:31,515 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 01:34:31,516 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 01:34:31,516 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:34:44,596 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 01:34:44,597 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 01:34:44,597 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 01:34:44,598 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 01:34:44,598 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 01:34:44,599 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 01:34:44,600 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:34:57,057 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 01:34:57,058 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 01:34:57,058 - app.core.session_pool - INFO - Successfully created session rembg_0 +2025-08-30 01:34:57,059 - app.core.session_pool - INFO - Successfully created session rembg_1 +2025-08-30 01:34:57,061 - app.core.session_pool - INFO - Session pools initialized successfully +2025-08-30 01:34:57,061 - main - INFO - ✅ 세션 풀 초기화 완료 +2025-08-30 01:34:57,061 - app.core.worker_manager - INFO - Starting worker manager... +2025-08-30 01:34:57,062 - app.core.worker_manager - INFO - Worker manager started with 10 workers +2025-08-30 01:34:57,062 - main - INFO - ✅ 워커 매니저 시작 완료 +2025-08-30 01:34:57,063 - app.core.batch_manager - INFO - Starting BatchManager... +2025-08-30 01:34:57,063 - app.core.batch_manager - INFO - BatchManager started successfully. +2025-08-30 01:34:57,064 - main - INFO - ✅ 배치 관리자 시작 완료 +2025-08-30 01:34:57,064 - main - INFO - 🎉 인페인팅 서버 시작 완료! +2025-08-30 01:34:57,064 - app.utils.discord_notifier - WARNING - Discord 웹훅 URL이 설정되지 않아 알림을 보낼 수 없습니다. +2025-08-30 01:34:57,065 - app.core.session_pool - INFO - Idle session reaper started. Timeout: 1800s, Check Interval: 60s +2025-08-30 01:34:57,065 - uvicorn.error - INFO - Application startup complete. +2025-08-30 01:34:57,066 - uvicorn.error - INFO - Uvicorn running on http://0.0.0.0:8008 (Press CTRL+C to quit) +2025-08-30 01:36:20,200 - app.core.worker_manager - ERROR - Unsupported model for single inpaint: simple-lama. Use process_inpaint_batch for simple-lama. +2025-08-30 01:36:20,202 - app.api.endpoints - ERROR - 인페인팅 처리 실패: Unsupported model for single inpaint: simple-lama +2025-08-30 01:36:20,221 - app.core.worker_manager - ERROR - Unsupported model for single inpaint: simple-lama. Use process_inpaint_batch for simple-lama. +2025-08-30 01:36:20,222 - app.api.endpoints - ERROR - 인페인팅 처리 실패: Unsupported model for single inpaint: simple-lama +2025-08-30 01:36:20,241 - app.core.worker_manager - ERROR - Unsupported model for single inpaint: simple-lama. Use process_inpaint_batch for simple-lama. +2025-08-30 01:36:20,242 - app.api.endpoints - ERROR - 인페인팅 처리 실패: Unsupported model for single inpaint: simple-lama +2025-08-30 01:36:20,259 - app.core.worker_manager - ERROR - Unsupported model for single inpaint: simple-lama. Use process_inpaint_batch for simple-lama. +2025-08-30 01:36:20,260 - app.api.endpoints - ERROR - 인페인팅 처리 실패: Unsupported model for single inpaint: simple-lama +2025-08-30 01:36:20,277 - app.core.worker_manager - ERROR - Unsupported model for single inpaint: simple-lama. Use process_inpaint_batch for simple-lama. +2025-08-30 01:36:20,279 - app.api.endpoints - ERROR - 인페인팅 처리 실패: Unsupported model for single inpaint: simple-lama +2025-08-30 01:36:20,297 - app.core.worker_manager - ERROR - Unsupported model for single inpaint: simple-lama. Use process_inpaint_batch for simple-lama. +2025-08-30 01:36:20,298 - app.api.endpoints - ERROR - 인페인팅 처리 실패: Unsupported model for single inpaint: simple-lama +2025-08-30 01:36:20,316 - app.core.worker_manager - ERROR - Unsupported model for single inpaint: simple-lama. Use process_inpaint_batch for simple-lama. +2025-08-30 01:36:20,316 - app.api.endpoints - ERROR - 인페인팅 처리 실패: Unsupported model for single inpaint: simple-lama +2025-08-30 01:36:20,334 - app.core.worker_manager - ERROR - Unsupported model for single inpaint: simple-lama. Use process_inpaint_batch for simple-lama. +2025-08-30 01:36:20,335 - app.api.endpoints - ERROR - 인페인팅 처리 실패: Unsupported model for single inpaint: simple-lama +2025-08-30 01:38:15,844 - uvicorn.error - INFO - Shutting down +2025-08-30 01:38:15,948 - uvicorn.error - INFO - Waiting for application shutdown. +2025-08-30 01:38:15,950 - main - INFO - 🛑 인페인팅 서버 종료 중... +2025-08-30 01:38:15,951 - app.core.worker_manager - INFO - Stopping worker manager... +2025-08-30 01:38:15,953 - app.core.worker_manager - INFO - Worker manager stopped +2025-08-30 01:38:15,953 - main - INFO - ✅ 워커 매니저 중지 완료 +2025-08-30 01:38:15,954 - app.core.batch_manager - INFO - Stopping BatchManager... +2025-08-30 01:38:15,955 - app.core.batch_manager - INFO - BatchManager stopped. +2025-08-30 01:38:15,956 - main - INFO - ✅ 배치 관리자 중지 완료 +2025-08-30 01:38:15,957 - main - INFO - 👋 인페인팅 서버 종료 완료 +2025-08-30 01:38:15,958 - app.utils.discord_notifier - WARNING - Discord 웹훅 URL이 설정되지 않아 알림을 보낼 수 없습니다. +2025-08-30 01:38:15,960 - uvicorn.error - INFO - Application shutdown complete. +2025-08-30 01:38:15,961 - uvicorn.error - INFO - Finished server process [72953] +2025-08-30 01:38:41,360 - uvicorn.error - INFO - Started server process [73988] +2025-08-30 01:38:41,362 - uvicorn.error - INFO - Waiting for application startup. +2025-08-30 01:38:41,363 - main - INFO - 🚀 인페인팅 서버 시작 중... +2025-08-30 01:38:41,363 - main - INFO - ✅ 공유 객체를 app.state에 저장 완료 +2025-08-30 01:38:41,363 - main - INFO - 🔄 상태 저장 백그라운드 작업 생성 중... +2025-08-30 01:38:41,364 - main - INFO - ✅ 상태 저장 백그라운드 작업 생성 완료 +2025-08-30 01:38:41,364 - main - INFO - 🚀 세션 풀 초기화 (CUDA 자동 감지) +2025-08-30 01:38:41,364 - app.core.session_pool - INFO - Initializing dynamic session pools... +2025-08-30 01:38:41,365 - app.core.session_pool - INFO - Pre-loading 2 sessions for simple_lama +2025-08-30 01:38:41,365 - main - INFO - 🔄 상태 저장 백그라운드 작업 시작됨 +2025-08-30 01:38:41,367 - app.core.session_pool - INFO - Creating new session simple_lama_0 for simple_lama... +2025-08-30 01:38:44,641 - app.models.simple_lama - INFO - Loading Simple LAMA model... +2025-08-30 01:38:48,816 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 +2025-08-30 01:38:48,817 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully +2025-08-30 01:38:48,818 - app.core.session_pool - INFO - Successfully created session simple_lama_0 +2025-08-30 01:38:48,819 - app.core.session_pool - INFO - Creating new session simple_lama_1 for simple_lama... +2025-08-30 01:38:48,820 - app.models.simple_lama - INFO - Loading Simple LAMA model... +2025-08-30 01:38:50,504 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 +2025-08-30 01:38:50,505 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully +2025-08-30 01:38:50,505 - app.core.session_pool - INFO - Successfully created session simple_lama_1 +2025-08-30 01:38:50,506 - app.core.session_pool - INFO - Pre-loading 2 sessions for migan +2025-08-30 01:38:50,508 - app.core.session_pool - INFO - Creating new session migan_0 for migan... +2025-08-30 01:38:50,576 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 01:38:50,577 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 01:38:50,577 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:38:53,605 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:38:53,606 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 01:38:53,607 - app.core.session_pool - INFO - Successfully created session migan_0 +2025-08-30 01:38:53,607 - app.core.session_pool - INFO - Creating new session migan_1 for migan... +2025-08-30 01:38:53,608 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 01:38:53,608 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 01:38:53,609 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:38:54,888 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:38:54,889 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 01:38:54,889 - app.core.session_pool - INFO - Successfully created session migan_1 +2025-08-30 01:38:54,890 - app.core.session_pool - INFO - Pre-loading 2 sessions for rembg +2025-08-30 01:38:54,892 - app.core.session_pool - INFO - Creating new session rembg_0 for rembg... +2025-08-30 01:38:54,892 - app.core.session_pool - INFO - Creating new session rembg_1 for rembg... +2025-08-30 01:38:54,894 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 01:38:56,917 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 01:38:56,917 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 01:38:56,918 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 01:38:56,918 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:39:10,083 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 01:39:10,084 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 01:39:10,084 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 01:39:10,085 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 01:39:10,085 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 01:39:10,086 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 01:39:10,086 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:39:22,619 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 01:39:22,620 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 01:39:22,621 - app.core.session_pool - INFO - Successfully created session rembg_0 +2025-08-30 01:39:22,621 - app.core.session_pool - INFO - Successfully created session rembg_1 +2025-08-30 01:39:22,623 - app.core.session_pool - INFO - Session pools initialized successfully +2025-08-30 01:39:22,624 - main - INFO - ✅ 세션 풀 초기화 완료 +2025-08-30 01:39:22,624 - app.core.worker_manager - INFO - Starting worker manager... +2025-08-30 01:39:22,625 - app.core.worker_manager - INFO - Worker manager started with 10 workers +2025-08-30 01:39:22,625 - main - INFO - ✅ 워커 매니저 시작 완료 +2025-08-30 01:39:22,626 - app.core.batch_manager - INFO - Starting BatchManager... +2025-08-30 01:39:22,626 - app.core.batch_manager - INFO - BatchManager started successfully. +2025-08-30 01:39:22,626 - main - INFO - ✅ 배치 관리자 시작 완료 +2025-08-30 01:39:22,627 - main - INFO - 🎉 인페인팅 서버 시작 완료! +2025-08-30 01:39:22,627 - app.utils.discord_notifier - WARNING - Discord 웹훅 URL이 설정되지 않아 알림을 보낼 수 없습니다. +2025-08-30 01:39:22,628 - app.core.session_pool - INFO - Idle session reaper started. Timeout: 1800s, Check Interval: 60s +2025-08-30 01:39:22,628 - uvicorn.error - INFO - Application startup complete. +2025-08-30 01:39:22,629 - uvicorn.error - INFO - Uvicorn running on http://0.0.0.0:8008 (Press CTRL+C to quit) +2025-08-30 01:39:55,976 - app.core.batch_manager - INFO - Creating a new batch with 4 jobs. +2025-08-30 01:39:55,982 - app.core.batch_manager - ERROR - Failed to process batch: _execute_task() missing 2 required positional arguments: 'task_id' and 'task_func' +Traceback (most recent call last): + File "/home/ckh08045/work/inpaintServer/./app/core/batch_manager.py", line 120, in _process_batch + results = await worker_manager.process_inpaint_batch(batch_data) + File "/home/ckh08045/work/inpaintServer/./app/core/worker_manager.py", line 390, in process_inpaint_batch + return await self._execute_task(_inpaint_batch()) +TypeError: _execute_task() missing 2 required positional arguments: 'task_id' and 'task_func' +2025-08-30 01:39:55,985 - app.api.endpoints - ERROR - 인페인팅 처리 실패: _execute_task() missing 2 required positional arguments: 'task_id' and 'task_func' +2025-08-30 01:39:55,985 - app.api.endpoints - ERROR - 인페인팅 처리 실패: _execute_task() missing 2 required positional arguments: 'task_id' and 'task_func' +2025-08-30 01:39:55,986 - app.api.endpoints - ERROR - 인페인팅 처리 실패: _execute_task() missing 2 required positional arguments: 'task_id' and 'task_func' +2025-08-30 01:39:55,986 - app.api.endpoints - ERROR - 인페인팅 처리 실패: _execute_task() missing 2 required positional arguments: 'task_id' and 'task_func' +2025-08-30 01:39:55,995 - app.core.batch_manager - INFO - Creating a new batch with 4 jobs. +2025-08-30 01:39:55,996 - app.core.batch_manager - ERROR - Failed to process batch: _execute_task() missing 2 required positional arguments: 'task_id' and 'task_func' +Traceback (most recent call last): + File "/home/ckh08045/work/inpaintServer/./app/core/batch_manager.py", line 120, in _process_batch + results = await worker_manager.process_inpaint_batch(batch_data) + File "/home/ckh08045/work/inpaintServer/./app/core/worker_manager.py", line 390, in process_inpaint_batch + return await self._execute_task(_inpaint_batch()) +TypeError: _execute_task() missing 2 required positional arguments: 'task_id' and 'task_func' +2025-08-30 01:39:55,997 - app.api.endpoints - ERROR - 인페인팅 처리 실패: _execute_task() missing 2 required positional arguments: 'task_id' and 'task_func' +2025-08-30 01:39:55,997 - app.api.endpoints - ERROR - 인페인팅 처리 실패: _execute_task() missing 2 required positional arguments: 'task_id' and 'task_func' +2025-08-30 01:39:55,998 - app.api.endpoints - ERROR - 인페인팅 처리 실패: _execute_task() missing 2 required positional arguments: 'task_id' and 'task_func' +2025-08-30 01:39:55,998 - app.api.endpoints - ERROR - 인페인팅 처리 실패: _execute_task() missing 2 required positional arguments: 'task_id' and 'task_func' +2025-08-30 01:41:08,451 - uvicorn.error - INFO - Shutting down +2025-08-30 01:41:08,556 - uvicorn.error - INFO - Waiting for application shutdown. +2025-08-30 01:41:08,558 - main - INFO - 🛑 인페인팅 서버 종료 중... +2025-08-30 01:41:08,559 - app.core.worker_manager - INFO - Stopping worker manager... +2025-08-30 01:41:08,560 - app.core.worker_manager - INFO - Worker manager stopped +2025-08-30 01:41:08,560 - main - INFO - ✅ 워커 매니저 중지 완료 +2025-08-30 01:41:08,561 - app.core.batch_manager - INFO - Stopping BatchManager... +2025-08-30 01:41:08,561 - app.core.batch_manager - INFO - BatchManager stopped. +2025-08-30 01:41:08,562 - main - INFO - ✅ 배치 관리자 중지 완료 +2025-08-30 01:41:08,562 - main - INFO - 👋 인페인팅 서버 종료 완료 +2025-08-30 01:41:08,563 - app.utils.discord_notifier - WARNING - Discord 웹훅 URL이 설정되지 않아 알림을 보낼 수 없습니다. +2025-08-30 01:41:08,564 - uvicorn.error - INFO - Application shutdown complete. +2025-08-30 01:41:08,565 - uvicorn.error - INFO - Finished server process [73988] +2025-08-30 01:41:49,103 - uvicorn.error - INFO - Started server process [75068] +2025-08-30 01:41:49,104 - uvicorn.error - INFO - Waiting for application startup. +2025-08-30 01:41:49,105 - main - INFO - 🚀 인페인팅 서버 시작 중... +2025-08-30 01:41:49,106 - main - INFO - ✅ 공유 객체를 app.state에 저장 완료 +2025-08-30 01:41:49,106 - main - INFO - 🔄 상태 저장 백그라운드 작업 생성 중... +2025-08-30 01:41:49,107 - main - INFO - ✅ 상태 저장 백그라운드 작업 생성 완료 +2025-08-30 01:41:49,107 - main - INFO - 🚀 세션 풀 초기화 (CUDA 자동 감지) +2025-08-30 01:41:49,107 - app.core.session_pool - INFO - Initializing dynamic session pools... +2025-08-30 01:41:49,108 - app.core.session_pool - INFO - Pre-loading 2 sessions for simple_lama +2025-08-30 01:41:49,108 - main - INFO - 🔄 상태 저장 백그라운드 작업 시작됨 +2025-08-30 01:41:49,110 - app.core.session_pool - INFO - Creating new session simple_lama_0 for simple_lama... +2025-08-30 01:41:52,348 - app.models.simple_lama - INFO - Loading Simple LAMA model... +2025-08-30 01:41:56,509 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 +2025-08-30 01:41:56,510 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully +2025-08-30 01:41:56,511 - app.core.session_pool - INFO - Successfully created session simple_lama_0 +2025-08-30 01:41:56,512 - app.core.session_pool - INFO - Creating new session simple_lama_1 for simple_lama... +2025-08-30 01:41:56,513 - app.models.simple_lama - INFO - Loading Simple LAMA model... +2025-08-30 01:41:58,123 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 +2025-08-30 01:41:58,124 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully +2025-08-30 01:41:58,124 - app.core.session_pool - INFO - Successfully created session simple_lama_1 +2025-08-30 01:41:58,125 - app.core.session_pool - INFO - Pre-loading 2 sessions for migan +2025-08-30 01:41:58,126 - app.core.session_pool - INFO - Creating new session migan_0 for migan... +2025-08-30 01:41:58,193 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 01:41:58,194 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 01:41:58,194 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:42:01,179 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:42:01,180 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 01:42:01,180 - app.core.session_pool - INFO - Successfully created session migan_0 +2025-08-30 01:42:01,181 - app.core.session_pool - INFO - Creating new session migan_1 for migan... +2025-08-30 01:42:01,181 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 01:42:01,181 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 01:42:01,182 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:42:02,437 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:42:02,438 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 01:42:02,439 - app.core.session_pool - INFO - Successfully created session migan_1 +2025-08-30 01:42:02,439 - app.core.session_pool - INFO - Pre-loading 2 sessions for rembg +2025-08-30 01:42:02,441 - app.core.session_pool - INFO - Creating new session rembg_0 for rembg... +2025-08-30 01:42:02,442 - app.core.session_pool - INFO - Creating new session rembg_1 for rembg... +2025-08-30 01:42:02,444 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 01:42:04,416 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 01:42:04,417 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 01:42:04,417 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 01:42:04,418 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:42:17,374 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 01:42:17,375 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 01:42:17,375 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 01:42:17,376 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 01:42:17,376 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 01:42:17,377 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 01:42:17,377 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:42:29,936 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 01:42:29,937 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 01:42:29,938 - app.core.session_pool - INFO - Successfully created session rembg_0 +2025-08-30 01:42:29,938 - app.core.session_pool - INFO - Successfully created session rembg_1 +2025-08-30 01:42:29,940 - app.core.session_pool - INFO - Session pools initialized successfully +2025-08-30 01:42:29,940 - main - INFO - ✅ 세션 풀 초기화 완료 +2025-08-30 01:42:29,940 - app.core.worker_manager - INFO - Starting worker manager... +2025-08-30 01:42:29,941 - app.core.worker_manager - INFO - Worker manager started with 10 workers +2025-08-30 01:42:29,941 - main - INFO - ✅ 워커 매니저 시작 완료 +2025-08-30 01:42:29,942 - app.core.batch_manager - INFO - Starting BatchManager... +2025-08-30 01:42:29,942 - app.core.batch_manager - INFO - BatchManager started successfully. +2025-08-30 01:42:29,942 - main - INFO - ✅ 배치 관리자 시작 완료 +2025-08-30 01:42:29,943 - main - INFO - 🎉 인페인팅 서버 시작 완료! +2025-08-30 01:42:29,943 - app.utils.discord_notifier - WARNING - Discord 웹훅 URL이 설정되지 않아 알림을 보낼 수 없습니다. +2025-08-30 01:42:29,944 - app.core.session_pool - INFO - Idle session reaper started. Timeout: 1800s, Check Interval: 60s +2025-08-30 01:42:29,944 - uvicorn.error - INFO - Application startup complete. +2025-08-30 01:42:29,945 - uvicorn.error - INFO - Uvicorn running on http://0.0.0.0:8008 (Press CTRL+C to quit) +2025-08-30 01:44:12,289 - app.core.batch_manager - INFO - Creating a new batch with 4 jobs. +2025-08-30 01:44:12,290 - app.models.simple_lama - INFO - 실제 SimpleLama 모델로 4개 이미지 인페인팅 수행 +2025-08-30 01:44:12,493 - app.core.batch_manager - ERROR - Failed to process batch: Input image should be either PIL Image or numpy array! +Traceback (most recent call last): + File "/home/ckh08045/work/inpaintServer/./app/core/batch_manager.py", line 120, in _process_batch + results = await worker_manager.process_inpaint_batch(batch_data) + File "/home/ckh08045/work/inpaintServer/./app/core/worker_manager.py", line 377, in process_inpaint_batch + results = await session.model.inpaint( + File "/home/ckh08045/work/inpaintServer/./app/models/simple_lama.py", line 165, in inpaint + inpainted_batch = self._model(image_batch, mask_batch) + File "/home/ckh08045/.local/lib/python3.8/site-packages/simple_lama_inpainting/models/model.py", line 29, in __call__ + image, mask = prepare_img_and_mask(image, mask, self.device) + File "/home/ckh08045/.local/lib/python3.8/site-packages/simple_lama_inpainting/utils/util.py", line 54, in prepare_img_and_mask + out_image = get_image(image) + File "/home/ckh08045/.local/lib/python3.8/site-packages/simple_lama_inpainting/utils/util.py", line 16, in get_image + raise Exception(f"Input image should be either PIL Image or numpy array!") +Exception: Input image should be either PIL Image or numpy array! +2025-08-30 01:44:12,498 - app.api.endpoints - ERROR - 인페인팅 처리 실패: Input image should be either PIL Image or numpy array! +2025-08-30 01:44:12,499 - app.api.endpoints - ERROR - 인페인팅 처리 실패: Input image should be either PIL Image or numpy array! +2025-08-30 01:44:12,500 - app.api.endpoints - ERROR - 인페인팅 처리 실패: Input image should be either PIL Image or numpy array! +2025-08-30 01:44:12,500 - app.api.endpoints - ERROR - 인페인팅 처리 실패: Input image should be either PIL Image or numpy array! +2025-08-30 01:44:12,510 - app.core.batch_manager - INFO - Creating a new batch with 4 jobs. +2025-08-30 01:44:12,511 - app.models.simple_lama - INFO - 실제 SimpleLama 모델로 4개 이미지 인페인팅 수행 +2025-08-30 01:44:12,647 - app.core.batch_manager - ERROR - Failed to process batch: Input image should be either PIL Image or numpy array! +Traceback (most recent call last): + File "/home/ckh08045/work/inpaintServer/./app/core/batch_manager.py", line 120, in _process_batch + results = await worker_manager.process_inpaint_batch(batch_data) + File "/home/ckh08045/work/inpaintServer/./app/core/worker_manager.py", line 377, in process_inpaint_batch + results = await session.model.inpaint( + File "/home/ckh08045/work/inpaintServer/./app/models/simple_lama.py", line 165, in inpaint + inpainted_batch = self._model(image_batch, mask_batch) + File "/home/ckh08045/.local/lib/python3.8/site-packages/simple_lama_inpainting/models/model.py", line 29, in __call__ + image, mask = prepare_img_and_mask(image, mask, self.device) + File "/home/ckh08045/.local/lib/python3.8/site-packages/simple_lama_inpainting/utils/util.py", line 54, in prepare_img_and_mask + out_image = get_image(image) + File "/home/ckh08045/.local/lib/python3.8/site-packages/simple_lama_inpainting/utils/util.py", line 16, in get_image + raise Exception(f"Input image should be either PIL Image or numpy array!") +Exception: Input image should be either PIL Image or numpy array! +2025-08-30 01:44:12,648 - app.api.endpoints - ERROR - 인페인팅 처리 실패: Input image should be either PIL Image or numpy array! +2025-08-30 01:44:12,649 - app.api.endpoints - ERROR - 인페인팅 처리 실패: Input image should be either PIL Image or numpy array! +2025-08-30 01:44:12,649 - app.api.endpoints - ERROR - 인페인팅 처리 실패: Input image should be either PIL Image or numpy array! +2025-08-30 01:44:12,650 - app.api.endpoints - ERROR - 인페인팅 처리 실패: Input image should be either PIL Image or numpy array! +2025-08-30 01:46:40,529 - uvicorn.error - INFO - Shutting down +2025-08-30 01:46:40,632 - uvicorn.error - INFO - Waiting for application shutdown. +2025-08-30 01:46:40,634 - main - INFO - 🛑 인페인팅 서버 종료 중... +2025-08-30 01:46:40,635 - app.core.worker_manager - INFO - Stopping worker manager... +2025-08-30 01:46:40,637 - app.core.worker_manager - INFO - Worker manager stopped +2025-08-30 01:46:40,637 - main - INFO - ✅ 워커 매니저 중지 완료 +2025-08-30 01:46:40,638 - app.core.batch_manager - INFO - Stopping BatchManager... +2025-08-30 01:46:40,639 - app.core.batch_manager - INFO - BatchManager stopped. +2025-08-30 01:46:40,640 - main - INFO - ✅ 배치 관리자 중지 완료 +2025-08-30 01:46:40,640 - main - INFO - 👋 인페인팅 서버 종료 완료 +2025-08-30 01:46:40,642 - app.utils.discord_notifier - WARNING - Discord 웹훅 URL이 설정되지 않아 알림을 보낼 수 없습니다. +2025-08-30 01:46:40,643 - uvicorn.error - INFO - Application shutdown complete. +2025-08-30 01:46:40,644 - uvicorn.error - INFO - Finished server process [75068] +2025-08-30 01:47:37,767 - uvicorn.error - INFO - Started server process [76545] +2025-08-30 01:47:37,768 - uvicorn.error - INFO - Waiting for application startup. +2025-08-30 01:47:37,770 - main - INFO - 🚀 인페인팅 서버 시작 중... +2025-08-30 01:47:37,770 - main - INFO - ✅ 공유 객체를 app.state에 저장 완료 +2025-08-30 01:47:37,770 - main - INFO - 🔄 상태 저장 백그라운드 작업 생성 중... +2025-08-30 01:47:37,771 - main - INFO - ✅ 상태 저장 백그라운드 작업 생성 완료 +2025-08-30 01:47:37,771 - main - INFO - 🚀 세션 풀 초기화 (CUDA 자동 감지) +2025-08-30 01:47:37,771 - app.core.session_pool - INFO - Initializing dynamic session pools... +2025-08-30 01:47:37,772 - app.core.session_pool - INFO - Pre-loading 2 sessions for simple_lama +2025-08-30 01:47:37,772 - main - INFO - 🔄 상태 저장 백그라운드 작업 시작됨 +2025-08-30 01:47:37,774 - app.core.session_pool - INFO - Creating new session simple_lama_0 for simple_lama... +2025-08-30 01:47:41,002 - app.models.simple_lama - INFO - Loading Simple LAMA model... +2025-08-30 01:47:45,041 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 +2025-08-30 01:47:45,042 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully +2025-08-30 01:47:45,042 - app.core.session_pool - INFO - Successfully created session simple_lama_0 +2025-08-30 01:47:45,043 - app.core.session_pool - INFO - Creating new session simple_lama_1 for simple_lama... +2025-08-30 01:47:45,044 - app.models.simple_lama - INFO - Loading Simple LAMA model... +2025-08-30 01:47:46,843 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 +2025-08-30 01:47:46,844 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully +2025-08-30 01:47:46,844 - app.core.session_pool - INFO - Successfully created session simple_lama_1 +2025-08-30 01:47:46,845 - app.core.session_pool - INFO - Pre-loading 2 sessions for migan +2025-08-30 01:47:46,847 - app.core.session_pool - INFO - Creating new session migan_0 for migan... +2025-08-30 01:47:46,912 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 01:47:46,913 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 01:47:46,913 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:47:49,955 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:47:49,956 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 01:47:49,956 - app.core.session_pool - INFO - Successfully created session migan_0 +2025-08-30 01:47:49,957 - app.core.session_pool - INFO - Creating new session migan_1 for migan... +2025-08-30 01:47:49,957 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 01:47:49,958 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 01:47:49,958 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:47:51,198 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:47:51,199 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 01:47:51,200 - app.core.session_pool - INFO - Successfully created session migan_1 +2025-08-30 01:47:51,201 - app.core.session_pool - INFO - Pre-loading 2 sessions for rembg +2025-08-30 01:47:51,202 - app.core.session_pool - INFO - Creating new session rembg_0 for rembg... +2025-08-30 01:47:51,203 - app.core.session_pool - INFO - Creating new session rembg_1 for rembg... +2025-08-30 01:47:51,205 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 01:47:53,178 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 01:47:53,179 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 01:47:53,180 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 01:47:53,180 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:48:06,174 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 01:48:06,175 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 01:48:06,176 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 01:48:06,176 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 01:48:06,177 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 01:48:06,177 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 01:48:06,178 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:48:18,635 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 01:48:18,636 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 01:48:18,637 - app.core.session_pool - INFO - Successfully created session rembg_0 +2025-08-30 01:48:18,637 - app.core.session_pool - INFO - Successfully created session rembg_1 +2025-08-30 01:48:18,639 - app.core.session_pool - INFO - Session pools initialized successfully +2025-08-30 01:48:18,640 - main - INFO - ✅ 세션 풀 초기화 완료 +2025-08-30 01:48:18,640 - app.core.worker_manager - INFO - Starting worker manager... +2025-08-30 01:48:18,641 - app.core.worker_manager - INFO - Worker manager started with 10 workers +2025-08-30 01:48:18,641 - main - INFO - ✅ 워커 매니저 시작 완료 +2025-08-30 01:48:18,642 - app.core.batch_manager - INFO - Starting BatchManager... +2025-08-30 01:48:18,642 - app.core.batch_manager - INFO - BatchManager started successfully. +2025-08-30 01:48:18,642 - main - INFO - ✅ 배치 관리자 시작 완료 +2025-08-30 01:48:18,643 - main - INFO - 🎉 인페인팅 서버 시작 완료! +2025-08-30 01:48:18,643 - app.utils.discord_notifier - WARNING - Discord 웹훅 URL이 설정되지 않아 알림을 보낼 수 없습니다. +2025-08-30 01:48:18,644 - app.core.session_pool - INFO - Idle session reaper started. Timeout: 1800s, Check Interval: 60s +2025-08-30 01:48:18,644 - uvicorn.error - INFO - Application startup complete. +2025-08-30 01:48:18,645 - uvicorn.error - INFO - Uvicorn running on http://0.0.0.0:8008 (Press CTRL+C to quit) +2025-08-30 01:49:34,547 - app.core.batch_manager - INFO - Creating a new batch with 4 jobs. +2025-08-30 01:49:34,550 - app.models.simple_lama - INFO - 실제 SimpleLama 모델로 4개 이미지 인페인팅 수행 +2025-08-30 01:49:34,551 - app.core.batch_manager - ERROR - Failed to process batch: name 'image_batch' is not defined +Traceback (most recent call last): + File "/home/ckh08045/work/inpaintServer/./app/core/batch_manager.py", line 120, in _process_batch + results = await worker_manager.process_inpaint_batch(batch_data) + File "/home/ckh08045/work/inpaintServer/./app/core/worker_manager.py", line 377, in process_inpaint_batch + results = await session.model.inpaint( + File "/home/ckh08045/work/inpaintServer/./app/models/simple_lama.py", line 138, in inpaint + inpainted_batch = self._model.model(image_batch, mask_batch) +NameError: name 'image_batch' is not defined +2025-08-30 01:49:34,554 - app.api.endpoints - ERROR - 인페인팅 처리 실패: name 'image_batch' is not defined +2025-08-30 01:49:34,554 - app.api.endpoints - ERROR - 인페인팅 처리 실패: name 'image_batch' is not defined +2025-08-30 01:49:34,555 - app.api.endpoints - ERROR - 인페인팅 처리 실패: name 'image_batch' is not defined +2025-08-30 01:49:34,556 - app.api.endpoints - ERROR - 인페인팅 처리 실패: name 'image_batch' is not defined +2025-08-30 01:49:34,563 - app.core.batch_manager - INFO - Creating a new batch with 4 jobs. +2025-08-30 01:49:34,564 - app.models.simple_lama - INFO - 실제 SimpleLama 모델로 4개 이미지 인페인팅 수행 +2025-08-30 01:49:34,565 - app.core.batch_manager - ERROR - Failed to process batch: name 'image_batch' is not defined +Traceback (most recent call last): + File "/home/ckh08045/work/inpaintServer/./app/core/batch_manager.py", line 120, in _process_batch + results = await worker_manager.process_inpaint_batch(batch_data) + File "/home/ckh08045/work/inpaintServer/./app/core/worker_manager.py", line 377, in process_inpaint_batch + results = await session.model.inpaint( + File "/home/ckh08045/work/inpaintServer/./app/models/simple_lama.py", line 138, in inpaint + inpainted_batch = self._model.model(image_batch, mask_batch) +NameError: name 'image_batch' is not defined +2025-08-30 01:49:34,566 - app.api.endpoints - ERROR - 인페인팅 처리 실패: name 'image_batch' is not defined +2025-08-30 01:49:34,566 - app.api.endpoints - ERROR - 인페인팅 처리 실패: name 'image_batch' is not defined +2025-08-30 01:49:34,567 - app.api.endpoints - ERROR - 인페인팅 처리 실패: name 'image_batch' is not defined +2025-08-30 01:49:34,567 - app.api.endpoints - ERROR - 인페인팅 처리 실패: name 'image_batch' is not defined +2025-08-30 01:54:41,419 - uvicorn.error - INFO - Shutting down +2025-08-30 01:54:41,521 - uvicorn.error - INFO - Waiting for application shutdown. +2025-08-30 01:54:41,523 - main - INFO - 🛑 인페인팅 서버 종료 중... +2025-08-30 01:54:41,523 - app.core.worker_manager - INFO - Stopping worker manager... +2025-08-30 01:54:41,524 - app.core.worker_manager - INFO - Worker manager stopped +2025-08-30 01:54:41,525 - main - INFO - ✅ 워커 매니저 중지 완료 +2025-08-30 01:54:41,525 - app.core.batch_manager - INFO - Stopping BatchManager... +2025-08-30 01:54:41,526 - app.core.batch_manager - INFO - BatchManager stopped. +2025-08-30 01:54:41,526 - main - INFO - ✅ 배치 관리자 중지 완료 +2025-08-30 01:54:41,526 - main - INFO - 👋 인페인팅 서버 종료 완료 +2025-08-30 01:54:41,527 - app.utils.discord_notifier - WARNING - Discord 웹훅 URL이 설정되지 않아 알림을 보낼 수 없습니다. +2025-08-30 01:54:41,528 - uvicorn.error - INFO - Application shutdown complete. +2025-08-30 01:54:41,529 - uvicorn.error - INFO - Finished server process [76545] +2025-08-30 01:55:09,899 - uvicorn.error - INFO - Started server process [77869] +2025-08-30 01:55:09,900 - uvicorn.error - INFO - Waiting for application startup. +2025-08-30 01:55:09,901 - main - INFO - 🚀 인페인팅 서버 시작 중... +2025-08-30 01:55:09,901 - main - INFO - ✅ 공유 객체를 app.state에 저장 완료 +2025-08-30 01:55:09,902 - main - INFO - 🔄 상태 저장 백그라운드 작업 생성 중... +2025-08-30 01:55:09,902 - main - INFO - ✅ 상태 저장 백그라운드 작업 생성 완료 +2025-08-30 01:55:09,902 - main - INFO - 🚀 세션 풀 초기화 (CUDA 자동 감지) +2025-08-30 01:55:09,902 - app.core.session_pool - INFO - Initializing dynamic session pools... +2025-08-30 01:55:09,903 - app.core.session_pool - INFO - Pre-loading 2 sessions for simple_lama +2025-08-30 01:55:09,903 - main - INFO - 🔄 상태 저장 백그라운드 작업 시작됨 +2025-08-30 01:55:09,905 - app.core.session_pool - INFO - Creating new session simple_lama_0 for simple_lama... +2025-08-30 01:55:13,106 - app.models.simple_lama - INFO - Loading Simple LAMA model... +2025-08-30 01:55:17,237 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 +2025-08-30 01:55:17,239 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully +2025-08-30 01:55:17,240 - app.core.session_pool - INFO - Successfully created session simple_lama_0 +2025-08-30 01:55:17,241 - app.core.session_pool - INFO - Creating new session simple_lama_1 for simple_lama... +2025-08-30 01:55:17,241 - app.models.simple_lama - INFO - Loading Simple LAMA model... +2025-08-30 01:55:18,996 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 +2025-08-30 01:55:18,997 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully +2025-08-30 01:55:18,997 - app.core.session_pool - INFO - Successfully created session simple_lama_1 +2025-08-30 01:55:18,998 - app.core.session_pool - INFO - Pre-loading 2 sessions for migan +2025-08-30 01:55:18,999 - app.core.session_pool - INFO - Creating new session migan_0 for migan... +2025-08-30 01:55:19,063 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 01:55:19,064 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 01:55:19,064 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:55:21,872 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:55:21,873 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 01:55:21,874 - app.core.session_pool - INFO - Successfully created session migan_0 +2025-08-30 01:55:21,874 - app.core.session_pool - INFO - Creating new session migan_1 for migan... +2025-08-30 01:55:21,875 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 01:55:21,875 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 01:55:21,875 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:55:23,132 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:55:23,133 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 01:55:23,134 - app.core.session_pool - INFO - Successfully created session migan_1 +2025-08-30 01:55:23,134 - app.core.session_pool - INFO - Pre-loading 2 sessions for rembg +2025-08-30 01:55:23,136 - app.core.session_pool - INFO - Creating new session rembg_0 for rembg... +2025-08-30 01:55:23,137 - app.core.session_pool - INFO - Creating new session rembg_1 for rembg... +2025-08-30 01:55:23,139 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 01:55:25,141 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 01:55:25,141 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 01:55:25,142 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 01:55:25,142 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:55:38,144 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 01:55:38,145 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 01:55:38,146 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 01:55:38,146 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 01:55:38,147 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 01:55:38,148 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 01:55:38,148 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:55:50,692 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 01:55:50,693 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 01:55:50,694 - app.core.session_pool - INFO - Successfully created session rembg_0 +2025-08-30 01:55:50,694 - app.core.session_pool - INFO - Successfully created session rembg_1 +2025-08-30 01:55:50,696 - app.core.session_pool - INFO - Session pools initialized successfully +2025-08-30 01:55:50,697 - main - INFO - ✅ 세션 풀 초기화 완료 +2025-08-30 01:55:50,697 - app.core.worker_manager - INFO - Starting worker manager... +2025-08-30 01:55:50,698 - app.core.worker_manager - INFO - Worker manager started with 10 workers +2025-08-30 01:55:50,698 - main - INFO - ✅ 워커 매니저 시작 완료 +2025-08-30 01:55:50,698 - app.core.batch_manager - INFO - Starting BatchManager... +2025-08-30 01:55:50,699 - app.core.batch_manager - INFO - BatchManager started successfully. +2025-08-30 01:55:50,699 - main - INFO - ✅ 배치 관리자 시작 완료 +2025-08-30 01:55:50,699 - main - INFO - 🎉 인페인팅 서버 시작 완료! +2025-08-30 01:55:50,700 - app.utils.discord_notifier - WARNING - Discord 웹훅 URL이 설정되지 않아 알림을 보낼 수 없습니다. +2025-08-30 01:55:50,700 - app.core.session_pool - INFO - Idle session reaper started. Timeout: 1800s, Check Interval: 60s +2025-08-30 01:55:50,701 - uvicorn.error - INFO - Application startup complete. +2025-08-30 01:55:50,702 - uvicorn.error - INFO - Uvicorn running on http://0.0.0.0:8008 (Press CTRL+C to quit) +2025-08-30 01:56:15,715 - app.core.batch_manager - INFO - Creating a new batch with 4 jobs. +2025-08-30 01:56:15,881 - app.models.simple_lama - INFO - 실제 SimpleLama 모델로 4개 이미지 인페인팅 수행 +2025-08-30 01:56:21,625 - app.core.worker_manager - INFO - 'simple-lama' batch of 4 processed in 5.908s (avg: 1.477s/image) +2025-08-30 01:56:21,626 - app.core.batch_manager - INFO - Successfully processed batch of 4 jobs. +2025-08-30 01:56:24,783 - app.core.batch_manager - INFO - Creating a new batch with 2 jobs. +2025-08-30 01:56:24,995 - app.models.simple_lama - INFO - 실제 SimpleLama 모델로 2개 이미지 인페인팅 수행 +2025-08-30 01:56:39,252 - app.core.worker_manager - INFO - 'simple-lama' batch of 2 processed in 14.460s (avg: 7.230s/image) +2025-08-30 01:56:39,253 - app.core.batch_manager - INFO - Successfully processed batch of 2 jobs. +2025-08-30 01:56:39,367 - app.core.batch_manager - INFO - Creating a new batch with 2 jobs. +2025-08-30 01:56:39,469 - app.models.simple_lama - INFO - 실제 SimpleLama 모델로 2개 이미지 인페인팅 수행 +2025-08-30 01:56:40,764 - app.core.worker_manager - INFO - 'simple-lama' batch of 2 processed in 1.396s (avg: 0.698s/image) +2025-08-30 01:56:40,765 - app.core.batch_manager - INFO - Successfully processed batch of 2 jobs. +2025-08-30 01:57:35,001 - app.core.batch_manager - INFO - Creating a new batch with 4 jobs. +2025-08-30 01:57:35,213 - app.models.simple_lama - INFO - 실제 SimpleLama 모델로 4개 이미지 인페인팅 수행 +2025-08-30 01:57:37,476 - app.core.worker_manager - INFO - 'simple-lama' batch of 4 processed in 2.472s (avg: 0.618s/image) +2025-08-30 01:57:37,480 - app.core.batch_manager - INFO - Successfully processed batch of 4 jobs. +2025-08-30 01:57:37,511 - app.core.batch_manager - INFO - Creating a new batch with 4 jobs. +2025-08-30 01:57:37,735 - app.models.simple_lama - INFO - 실제 SimpleLama 모델로 4개 이미지 인페인팅 수행 +2025-08-30 01:57:39,686 - app.core.worker_manager - INFO - 'simple-lama' batch of 4 processed in 2.173s (avg: 0.543s/image) +2025-08-30 01:57:39,687 - app.core.batch_manager - INFO - Successfully processed batch of 4 jobs. +2025-08-30 01:57:47,368 - app.core.batch_manager - INFO - Creating a new batch with 4 jobs. +2025-08-30 01:57:47,620 - app.models.simple_lama - INFO - 실제 SimpleLama 모델로 4개 이미지 인페인팅 수행 +2025-08-30 01:57:49,769 - app.core.worker_manager - INFO - 'simple-lama' batch of 4 processed in 2.399s (avg: 0.600s/image) +2025-08-30 01:57:49,770 - app.core.batch_manager - INFO - Successfully processed batch of 4 jobs. +2025-08-30 01:57:49,800 - app.core.batch_manager - INFO - Creating a new batch with 4 jobs. +2025-08-30 01:57:50,022 - app.models.simple_lama - INFO - 실제 SimpleLama 모델로 4개 이미지 인페인팅 수행 +2025-08-30 01:57:51,985 - app.core.worker_manager - INFO - 'simple-lama' batch of 4 processed in 2.184s (avg: 0.546s/image) +2025-08-30 01:57:51,986 - app.core.batch_manager - INFO - Successfully processed batch of 4 jobs. diff --git a/logs/main_server.log b/logs/main_server.log index afe0973..ec9962d 100644 --- a/logs/main_server.log +++ b/logs/main_server.log @@ -1,71 +1,127 @@ -INFO: Started server process [56165] -2025-08-29 23:46:34,096 - uvicorn.error - INFO - Started server process [56165] +INFO: Started server process [77869] +2025-08-30 01:55:09,899 - uvicorn.error - INFO - Started server process [77869] INFO: Waiting for application startup. -2025-08-29 23:46:34,097 - uvicorn.error - INFO - Waiting for application startup. -2025-08-29 23:46:34,098 - main - INFO - 🚀 인페인팅 서버 시작 중... -2025-08-29 23:46:34,098 - main - INFO - ✅ 공유 객체를 app.state에 저장 완료 -2025-08-29 23:46:34,098 - main - INFO - 🔄 상태 저장 백그라운드 작업 생성 중... -2025-08-29 23:46:34,099 - main - INFO - ✅ 상태 저장 백그라운드 작업 생성 완료 -2025-08-29 23:46:34,099 - main - INFO - 🚀 세션 풀 초기화 (CUDA 자동 감지) -2025-08-29 23:46:34,100 - app.core.session_pool - INFO - Initializing dynamic session pools... -2025-08-29 23:46:34,100 - app.core.session_pool - INFO - Pre-loading 2 sessions for simple_lama -2025-08-29 23:46:34,100 - main - INFO - 🔄 상태 저장 백그라운드 작업 시작됨 -2025-08-29 23:46:34,104 - app.core.session_pool - INFO - Creating new session simple_lama_0 for simple_lama... -2025-08-29 23:46:37,259 - app.models.simple_lama - INFO - Loading Simple LAMA model... -2025-08-29 23:46:41,562 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 -2025-08-29 23:46:41,563 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully -2025-08-29 23:46:41,564 - app.core.session_pool - INFO - Successfully created session simple_lama_0 -2025-08-29 23:46:41,565 - app.core.session_pool - INFO - Creating new session simple_lama_1 for simple_lama... -2025-08-29 23:46:41,566 - app.models.simple_lama - INFO - Loading Simple LAMA model... -2025-08-29 23:46:43,429 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 -2025-08-29 23:46:43,429 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully -2025-08-29 23:46:43,429 - app.core.session_pool - INFO - Successfully created session simple_lama_1 -2025-08-29 23:46:43,430 - app.core.session_pool - INFO - Pre-loading 2 sessions for migan -2025-08-29 23:46:43,432 - app.core.session_pool - INFO - Creating new session migan_0 for migan... -2025-08-29 23:46:43,491 - app.models.migan - INFO - Loading MIGAN ONNX model... -2025-08-29 23:46:43,491 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... -2025-08-29 23:46:43,492 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] -2025-08-29 23:46:44.934790365 [W:onnxruntime:, transformer_memcpy.cc:74 ApplyImpl] 17 Memcpy nodes are added to the graph main_graph for CUDAExecutionProvider. It might have negative impact on performance (including unable to run CUDA graph). Set session_options.log_severity_level=1 to see the detail logs before this message. -2025-08-29 23:46:46,412 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] -2025-08-29 23:46:46,413 - app.models.migan - INFO - MIGAN ONNX model loaded successfully -2025-08-29 23:46:46,413 - app.core.session_pool - INFO - Successfully created session migan_0 -2025-08-29 23:46:46,414 - app.core.session_pool - INFO - Creating new session migan_1 for migan... -2025-08-29 23:46:46,414 - app.models.migan - INFO - Loading MIGAN ONNX model... -2025-08-29 23:46:46,415 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... -2025-08-29 23:46:46,415 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] -2025-08-29 23:46:47.468053292 [W:onnxruntime:, transformer_memcpy.cc:74 ApplyImpl] 17 Memcpy nodes are added to the graph main_graph for CUDAExecutionProvider. It might have negative impact on performance (including unable to run CUDA graph). Set session_options.log_severity_level=1 to see the detail logs before this message. -2025-08-29 23:46:47,630 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] -2025-08-29 23:46:47,631 - app.models.migan - INFO - MIGAN ONNX model loaded successfully -2025-08-29 23:46:47,632 - app.core.session_pool - INFO - Successfully created session migan_1 -2025-08-29 23:46:47,632 - app.core.session_pool - INFO - Pre-loading 2 sessions for rembg -2025-08-29 23:46:47,634 - app.core.session_pool - INFO - Creating new session rembg_0 for rembg... -2025-08-29 23:46:47,634 - app.core.session_pool - INFO - Creating new session rembg_1 for rembg... -2025-08-29 23:46:47,638 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... -2025-08-29 23:46:49,612 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) -2025-08-29 23:46:49,612 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True -2025-08-29 23:46:49,613 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 -2025-08-29 23:46:49,613 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] -2025-08-29 23:47:02,613 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) -2025-08-29 23:47:02,614 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully -2025-08-29 23:47:02,615 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... -2025-08-29 23:47:02,615 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) -2025-08-29 23:47:02,616 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True -2025-08-29 23:47:02,617 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 -2025-08-29 23:47:02,617 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] -2025-08-29 23:47:15,228 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) -2025-08-29 23:47:15,229 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully -2025-08-29 23:47:15,230 - app.core.session_pool - INFO - Successfully created session rembg_0 -2025-08-29 23:47:15,230 - app.core.session_pool - INFO - Successfully created session rembg_1 -2025-08-29 23:47:15,232 - app.core.session_pool - INFO - Session pools initialized successfully -2025-08-29 23:47:15,232 - main - INFO - ✅ 세션 풀 초기화 완료 -2025-08-29 23:47:15,233 - app.core.worker_manager - INFO - Starting worker manager... -2025-08-29 23:47:15,234 - app.core.worker_manager - INFO - Worker manager started with 10 workers -2025-08-29 23:47:15,234 - main - INFO - ✅ 워커 매니저 시작 완료 -2025-08-29 23:47:15,234 - main - INFO - 🎉 인페인팅 서버 시작 완료! -2025-08-29 23:47:15,235 - app.core.session_pool - INFO - Idle session reaper started. Timeout: 1800s, Check Interval: 60s +2025-08-30 01:55:09,900 - uvicorn.error - INFO - Waiting for application startup. +2025-08-30 01:55:09,901 - main - INFO - 🚀 인페인팅 서버 시작 중... +2025-08-30 01:55:09,901 - main - INFO - ✅ 공유 객체를 app.state에 저장 완료 +2025-08-30 01:55:09,902 - main - INFO - 🔄 상태 저장 백그라운드 작업 생성 중... +2025-08-30 01:55:09,902 - main - INFO - ✅ 상태 저장 백그라운드 작업 생성 완료 +2025-08-30 01:55:09,902 - main - INFO - 🚀 세션 풀 초기화 (CUDA 자동 감지) +2025-08-30 01:55:09,902 - app.core.session_pool - INFO - Initializing dynamic session pools... +2025-08-30 01:55:09,903 - app.core.session_pool - INFO - Pre-loading 2 sessions for simple_lama +2025-08-30 01:55:09,903 - main - INFO - 🔄 상태 저장 백그라운드 작업 시작됨 +2025-08-30 01:55:09,905 - app.core.session_pool - INFO - Creating new session simple_lama_0 for simple_lama... +2025-08-30 01:55:13,106 - app.models.simple_lama - INFO - Loading Simple LAMA model... +2025-08-30 01:55:17,237 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 +2025-08-30 01:55:17,239 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully +2025-08-30 01:55:17,240 - app.core.session_pool - INFO - Successfully created session simple_lama_0 +2025-08-30 01:55:17,241 - app.core.session_pool - INFO - Creating new session simple_lama_1 for simple_lama... +2025-08-30 01:55:17,241 - app.models.simple_lama - INFO - Loading Simple LAMA model... +2025-08-30 01:55:18,996 - app.models.simple_lama - INFO - 실제 SimpleLama 모델 로딩 완료 +2025-08-30 01:55:18,997 - app.models.simple_lama - INFO - Simple LAMA model loaded successfully +2025-08-30 01:55:18,997 - app.core.session_pool - INFO - Successfully created session simple_lama_1 +2025-08-30 01:55:18,998 - app.core.session_pool - INFO - Pre-loading 2 sessions for migan +2025-08-30 01:55:18,999 - app.core.session_pool - INFO - Creating new session migan_0 for migan... +2025-08-30 01:55:19,063 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 01:55:19,064 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 01:55:19,064 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:55:20.438912801 [W:onnxruntime:, transformer_memcpy.cc:74 ApplyImpl] 17 Memcpy nodes are added to the graph main_graph for CUDAExecutionProvider. It might have negative impact on performance (including unable to run CUDA graph). Set session_options.log_severity_level=1 to see the detail logs before this message. +2025-08-30 01:55:21,872 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:55:21,873 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 01:55:21,874 - app.core.session_pool - INFO - Successfully created session migan_0 +2025-08-30 01:55:21,874 - app.core.session_pool - INFO - Creating new session migan_1 for migan... +2025-08-30 01:55:21,875 - app.models.migan - INFO - Loading MIGAN ONNX model... +2025-08-30 01:55:21,875 - app.models.migan - INFO - MIGAN ONNX 런타임 세션 생성 시도... +2025-08-30 01:55:21,875 - app.models.migan - INFO - MIGAN ONNX providers 설정: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:55:22.968322444 [W:onnxruntime:, transformer_memcpy.cc:74 ApplyImpl] 17 Memcpy nodes are added to the graph main_graph for CUDAExecutionProvider. It might have negative impact on performance (including unable to run CUDA graph). Set session_options.log_severity_level=1 to see the detail logs before this message. +2025-08-30 01:55:23,132 - app.models.migan - INFO - MIGAN ONNX 세션 생성 완료. Providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:55:23,133 - app.models.migan - INFO - MIGAN ONNX model loaded successfully +2025-08-30 01:55:23,134 - app.core.session_pool - INFO - Successfully created session migan_1 +2025-08-30 01:55:23,134 - app.core.session_pool - INFO - Pre-loading 2 sessions for rembg +2025-08-30 01:55:23,136 - app.core.session_pool - INFO - Creating new session rembg_0 for rembg... +2025-08-30 01:55:23,137 - app.core.session_pool - INFO - Creating new session rembg_1 for rembg... +2025-08-30 01:55:23,139 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 01:55:25,141 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 01:55:25,141 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 01:55:25,142 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 01:55:25,142 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:55:38,144 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 01:55:38,145 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 01:55:38,146 - app.models.rembg_model - INFO - Loading REMBG model (birefnet-general-lite)... +2025-08-30 01:55:38,146 - app.models.rembg_model - INFO - rembg 모듈 임포트 성공 (세션 생성은 지연 로딩) +2025-08-30 01:55:38,147 - app.models.rembg_model - INFO - 🔧 rembg 새 세션 생성 필요: birefnet-general-lite_cuda_True +2025-08-30 01:55:38,148 - app.models.rembg_model - WARNING - rembg.sessions import 실패, 기본 방식 사용 +2025-08-30 01:55:38,148 - app.models.rembg_model - INFO - rembg 세션 생성 providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'] +2025-08-30 01:55:50,692 - app.models.rembg_model - INFO - ✅ rembg 'birefnet-general-lite' GPU 가속로 동작 (providers: ['CUDAExecutionProvider', 'CPUExecutionProvider']) +2025-08-30 01:55:50,693 - app.models.rembg_model - INFO - REMBG model (birefnet-general-lite) loaded successfully +2025-08-30 01:55:50,694 - app.core.session_pool - INFO - Successfully created session rembg_0 +2025-08-30 01:55:50,694 - app.core.session_pool - INFO - Successfully created session rembg_1 +2025-08-30 01:55:50,696 - app.core.session_pool - INFO - Session pools initialized successfully +2025-08-30 01:55:50,697 - main - INFO - ✅ 세션 풀 초기화 완료 +2025-08-30 01:55:50,697 - app.core.worker_manager - INFO - Starting worker manager... +2025-08-30 01:55:50,698 - app.core.worker_manager - INFO - Worker manager started with 10 workers +2025-08-30 01:55:50,698 - main - INFO - ✅ 워커 매니저 시작 완료 +2025-08-30 01:55:50,698 - app.core.batch_manager - INFO - Starting BatchManager... +2025-08-30 01:55:50,699 - app.core.batch_manager - INFO - BatchManager started successfully. +2025-08-30 01:55:50,699 - main - INFO - ✅ 배치 관리자 시작 완료 +2025-08-30 01:55:50,699 - main - INFO - 🎉 인페인팅 서버 시작 완료! +2025-08-30 01:55:50,700 - app.utils.discord_notifier - WARNING - Discord 웹훅 URL이 설정되지 않아 알림을 보낼 수 없습니다. +2025-08-30 01:55:50,700 - app.core.session_pool - INFO - Idle session reaper started. Timeout: 1800s, Check Interval: 60s INFO: Application startup complete. -2025-08-29 23:47:15,235 - uvicorn.error - INFO - Application startup complete. +2025-08-30 01:55:50,701 - uvicorn.error - INFO - Application startup complete. INFO: Uvicorn running on http://0.0.0.0:8008 (Press CTRL+C to quit) -2025-08-29 23:47:15,236 - uvicorn.error - INFO - Uvicorn running on http://0.0.0.0:8008 (Press CTRL+C to quit) -INFO: 127.0.0.1:57044 - "GET /api/v1/health HTTP/1.1" 200 OK -INFO: 127.0.0.1:57060 - "GET /api/v1/health HTTP/1.1" 200 OK +2025-08-30 01:55:50,702 - uvicorn.error - INFO - Uvicorn running on http://0.0.0.0:8008 (Press CTRL+C to quit) +INFO: 127.0.0.1:52600 - "GET /api/v1/health HTTP/1.1" 200 OK +INFO: 127.0.0.1:52608 - "GET /api/v1/health HTTP/1.1" 200 OK +2025-08-30 01:56:15,715 - app.core.batch_manager - INFO - Creating a new batch with 4 jobs. +2025-08-30 01:56:15,881 - app.models.simple_lama - INFO - 실제 SimpleLama 모델로 4개 이미지 인페인팅 수행 +2025-08-30 01:56:21,625 - app.core.worker_manager - INFO - 'simple-lama' batch of 4 processed in 5.908s (avg: 1.477s/image) +2025-08-30 01:56:21,626 - app.core.batch_manager - INFO - Successfully processed batch of 4 jobs. +INFO: 127.0.0.1:39480 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +INFO: 127.0.0.1:39488 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +INFO: 127.0.0.1:39500 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +INFO: 127.0.0.1:39516 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +2025-08-30 01:56:24,783 - app.core.batch_manager - INFO - Creating a new batch with 2 jobs. +2025-08-30 01:56:24,995 - app.models.simple_lama - INFO - 실제 SimpleLama 모델로 2개 이미지 인페인팅 수행 +2025-08-30 01:56:39,252 - app.core.worker_manager - INFO - 'simple-lama' batch of 2 processed in 14.460s (avg: 7.230s/image) +2025-08-30 01:56:39,253 - app.core.batch_manager - INFO - Successfully processed batch of 2 jobs. +INFO: 127.0.0.1:39524 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +INFO: 127.0.0.1:39536 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +2025-08-30 01:56:39,367 - app.core.batch_manager - INFO - Creating a new batch with 2 jobs. +2025-08-30 01:56:39,469 - app.models.simple_lama - INFO - 실제 SimpleLama 모델로 2개 이미지 인페인팅 수행 +2025-08-30 01:56:40,764 - app.core.worker_manager - INFO - 'simple-lama' batch of 2 processed in 1.396s (avg: 0.698s/image) +2025-08-30 01:56:40,765 - app.core.batch_manager - INFO - Successfully processed batch of 2 jobs. +INFO: 127.0.0.1:39546 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +INFO: 127.0.0.1:39550 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +2025-08-30 01:57:35,001 - app.core.batch_manager - INFO - Creating a new batch with 4 jobs. +2025-08-30 01:57:35,213 - app.models.simple_lama - INFO - 실제 SimpleLama 모델로 4개 이미지 인페인팅 수행 +2025-08-30 01:57:37,476 - app.core.worker_manager - INFO - 'simple-lama' batch of 4 processed in 2.472s (avg: 0.618s/image) +2025-08-30 01:57:37,480 - app.core.batch_manager - INFO - Successfully processed batch of 4 jobs. +INFO: 127.0.0.1:39274 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +INFO: 127.0.0.1:39278 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +INFO: 127.0.0.1:39286 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +INFO: 127.0.0.1:39296 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +2025-08-30 01:57:37,511 - app.core.batch_manager - INFO - Creating a new batch with 4 jobs. +2025-08-30 01:57:37,735 - app.models.simple_lama - INFO - 실제 SimpleLama 모델로 4개 이미지 인페인팅 수행 +2025-08-30 01:57:39,686 - app.core.worker_manager - INFO - 'simple-lama' batch of 4 processed in 2.173s (avg: 0.543s/image) +2025-08-30 01:57:39,687 - app.core.batch_manager - INFO - Successfully processed batch of 4 jobs. +INFO: 127.0.0.1:39308 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +INFO: 127.0.0.1:39322 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +INFO: 127.0.0.1:39330 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +INFO: 127.0.0.1:39334 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +2025-08-30 01:57:47,368 - app.core.batch_manager - INFO - Creating a new batch with 4 jobs. +2025-08-30 01:57:47,620 - app.models.simple_lama - INFO - 실제 SimpleLama 모델로 4개 이미지 인페인팅 수행 +2025-08-30 01:57:49,769 - app.core.worker_manager - INFO - 'simple-lama' batch of 4 processed in 2.399s (avg: 0.600s/image) +2025-08-30 01:57:49,770 - app.core.batch_manager - INFO - Successfully processed batch of 4 jobs. +INFO: 127.0.0.1:47538 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +INFO: 127.0.0.1:47542 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +INFO: 127.0.0.1:47554 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +INFO: 127.0.0.1:47566 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +2025-08-30 01:57:49,800 - app.core.batch_manager - INFO - Creating a new batch with 4 jobs. +2025-08-30 01:57:50,022 - app.models.simple_lama - INFO - 실제 SimpleLama 모델로 4개 이미지 인페인팅 수행 +2025-08-30 01:57:51,985 - app.core.worker_manager - INFO - 'simple-lama' batch of 4 processed in 2.184s (avg: 0.546s/image) +2025-08-30 01:57:51,986 - app.core.batch_manager - INFO - Successfully processed batch of 4 jobs. +INFO: 127.0.0.1:47580 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +INFO: 127.0.0.1:47590 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +INFO: 127.0.0.1:47604 - "POST /api/v1/inpaint HTTP/1.1" 200 OK +INFO: 127.0.0.1:47608 - "POST /api/v1/inpaint HTTP/1.1" 200 OK diff --git a/logs/main_server.pid b/logs/main_server.pid index 1af8a87..8dbe7cc 100644 --- a/logs/main_server.pid +++ b/logs/main_server.pid @@ -1 +1 @@ -56165 +77869 diff --git a/logs/monitoring.log b/logs/monitoring.log index 87a845a..8651aa9 100644 --- a/logs/monitoring.log +++ b/logs/monitoring.log @@ -1,9 +1,9 @@ -INFO: Started server process [56411] +INFO: Started server process [78184] INFO: Waiting for application startup. Fan control not available INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:8888 (Press CTRL+C to quit) -INFO: 127.0.0.1:43630 - "GET /api/simple HTTP/1.1" 200 OK +INFO: 127.0.0.1:52490 - "GET /api/simple HTTP/1.1" 200 OK Task exception was never retrieved future: exception=AttributeError("module 'asyncio' has no attribute 'to_thread'")> Traceback (most recent call last): diff --git a/logs/monitoring.pid b/logs/monitoring.pid index 41a7920..04d048b 100644 --- a/logs/monitoring.pid +++ b/logs/monitoring.pid @@ -1 +1 @@ -56411 +78184 diff --git a/main.py b/main.py index 0366122..9d6f0db 100644 --- a/main.py +++ b/main.py @@ -18,10 +18,14 @@ from app.core.worker_manager import worker_manager from app.core.session_pool import SessionPool, session_pool from app.api.endpoints import router from app.monitoring.dashboard import monitor_app +from app.core.batch_manager import batch_manager +# from app.utils.background_task import manage_state_background # TODO: 경로 확인 필요 +from app.utils.discord_notifier import send_discord_notification # 로깅 설정 import logging.handlers import os +import logging.config # 로그 디렉토리 생성 log_dir = "logs" @@ -202,8 +206,9 @@ async def save_status_periodically(): @asynccontextmanager async def lifespan(app: FastAPI): """애플리케이션 생명주기 관리""" - # 시작 시 + # 서버 시작 시 logger.info("🚀 인페인팅 서버 시작 중...") + app.state.start_time = time.time() # settings 대신 app.state에 저장 # app.state에 공유 객체 저장 app.state.worker_manager = worker_manager @@ -226,7 +231,15 @@ async def lifespan(app: FastAPI): await worker_manager.start() logger.info("✅ 워커 매니저 시작 완료") + if settings.USE_MICRO_BATCHING: + await batch_manager.start() + logger.info("✅ 배치 관리자 시작 완료") + + # app.state.background_task = asyncio.create_task(manage_state_background(app.state)) + # logger.info("✅ 상태 저장 백그라운드 작업 생성 완료") + logger.info("🎉 인페인팅 서버 시작 완료!") + send_discord_notification("✅ 서버가 성공적으로 시작되었습니다.", level="success") except Exception as e: logger.error(f"❌ 서버 시작 실패: {e}") @@ -234,7 +247,7 @@ async def lifespan(app: FastAPI): yield - # 종료 시 + # 서버 종료 시 logger.info("🛑 인페인팅 서버 종료 중...") # 상태 저장 백그라운드 작업 취소 @@ -245,7 +258,19 @@ async def lifespan(app: FastAPI): await worker_manager.stop() logger.info("✅ 워커 매니저 중지 완료") + if settings.USE_MICRO_BATCHING: + await batch_manager.stop() + logger.info("✅ 배치 관리자 중지 완료") + + # if app.state.background_task: + # app.state.background_task.cancel() + # try: + # await app.state.background_task + # except asyncio.CancelledError: + # logger.info("상태 저장 백그라운드 작업이 정상적으로 취소되었습니다.") + logger.info("👋 인페인팅 서버 종료 완료") + send_discord_notification("👋 서버가 종료되었습니다.", level="info") except Exception as e: logger.error(f"❌ 서버 종료 중 오류: {e}") @@ -253,9 +278,8 @@ async def lifespan(app: FastAPI): # 메인 애플리케이션 생성 app = FastAPI( - title="인페인팅 서버", - description="Simple LAMA, MIGAN, REMBG를 활용한 병렬 처리 인페인팅 서버 (iopaint 호환)", - version="1.0.0", + title=settings.APP_NAME, + version=settings.APP_VERSION, lifespan=lifespan ) diff --git a/status.json b/status.json index 4222a80..2a15146 100644 --- a/status.json +++ b/status.json @@ -6,70 +6,70 @@ "workers_by_status": { "idle": [ { - "id": "worker_fcfdab20", + "id": "worker_1daac568", "status": "idle", "task_count": 0, "error_count": 0, "last_task_at": null }, { - "id": "worker_07900527", + "id": "worker_c66b7d6b", "status": "idle", "task_count": 0, "error_count": 0, "last_task_at": null }, { - "id": "worker_fa21a361", + "id": "worker_cefffbad", "status": "idle", "task_count": 0, "error_count": 0, "last_task_at": null }, { - "id": "worker_aa0517fd", + "id": "worker_009a14df", "status": "idle", "task_count": 0, "error_count": 0, "last_task_at": null }, { - "id": "worker_f6949bff", + "id": "worker_335c1fa5", "status": "idle", "task_count": 0, "error_count": 0, "last_task_at": null }, { - "id": "worker_2dc147eb", + "id": "worker_2767d405", "status": "idle", "task_count": 0, "error_count": 0, "last_task_at": null }, { - "id": "worker_20ae03ff", + "id": "worker_8ec98a8f", "status": "idle", "task_count": 0, "error_count": 0, "last_task_at": null }, { - "id": "worker_ed0f495e", + "id": "worker_1c42e06e", "status": "idle", "task_count": 0, "error_count": 0, "last_task_at": null }, { - "id": "worker_06d35af9", + "id": "worker_3124fda8", "status": "idle", "task_count": 0, "error_count": 0, "last_task_at": null }, { - "id": "worker_325beb67", + "id": "worker_074f5bdb", "status": "idle", "task_count": 0, "error_count": 0, @@ -106,30 +106,38 @@ } }, "api_stats": { - "total_requests": 2, - "successful_requests": 2, + "total_requests": 26, + "successful_requests": 26, "failed_requests": 0, "success_rate": 100.0, "endpoint_usage": { - "GET /api/v1/health": 2 + "GET /api/v1/health": 2, + "POST /api/v1/inpaint": 24 }, "endpoint_stats": { "GET /api/v1/health": { "count": 2, - "avg_time": 0.0017114877700805664, - "min_time": 0.0015041828155517578, - "max_time": 0.001918792724609375, + "avg_time": 0.0014368295669555664, + "min_time": 0.0011837482452392578, + "max_time": 0.001689910888671875, + "current_concurrent": 0 + }, + "POST /api/v1/inpaint": { + "count": 24, + "avg_time": 8.082906911770502, + "min_time": 2.5534043312072754, + "max_time": 25.198312282562256, "current_concurrent": 0 } }, - "average_response_time": 0.0017114877700805664, - "min_response_time": 0.0015041828155517578, - "max_response_time": 0.001918792724609375, + "average_response_time": 7.461255366985615, + "min_response_time": 0.0011837482452392578, + "max_response_time": 25.198312282562256, "current_concurrent": 0, - "max_concurrent": 1, - "requests_per_second": 0.001614421372065027, - "uptime": 1238.8339467048645, + "max_concurrent": 8, + "requests_per_second": 0.1387551056852149, + "uptime": 187.38049221038818, "recent_errors": [] }, - "timestamp": 1756480032.9159214 + "timestamp": 1756486697.262446 } \ No newline at end of file diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..a50c4bb --- /dev/null +++ b/web/index.html @@ -0,0 +1,260 @@ + + + + + + Inpaint Server 모니터링 대시보드 + + + + +
+
+

🎨 Inpaint Server 대시보드

+
확인 중...
+
+
+
+

시스템 정보

+
+
OS: N/A
+
Python: N/A
+
CPU 사용량: N/A
+
RAM 사용량: N/A
+
+
+
+

GPU 정보

+
GPU: N/A
+
드라이버: N/A
+
VRAM: N/A
+
사용량: N/A
+
+
0%
+
+
+
+

모델 로딩 통계 (ms)

+ +
+
+

모델 처리 시간 (ms)

+ +
+
+

API 응답 시간 (ms)

+ +
+
+
+

설정

+
+ + + +

+
+
+
+ + + + diff --git a/web/index.html.bak b/web/index.html.bak new file mode 100644 index 0000000..e69de29