|
| 1 | +import os |
| 2 | +import sys |
| 3 | +import torch |
| 4 | +import torchvision |
| 5 | +import torchaudio |
| 6 | +import torch.nn as nn |
| 7 | +import torchaudio.compliance.kaldi # noqa: F401 |
| 8 | +import torchaudio.datasets # noqa: F401 |
| 9 | +import torchaudio.functional # noqa: F401 |
| 10 | +import torchaudio.models # noqa: F401 |
| 11 | +import torchaudio.pipelines # noqa: F401 |
| 12 | +import torchaudio.sox_effects # noqa: F401 |
| 13 | +import torchaudio.transforms # noqa: F401 |
| 14 | +import torchaudio.utils # noqa: F401 |
| 15 | +from torchaudio.io import StreamReader |
| 16 | +import torchvision.datasets as dset |
| 17 | +import torchvision.transforms |
| 18 | +cuda_version_expected = os.environ['CUDA_VER'] |
| 19 | +is_cuda_system = cuda_version_expected != "cpu" |
| 20 | +#todo add torch, torchvision and torchaudio tests |
| 21 | +print(f"torch: {torch.__version__}") |
| 22 | +print(f"torchvision: {torchvision.__version__}") |
| 23 | +print(f"torchaudio: {torchaudio.__version__}") |
| 24 | +print('Is torchvision useable?', all(x is not None for x in [torch.ops.image.decode_png, torch.ops.torchvision.roi_align])) |
| 25 | +if(not torch.cuda.is_available() and is_cuda_system): |
| 26 | + print(f"Expected CUDA {cuda_version_expected}. However CUDA is not loaded.") |
| 27 | + sys.exit(1) |
| 28 | +if(torch.cuda.is_available()): |
| 29 | + if(torch.version.cuda != cuda_version_expected): |
| 30 | + print(f"Wrong CUDA version. Loaded: {torch.version.cuda} Expected: {cuda_version_expected}") |
| 31 | + sys.exit(1) |
| 32 | + y=torch.randn([3,5]).cuda() |
| 33 | + print(torch.version.cuda) |
| 34 | + #todo add cudnn version validation |
| 35 | + print(torch.backends.cudnn.version()) |
0 commit comments