Update README.md
Browse files
README.md
CHANGED
@@ -20,6 +20,29 @@ import matplotlib.pyplot as plt
|
|
20 |
import numpy as np
|
21 |
from torch import nn
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
path = hf_hub_download('huggan/ArtGAN', 'ArtGAN.pt')
|
24 |
model = torch.load(path, map_location=torch.device('cpu'))
|
25 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
|
|
20 |
import numpy as np
|
21 |
from torch import nn
|
22 |
|
23 |
+
class Generator(nn.Module):
|
24 |
+
def __init__(self):
|
25 |
+
super(Generator, self).__init__()
|
26 |
+
self.main = nn.Sequential(
|
27 |
+
nn.ConvTranspose2d(100, 64 * 8, 4, 1, 0, bias=False),
|
28 |
+
nn.BatchNorm2d(64 * 8),
|
29 |
+
nn.ReLU(True),
|
30 |
+
nn.ConvTranspose2d(64 * 8, 64 * 4, 4, 2, 1, bias=False),
|
31 |
+
nn.BatchNorm2d(64 * 4),
|
32 |
+
nn.ReLU(True),
|
33 |
+
nn.ConvTranspose2d(64 * 4, 64 * 2, 4, 2, 1, bias=False),
|
34 |
+
nn.BatchNorm2d(64 * 2),
|
35 |
+
nn.ReLU(True),
|
36 |
+
nn.ConvTranspose2d(64 * 2, 64, 4, 2, 1, bias=False),
|
37 |
+
nn.BatchNorm2d(64),
|
38 |
+
nn.ReLU(True),
|
39 |
+
nn.ConvTranspose2d(64, 3, 4, 2, 1, bias=False),
|
40 |
+
nn.Tanh()
|
41 |
+
)
|
42 |
+
|
43 |
+
def forward(self, input):
|
44 |
+
return self.main(input)
|
45 |
+
|
46 |
path = hf_hub_download('huggan/ArtGAN', 'ArtGAN.pt')
|
47 |
model = torch.load(path, map_location=torch.device('cpu'))
|
48 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|