Spaces:
Runtime error
Runtime error
Download test/test_torch_utils.py from fluxdev/stable-diffusion-webui-forge: direct link, hf CLI and curl.
- Browser
- Download file 473 Bytes
-
https://huggingface.co/spaces/fluxdev/stable-diffusion-webui-forge/resolve/main/test/test_torch_utils.py
- Command line
-
hf download hf://spaces/fluxdev/stable-diffusion-webui-forge/test/test_torch_utils.py
-
curl -L -o test_torch_utils.py https://huggingface.co/spaces/fluxdev/stable-diffusion-webui-forge/resolve/main/test/test_torch_utils.py
473 Bytes
| import types | |
| import pytest | |
| import torch | |
| from modules import torch_utils | |
| def test_get_param(wrapped): | |
| mod = torch.nn.Linear(1, 1) | |
| cpu = torch.device("cpu") | |
| mod.to(dtype=torch.float16, device=cpu) | |
| if wrapped: | |
| # more or less how spandrel wraps a thing | |
| mod = types.SimpleNamespace(model=mod) | |
| p = torch_utils.get_param(mod) | |
| assert p.dtype == torch.float16 | |
| assert p.device == cpu | |