Commit ·
8d85e1f
1
Parent(s): 789dd08
Resolve run time errors
Browse files- dataset/__pycache__/celeba.cpython-310.pyc +0 -0
- dataset/celeba.py +7 -6
- models/__pycache__/blocks.cpython-310.pyc +0 -0
- models/__pycache__/discriminator.cpython-310.pyc +0 -0
- models/__pycache__/lpips.cpython-310.pyc +0 -0
- models/__pycache__/vqvae.cpython-310.pyc +0 -0
- models/blocks.py +1 -1
- train_vqvae.py +4 -3
dataset/__pycache__/celeba.cpython-310.pyc
CHANGED
|
Binary files a/dataset/__pycache__/celeba.cpython-310.pyc and b/dataset/__pycache__/celeba.cpython-310.pyc differ
|
|
|
dataset/celeba.py
CHANGED
|
@@ -40,9 +40,10 @@ def create_dataloader(parquet_dir, batch_size=32, shuffle=True, num_workers=4):
|
|
| 40 |
|
| 41 |
|
| 42 |
# Test the dataloader
|
| 43 |
-
dataloader = create_dataloader('dataset')
|
| 44 |
-
for i, batch in enumerate(dataloader):
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
| 40 |
|
| 41 |
|
| 42 |
# Test the dataloader
|
| 43 |
+
# dataloader = create_dataloader('dataset')
|
| 44 |
+
# for i, batch in enumerate(dataloader):
|
| 45 |
+
# for img_tensor in batch:
|
| 46 |
+
# if i == 0 :
|
| 47 |
+
# print(img_tensor)
|
| 48 |
+
# else:
|
| 49 |
+
# break
|
models/__pycache__/blocks.cpython-310.pyc
CHANGED
|
Binary files a/models/__pycache__/blocks.cpython-310.pyc and b/models/__pycache__/blocks.cpython-310.pyc differ
|
|
|
models/__pycache__/discriminator.cpython-310.pyc
CHANGED
|
Binary files a/models/__pycache__/discriminator.cpython-310.pyc and b/models/__pycache__/discriminator.cpython-310.pyc differ
|
|
|
models/__pycache__/lpips.cpython-310.pyc
CHANGED
|
Binary files a/models/__pycache__/lpips.cpython-310.pyc and b/models/__pycache__/lpips.cpython-310.pyc differ
|
|
|
models/__pycache__/vqvae.cpython-310.pyc
CHANGED
|
Binary files a/models/__pycache__/vqvae.cpython-310.pyc and b/models/__pycache__/vqvae.cpython-310.pyc differ
|
|
|
models/blocks.py
CHANGED
|
@@ -109,7 +109,7 @@ class DownBlock(nn.Module):
|
|
| 109 |
# Resnet Block
|
| 110 |
resnet_input = out
|
| 111 |
out = self.resnet_conv_first[i](out)
|
| 112 |
-
if self.
|
| 113 |
out = out + self.time_embd_layers[i](t_emb)[:, :, None, None]
|
| 114 |
out = self.resnet_conv_second[i](out)
|
| 115 |
out = out + self.residual_input_conv[i](resnet_input)
|
|
|
|
| 109 |
# Resnet Block
|
| 110 |
resnet_input = out
|
| 111 |
out = self.resnet_conv_first[i](out)
|
| 112 |
+
if self.t_emb_dim is not None:
|
| 113 |
out = out + self.time_embd_layers[i](t_emb)[:, :, None, None]
|
| 114 |
out = self.resnet_conv_second[i](out)
|
| 115 |
out = out + self.residual_input_conv[i](resnet_input)
|
train_vqvae.py
CHANGED
|
@@ -12,6 +12,7 @@ from dataset.celeba import create_dataloader
|
|
| 12 |
from torchvision.utils import make_grid
|
| 13 |
import yaml
|
| 14 |
import numpy as np
|
|
|
|
| 15 |
|
| 16 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 17 |
|
|
@@ -23,7 +24,6 @@ def train(args):
|
|
| 23 |
except yaml.YAMLError as e:
|
| 24 |
print(e)
|
| 25 |
|
| 26 |
-
print(config)
|
| 27 |
|
| 28 |
autoencoder_config = config["autoencoder_params"]
|
| 29 |
train_config = config["train_config"]
|
|
@@ -73,9 +73,10 @@ def train(args):
|
|
| 73 |
optimizer_d.zero_grad()
|
| 74 |
optimizer_g.zero_grad()
|
| 75 |
|
| 76 |
-
for
|
| 77 |
steps = 0
|
| 78 |
-
|
|
|
|
| 79 |
|
| 80 |
# Model output with losses
|
| 81 |
model_output = model(im_tensor)
|
|
|
|
| 12 |
from torchvision.utils import make_grid
|
| 13 |
import yaml
|
| 14 |
import numpy as np
|
| 15 |
+
from tqdm import tqdm
|
| 16 |
|
| 17 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 18 |
|
|
|
|
| 24 |
except yaml.YAMLError as e:
|
| 25 |
print(e)
|
| 26 |
|
|
|
|
| 27 |
|
| 28 |
autoencoder_config = config["autoencoder_params"]
|
| 29 |
train_config = config["train_config"]
|
|
|
|
| 73 |
optimizer_d.zero_grad()
|
| 74 |
optimizer_g.zero_grad()
|
| 75 |
|
| 76 |
+
for image in tqdm(data_loader):
|
| 77 |
steps = 0
|
| 78 |
+
print(type(image[0]))
|
| 79 |
+
im_tensor = image[0]
|
| 80 |
|
| 81 |
# Model output with losses
|
| 82 |
model_output = model(im_tensor)
|