moss4gb / conftest.py
AEUPH's picture
moss4gb v0.2.0: NF4 4-bit MOSS-Image-SFT packaging (code, bank, tests, docs, skill)
1533f24 verified
Raw History Blame Contribute Delete
803 Bytes
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parent
sys.path.insert(0, str(ROOT))
from moss4gb.paths import default_model_dir # noqa: E402
# Resolved, not relative: a versioned snapshot shares the weights instead of
# duplicating them, and the suite should still find them there.
MODEL_DIR = default_model_dir()
@pytest.fixture(scope="session")
def model_dir() -> Path:
if not (MODEL_DIR / "transformer" / "config.json").is_file():
pytest.skip("model files not downloaded")
return MODEL_DIR
@pytest.fixture(scope="session")
def has_dit(model_dir) -> Path:
shards = sorted((model_dir / "transformer").glob("diffusion_pytorch_model-*.safetensors"))
if not shards:
pytest.skip("DiT weights not downloaded")
return model_dir