feat: 이벤트 로깅 시스템 추가 및 주요 컴포넌트 로깅 통합
This commit is contained in:
@@ -3,6 +3,7 @@ import json
|
||||
from typing import Tuple, Optional
|
||||
from transformers import AutoTokenizer
|
||||
from huggingface_hub import snapshot_download
|
||||
from event_logger import get_logger
|
||||
|
||||
def download_model(config_path: str = './config.json') -> Tuple[Optional[object], Optional[AutoTokenizer]]:
|
||||
"""
|
||||
@@ -22,6 +23,9 @@ def download_model(config_path: str = './config.json') -> Tuple[Optional[object]
|
||||
|
||||
os.makedirs(local_path, exist_ok=True)
|
||||
print(f"모델 {model_name}을 {local_path}에 다운로드 중...")
|
||||
logger = get_logger()
|
||||
if logger:
|
||||
logger.log_event("model_download_start", model=model_name, path=local_path)
|
||||
|
||||
try:
|
||||
# 인증 토큰(필요 시) 지원: 환경변수 HF_TOKEN 사용
|
||||
@@ -45,9 +49,13 @@ def download_model(config_path: str = './config.json') -> Tuple[Optional[object]
|
||||
print("토크나이저 확인 실패(계속 진행): 로컬 경로에 tokenizer 파일이 없을 수 있습니다.")
|
||||
|
||||
print(f"모델 다운로드 완료: {local_path}")
|
||||
if logger:
|
||||
logger.log_event("model_download_done", path=local_path)
|
||||
return None, tokenizer
|
||||
except Exception as e:
|
||||
print(f"모델 다운로드 실패: {e}")
|
||||
if logger:
|
||||
logger.log_event("model_download_error", error=str(e))
|
||||
return None, None
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user