CLOUDYUL commited on
Commit
b5d9ecd
·
1 Parent(s): bb69e07

디버그: detector 폴더 내용 출력 추가

Browse files
Files changed (1) hide show
  1. server.py +22 -0
server.py CHANGED
@@ -20,6 +20,28 @@ class TextsIn(BaseModel):
20
  # ── 3) 모델 디렉터리 경로 (Space에서는 /app/detector 폴더가 된다)
21
  MODEL_DIR = "./detector"
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  # ── 4) 디바이스 설정 (Mac MPS 지원 여부 확인)
24
  device = "mps" if torch.backends.mps.is_available() else "cpu"
25
  print(f"▶ 모델 추론 디바이스: {device}")
 
20
  # ── 3) 모델 디렉터리 경로 (Space에서는 /app/detector 폴더가 된다)
21
  MODEL_DIR = "./detector"
22
 
23
+ # ─── 여기부터 디버그 코드 ───────────────────────────────────────────────────────
24
+ print("===== DETECTOR 디렉터리 내부 상태 =====")
25
+ for fname in sorted(os.listdir(MODEL_DIR)):
26
+ fpath = os.path.join(MODEL_DIR, fname)
27
+ try:
28
+ size = os.path.getsize(fpath)
29
+ except Exception:
30
+ size = None
31
+ preview = ""
32
+ # JSON 파일인 경우, 첫 줄만 읽어서 preview에 담아둡니다.
33
+ if fname.endswith(".json"):
34
+ try:
35
+ with open(fpath, "r", encoding="utf-8") as f:
36
+ preview = f.readline().strip()
37
+ except Exception:
38
+ preview = "<읽기 실패>"
39
+ print(f" • {fname:<25} size={size:<8} preview={preview[:60]!r}")
40
+ print("========================================\n")
41
+ # ─── 디버그 코드 끝 ─────────────────────────────────────────────────────────────
42
+
43
+ # (이제부터 실제 토크나이저 로드)
44
+
45
  # ── 4) 디바이스 설정 (Mac MPS 지원 여부 확인)
46
  device = "mps" if torch.backends.mps.is_available() else "cpu"
47
  print(f"▶ 모델 추론 디바이스: {device}")