Spaces:
Running on Zero
Running on Zero
Download models/util.py from davideschiff1/StreamDiffusionV2-Realtime: direct link, hf CLI and curl.
- Browser
- Download file 448 Bytes
-
https://huggingface.co/spaces/davideschiff1/StreamDiffusionV2-Realtime/resolve/main/models/util.py
- Command line
-
hf download hf://spaces/davideschiff1/StreamDiffusionV2-Realtime/models/util.py
-
curl -L -o util.py https://huggingface.co/spaces/davideschiff1/StreamDiffusionV2-Realtime/resolve/main/models/util.py
448 Bytes
| """Small runtime helpers used by the offline and online inference entrypoints.""" | |
| import random | |
| import numpy as np | |
| import torch | |
| def set_seed(seed: int, deterministic: bool = False) -> None: | |
| """Seed Python, NumPy, and PyTorch for reproducible inference.""" | |
| random.seed(seed) | |
| np.random.seed(seed) | |
| torch.manual_seed(seed) | |
| torch.cuda.manual_seed_all(seed) | |
| if deterministic: | |
| torch.use_deterministic_algorithms(True) | |