Spaces:
Sleeping
Sleeping
mkaraki
commited on
Commit
·
2d200d3
1
Parent(s):
d406a66
Change code for huggingface
Browse files
app.py
CHANGED
@@ -38,7 +38,7 @@ beta1 = 0.5
|
|
38 |
ngpu = 0
|
39 |
|
40 |
|
41 |
-
device = torch.device("cuda:0" if (torch.cuda.is_available()
|
42 |
|
43 |
|
44 |
# custom weights initialization called on netG and netD
|
@@ -86,7 +86,7 @@ class Generator(nn.Module):
|
|
86 |
netG = Generator(ngpu).to(device)
|
87 |
|
88 |
# Handle multi-gpu if desired
|
89 |
-
if (device.type == 'cuda')
|
90 |
netG = nn.DataParallel(netG, list(range(ngpu)))
|
91 |
|
92 |
# Apply the weights_init function to randomly initialize all weights
|
|
|
38 |
ngpu = 0
|
39 |
|
40 |
|
41 |
+
device = torch.device("cuda:0" if (ngpu > 0 and torch.cuda.is_available()) else "cpu")
|
42 |
|
43 |
|
44 |
# custom weights initialization called on netG and netD
|
|
|
86 |
netG = Generator(ngpu).to(device)
|
87 |
|
88 |
# Handle multi-gpu if desired
|
89 |
+
if (ngpu > 1) and (device.type == 'cuda'):
|
90 |
netG = nn.DataParallel(netG, list(range(ngpu)))
|
91 |
|
92 |
# Apply the weights_init function to randomly initialize all weights
|