Download GeometryForcing/algorithms/dfot/backbones/modules/zero_module.py from BonanDing/worldmem-baseline-evals: direct link, hf CLI and curl.
- Browser
- Download file 264 Bytes
-
https://huggingface.co/BonanDing/worldmem-baseline-evals/resolve/main/GeometryForcing/algorithms/dfot/backbones/modules/zero_module.py
- Command line
-
hf download hf://BonanDing/worldmem-baseline-evals/GeometryForcing/algorithms/dfot/backbones/modules/zero_module.py
-
curl -L -o zero_module.py https://huggingface.co/BonanDing/worldmem-baseline-evals/resolve/main/GeometryForcing/algorithms/dfot/backbones/modules/zero_module.py
264 Bytes
| from torch import nn | |
| from einops import rearrange, parse_shape | |
| def zero_module(module: nn.Module) -> nn.Module: | |
| """ | |
| Zero out the parameters of a module and return it. | |
| """ | |
| for p in module.parameters(): | |
| p.detach().zero_() | |
| return module | |