Spaces:
Runtime error
Runtime error
Download trainscripts/textsliders/debug_util.py from baulab/ConceptSliders: direct link, hf CLI and curl.
- Browser
- Download file 556 Bytes
-
https://huggingface.co/spaces/baulab/ConceptSliders/resolve/refs%2Fpr%2F2/trainscripts/textsliders/debug_util.py
- Command line
-
hf download hf://spaces/baulab/ConceptSliders@refs/pr/2/trainscripts/textsliders/debug_util.py
-
curl -L -o debug_util.py https://huggingface.co/spaces/baulab/ConceptSliders/resolve/refs%2Fpr%2F2/trainscripts/textsliders/debug_util.py
556 Bytes
| # γγγγ°η¨... | |
| import torch | |
| def check_requires_grad(model: torch.nn.Module): | |
| for name, module in list(model.named_modules())[:5]: | |
| if len(list(module.parameters())) > 0: | |
| print(f"Module: {name}") | |
| for name, param in list(module.named_parameters())[:2]: | |
| print(f" Parameter: {name}, Requires Grad: {param.requires_grad}") | |
| def check_training_mode(model: torch.nn.Module): | |
| for name, module in list(model.named_modules())[:5]: | |
| print(f"Module: {name}, Training Mode: {module.training}") | |