Skip to main content
Post Closed as "Not suitable for this site" by fuwiak, Mark.F, Peter, Pedro Henrique Monforte, timleathart
added 119 characters in body
Source Link

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?

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?

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?

Source Link

Colab can not connect to GPU from a python file

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?