Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -114,10 +114,11 @@ from huggingface_hub import snapshot_download
|
|
| 114 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)
|
| 115 |
print(f"[vLLM] Tokenizer loaded โ", flush=True)
|
| 116 |
|
| 117 |
-
# โโ ๋ชจ๋ธ ๋ค์ด๋ก๋
|
| 118 |
-
print(f"[vLLM] Downloading {MODEL_ID}...", flush=True)
|
| 119 |
-
MODEL_PATH = snapshot_download(MODEL_ID)
|
| 120 |
print(f"[vLLM] Downloaded โ {MODEL_PATH}", flush=True)
|
|
|
|
| 121 |
|
| 122 |
_config_path = os.path.join(MODEL_PATH, "config.json")
|
| 123 |
try:
|
|
@@ -160,9 +161,33 @@ try:
|
|
| 160 |
if _removed_keys:
|
| 161 |
print(f"[vLLM] Removed MM keys: {_removed_keys}", flush=True)
|
| 162 |
|
| 163 |
-
# 5.
|
| 164 |
-
|
| 165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
|
| 167 |
except Exception as e:
|
| 168 |
print(f"[vLLM] Config patch failed: {e} โ proceeding with original", flush=True)
|
|
|
|
| 114 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)
|
| 115 |
print(f"[vLLM] Tokenizer loaded โ", flush=True)
|
| 116 |
|
| 117 |
+
# โโ ๋ชจ๋ธ ๋ค์ด๋ก๋ (๋ก์ปฌ ๋ณต์ฌ, symlink ์๋ ์ค์ ํ์ผ) โโ
|
| 118 |
+
print(f"[vLLM] Downloading {MODEL_ID} to /app/model ...", flush=True)
|
| 119 |
+
MODEL_PATH = snapshot_download(MODEL_ID, local_dir="/app/model")
|
| 120 |
print(f"[vLLM] Downloaded โ {MODEL_PATH}", flush=True)
|
| 121 |
+
print(f"[vLLM] Files: {os.listdir(MODEL_PATH)[:15]}", flush=True)
|
| 122 |
|
| 123 |
_config_path = os.path.join(MODEL_PATH, "config.json")
|
| 124 |
try:
|
|
|
|
| 161 |
if _removed_keys:
|
| 162 |
print(f"[vLLM] Removed MM keys: {_removed_keys}", flush=True)
|
| 163 |
|
| 164 |
+
# 5. preprocessor_config.json ํจ์น โ video processor ์ฐธ์กฐ ์ ๊ฑฐ
|
| 165 |
+
_preproc_path = os.path.join(MODEL_PATH, "preprocessor_config.json")
|
| 166 |
+
if os.path.exists(_preproc_path):
|
| 167 |
+
try:
|
| 168 |
+
with open(_preproc_path) as f:
|
| 169 |
+
_preproc = json.load(f)
|
| 170 |
+
# video ๊ด๋ จ ํค ์ ๊ฑฐ
|
| 171 |
+
_video_keys = [k for k in _preproc if "video" in k.lower()]
|
| 172 |
+
for k in _video_keys:
|
| 173 |
+
del _preproc[k]
|
| 174 |
+
_removed_keys.append(f"preproc.{k}")
|
| 175 |
+
# processor_class๊ฐ ๋น๋์ค๋ฅผ ์ฐธ์กฐํ๋ฉด ์ ๊ฑฐ
|
| 176 |
+
if "processor_class" in _preproc:
|
| 177 |
+
_removed_keys.append(f"preproc.processor_class={_preproc['processor_class']}")
|
| 178 |
+
with open(_preproc_path, "w") as f:
|
| 179 |
+
json.dump(_preproc, f, indent=2)
|
| 180 |
+
print(f"[vLLM] preprocessor_config.json patched", flush=True)
|
| 181 |
+
except Exception as e:
|
| 182 |
+
print(f"[vLLM] preprocessor patch error: {e}", flush=True)
|
| 183 |
+
|
| 184 |
+
# video_preprocessor_config.json์ด ์์ผ๋ฉด ์ญ์ (์ด๊ฑด ํ์ ์์)
|
| 185 |
+
_vidproc = os.path.join(MODEL_PATH, "video_preprocessor_config.json")
|
| 186 |
+
if os.path.exists(_vidproc):
|
| 187 |
+
os.remove(_vidproc)
|
| 188 |
+
print(f"[vLLM] Removed video_preprocessor_config.json", flush=True)
|
| 189 |
+
|
| 190 |
+
print(f"[vLLM] Preprocessor files handled", flush=True)
|
| 191 |
|
| 192 |
except Exception as e:
|
| 193 |
print(f"[vLLM] Config patch failed: {e} โ proceeding with original", flush=True)
|