Update app.py
Browse files
app.py
CHANGED
@@ -275,6 +275,7 @@ def infer(genre_txt_content, lyrics_txt_content, num_segments, max_new_tokens):
|
|
275 |
os.makedirs(output_dir, exist_ok=True)
|
276 |
empty_output_folder(output_dir)
|
277 |
|
|
|
278 |
command = [
|
279 |
"python", "infer.py",
|
280 |
"--stage1_model", model_path,
|
@@ -286,9 +287,7 @@ def infer(genre_txt_content, lyrics_txt_content, num_segments, max_new_tokens):
|
|
286 |
"--output_dir", output_dir,
|
287 |
"--cuda_idx", "0",
|
288 |
"--max_new_tokens", str(actual_max_tokens),
|
289 |
-
"--
|
290 |
-
"--use_bettertransformer", "True",
|
291 |
-
"--use_compile", "True"
|
292 |
]
|
293 |
|
294 |
env = os.environ.copy()
|
@@ -299,10 +298,16 @@ def infer(genre_txt_content, lyrics_txt_content, num_segments, max_new_tokens):
|
|
299 |
"PATH": f"/usr/local/cuda/bin:{env.get('PATH', '')}",
|
300 |
"LD_LIBRARY_PATH": f"/usr/local/cuda/lib64:{env.get('LD_LIBRARY_PATH', '')}",
|
301 |
"PYTORCH_CUDA_ALLOC_CONF": "max_split_size_mb:512",
|
302 |
-
"CUDA_LAUNCH_BLOCKING": "0"
|
303 |
-
"TORCH_DISTRIBUTED_DEBUG": "DETAIL"
|
304 |
})
|
305 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
process = subprocess.run(
|
307 |
command,
|
308 |
env=env,
|
|
|
275 |
os.makedirs(output_dir, exist_ok=True)
|
276 |
empty_output_folder(output_dir)
|
277 |
|
278 |
+
# ์์ ๋ command - ์ง์๋์ง ์๋ ์ธ์ ์ ๊ฑฐ
|
279 |
command = [
|
280 |
"python", "infer.py",
|
281 |
"--stage1_model", model_path,
|
|
|
287 |
"--output_dir", output_dir,
|
288 |
"--cuda_idx", "0",
|
289 |
"--max_new_tokens", str(actual_max_tokens),
|
290 |
+
"--disable_offload_model" # GPU ๋ฉ๋ชจ๋ฆฌ ์ต์ ํ๋ฅผ ์ํด ์ถ๊ฐ
|
|
|
|
|
291 |
]
|
292 |
|
293 |
env = os.environ.copy()
|
|
|
298 |
"PATH": f"/usr/local/cuda/bin:{env.get('PATH', '')}",
|
299 |
"LD_LIBRARY_PATH": f"/usr/local/cuda/lib64:{env.get('LD_LIBRARY_PATH', '')}",
|
300 |
"PYTORCH_CUDA_ALLOC_CONF": "max_split_size_mb:512",
|
301 |
+
"CUDA_LAUNCH_BLOCKING": "0"
|
|
|
302 |
})
|
303 |
|
304 |
+
# transformers ์บ์ ๋ง์ด๊ทธ๋ ์ด์
์ฒ๋ฆฌ
|
305 |
+
try:
|
306 |
+
from transformers.utils import move_cache
|
307 |
+
move_cache()
|
308 |
+
except Exception as e:
|
309 |
+
logging.warning(f"Cache migration warning (non-critical): {e}")
|
310 |
+
|
311 |
process = subprocess.run(
|
312 |
command,
|
313 |
env=env,
|