File size: 1,100 Bytes
2ea2835
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""Centralized filesystem layout for Self-Forcing assets.

The pretrained Wan model weights and shared training checkpoints live outside
the repository (on the large data partition).  This module is the single
source of truth for those paths so callers do not have to hard-code them.

Both can be overridden with environment variables for portability:

* ``SELF_FORCING_MODELS_DIR``   (defaults to assets/)
* ``SELF_FORCING_CKPT_DIR``     (defaults to assets/)
"""

from __future__ import annotations

import os
from pathlib import Path

_ASSET_ROOT = Path(
    os.environ.get(
        "SELF_FORCING_ASSET_ROOT",
        "assets",
    )
)
MODELS_DIR = Path(os.environ.get("SELF_FORCING_MODELS_DIR", _ASSET_ROOT / "models"))
CKPT_DIR = Path(
    os.environ.get("SELF_FORCING_CKPT_DIR", _ASSET_ROOT / "checkpoints")
)


def model_path(name: str) -> Path:
    """Return the on-disk directory for a Wan-style pretrained model bundle."""
    return MODELS_DIR / name


def ckpt_path(*parts: str) -> Path:
    """Return a path under the shared checkpoint directory."""
    return CKPT_DIR.joinpath(*parts)