File size: 1,146 Bytes
7e2301f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
import sys

import pytest
import torch

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from photontts.config import config_from_dict  # noqa: E402


def pytest_collection_modifyitems(config, items):
    if not torch.cuda.is_available():
        skip = pytest.mark.skip(reason="needs CUDA")
        for it in items:
            if "gpu" in it.keywords:
                it.add_marker(skip)


@pytest.fixture
def device():
    return "cuda" if torch.cuda.is_available() else "cpu"


@pytest.fixture
def tiny_cfg():
    return config_from_dict({
        "name": "tiny",
        "tokenizer": "bytes",
        "patch": 2,
        "codec": {"enc_channels": [8, 16, 16, 32, 32], "dec_dim": 64, "dec_layers": 2},
        "backbone": {"pretrained": None, "hidden_size": 128, "num_layers": 2, "num_heads": 4,
                     "num_kv_heads": 2, "intermediate_size": 256, "attn_implementation": "sdpa"},
        "head": {"dim": 96, "layers": 2, "heads": 4, "noise_samples": 2, "p_uncond": 0.1},
        "speaker": {"n_tokens": 4, "dim": 64, "layers": 2, "heads": 4},
        "clock": {"frame_dim": 32},
    })