Download code/testgpu.py from unknownBrain/survivalanalysis_checkpointing: direct link, hf CLI and curl.
- Browser
- Download file 508 Bytes
-
https://huggingface.co/datasets/unknownBrain/survivalanalysis_checkpointing/resolve/main/code/testgpu.py
- Command line
-
hf download hf://datasets/unknownBrain/survivalanalysis_checkpointing/code/testgpu.py
-
curl -L -o testgpu.py https://huggingface.co/datasets/unknownBrain/survivalanalysis_checkpointing/resolve/main/code/testgpu.py
508 Bytes
| # test_gpu.py | |
| import torch | |
| print(f"PyTorch version: {torch.__version__}") | |
| print(f"CUDA available: {torch.cuda.is_available()}") | |
| if torch.cuda.is_available(): | |
| print(f"GPU: {torch.cuda.get_device_name(0)}") | |
| print(f"GPU Memory: {torch.cuda.get_device_properties(0).total_memory / 1024**3:.2f} GB") | |
| x = torch.randn(3, 3, 160, 192, 160).cuda() | |
| print(f"Tensor on GPU: {x.device}") | |
| del x | |
| torch.cuda.empty_cache() | |
| print("✅ CUDA is working!") | |
| else: | |
| print("❌ CUDA is NOT available") |