I am trying to run a github deep learning repository in Colab but I can not connect the python files to colab GPU.
I can connect to GPU when writing a script in the colab notebook e.g. when I run this cod from a notebook cell :
import os, torch
print('Torch', torch.__version__, 'CUDA', torch.version.cuda)
print('Device:', torch.device('cuda:0'))
print(torch.cuda.is_available())
I get:
Torch 1.4.0 CUDA 10.1
Device: cuda:0
True
but when I run it from a file called myExample.py e.g. using
!python myExample.py
I get:
Torch 1.4.0 CUDA 10.1
Device: cuda:0
False
Is there any solution to this?