Spaces:
Running
Running
Download flare/utils/debug.py from HassounLab/FLARE: direct link, hf CLI and curl.
- Browser
- Download file 427 Bytes
-
https://huggingface.co/spaces/HassounLab/FLARE/resolve/2afdf25f03e21d82b94de7e6138c7af3a1f44e5d/flare/utils/debug.py
- Command line
-
hf download hf://spaces/HassounLab/FLARE@2afdf25f03e21d82b94de7e6138c7af3a1f44e5d/flare/utils/debug.py
-
curl -L -o debug.py https://huggingface.co/spaces/HassounLab/FLARE/resolve/2afdf25f03e21d82b94de7e6138c7af3a1f44e5d/flare/utils/debug.py
427 Bytes
| import torch | |
| def nan_hook(self,inp, output): | |
| nan_mask = torch.isnan(output) | |
| if nan_mask.any(): | |
| print("In", self.__class__.__name__) | |
| raise RuntimeError(f"Found NAN in output at indices: ", nan_mask.nonzero()) | |
| inf_mask = torch.isinf(output) | |
| if inf_mask.any(): | |
| print("In", self.__class__.__name__) | |
| raise RuntimeError(f"Found INF in output at indices: ", inf_mask.nonzero()) |