Download postprocessing/mmaudio/model/utils/sample_utils.py from Egnalkram/Wan2GP: direct link, hf CLI and curl.
- Browser
- Download file 373 Bytes
-
https://huggingface.co/spaces/Egnalkram/Wan2GP/resolve/main/postprocessing/mmaudio/model/utils/sample_utils.py
- Command line
-
hf download hf://spaces/Egnalkram/Wan2GP/postprocessing/mmaudio/model/utils/sample_utils.py
-
curl -L -o sample_utils.py https://huggingface.co/spaces/Egnalkram/Wan2GP/resolve/main/postprocessing/mmaudio/model/utils/sample_utils.py
373 Bytes
| from typing import Optional | |
| import torch | |
| def log_normal_sample(x: torch.Tensor, | |
| generator: Optional[torch.Generator] = None, | |
| m: float = 0.0, | |
| s: float = 1.0) -> torch.Tensor: | |
| bs = x.shape[0] | |
| s = torch.randn(bs, device=x.device, generator=generator) * s + m | |
| return torch.sigmoid(s) | |