Skip to content

Commit c1019e4

Browse files
committed
video output dir
1 parent cc5267e commit c1019e4

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

lmms_eval/models/chat/fastvideo.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@
2424
import re
2525
import shutil
2626
import tempfile
27+
import uuid
2728
import weakref
2829
from concurrent.futures import ThreadPoolExecutor
30+
from datetime import datetime
2931
from typing import Any, Dict, List, Optional, Tuple
3032

3133
import torch
@@ -70,9 +72,19 @@ def _safe(name: str, default: str = "x") -> str:
7072
return s[:128]
7173

7274

73-
def _default_output_dir() -> str:
74-
hf_home = os.path.expanduser(os.getenv("HF_HOME", "~/.cache/huggingface"))
75-
return os.path.join(hf_home, "lmms_eval", "generated_videos", "fastvideo")
75+
def _generate_run_id() -> str:
76+
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
77+
short_uuid = str(uuid.uuid4())[:8]
78+
return f"{timestamp}_{short_uuid}"
79+
80+
81+
def _model_slug(model_path: str) -> str:
82+
base = os.path.basename(str(model_path).rstrip("/"))
83+
return _SAFE_RE.sub("_", base).strip("_") or "model"
84+
85+
86+
def _default_output_dir(model_path: str) -> str:
87+
return os.path.join("./logs/fastvideo", _model_slug(model_path), _generate_run_id())
7688

7789

7890
_DTYPES = {
@@ -212,8 +224,9 @@ def __init__(
212224
self.seed = seed
213225
self.negative_prompt = negative_prompt
214226

215-
self.output_dir = os.path.abspath(os.path.expanduser(output_dir or _default_output_dir()))
227+
self.output_dir = os.path.abspath(os.path.expanduser(output_dir or _default_output_dir(self.model_path)))
216228
os.makedirs(self.output_dir, exist_ok=True)
229+
eval_logger.info(f"FastVideo output directory: {self.output_dir}")
217230
self._tmp_img_dir = tempfile.mkdtemp(prefix="fastvideo_inputs_")
218231

219232
self.batch_size_per_gpu = int(batch_size)

0 commit comments

Comments
 (0)