File size: 803 Bytes
1533f24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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