Download code/tests/conftest.py from hello-test1/PhotonTTS: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/hello-test1/PhotonTTS/resolve/main/code/tests/conftest.py
- Command line
-
hf download hf://hello-test1/PhotonTTS/code/tests/conftest.py
-
curl -L -o conftest.py https://huggingface.co/hello-test1/PhotonTTS/resolve/main/code/tests/conftest.py
1.15 kB
| 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) | |
| def device(): | |
| return "cuda" if torch.cuda.is_available() else "cpu" | |
| 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}, | |
| }) | |