Spaces:
Running
Running
Download fish_speech/utils/context.py from pineconeT94/fishspeech: direct link, hf CLI and curl.
- Browser
- Download file 287 Bytes
-
https://huggingface.co/spaces/pineconeT94/fishspeech/resolve/main/fish_speech/utils/context.py
- Command line
-
hf download hf://spaces/pineconeT94/fishspeech/fish_speech/utils/context.py
-
curl -L -o context.py https://huggingface.co/spaces/pineconeT94/fishspeech/resolve/main/fish_speech/utils/context.py
287 Bytes
| from contextlib import nullcontext | |
| import torch | |
| def autocast_exclude_mps( | |
| device_type: str, dtype: torch.dtype | |
| ) -> nullcontext | torch.autocast: | |
| return ( | |
| nullcontext() | |
| if torch.backends.mps.is_available() | |
| else torch.autocast(device_type, dtype) | |
| ) | |