You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most likely user error but using the examples provided doesn't work
pip install imagen-pytorch
import torch
from imagen_pytorch import Unet, Imagen
# unet for imagen
unet1 = Unet(
dim = 32,
cond_dim = 512,
dim_mults = (1, 2, 4, 8),
num_resnet_blocks = 3,
layer_attns = (False, True, True, True),
layer_cross_attns = (False, True, True, True)
)
unet2 = Unet(
dim = 32,
cond_dim = 512,
dim_mults = (1, 2, 4, 8),
num_resnet_blocks = (2, 4, 8, 8),
layer_attns = (False, False, False, True),
layer_cross_attns = (False, False, False, True)
)
# imagen, which contains the unets above (base unet and super resoluting ones)
imagen = Imagen(
unets = (unet1, unet2),
image_sizes = (64, 256),
timesteps = 1000,
cond_drop_prob = 0.1
).cuda()
# mock images (get a lot of this) and text encodings from large T5
text_embeds = torch.randn(4, 256, 768).cuda()
images = torch.randn(4, 3, 256, 256).cuda()
# feed images into imagen, training each unet in the cascade
for i in (1, 2):
loss = imagen(images, text_embeds = text_embeds, unet_number = i)
loss.backward()
# do the above for many many many many steps
# now you can sample an image based on the text embeddings from the cascading ddpm
images = imagen.sample(texts = [
'a whale breaching from afar',
'young girl blowing out candles on her birthday cake',
'fireworks with blue and green sparkles'
], cond_scale = 3.)
images.shape # (3, 3, 256, 256)
The base dimension of your u-net should ideally be no smaller than 128, as recommended by a professional DDPM trainer https://nonint.com/2022/05/04/friends-dont-let-friends-train-small-diffusion-models/
Traceback (most recent call last):
File "test.py", line 26, in <module>
imagen = Imagen(
File "/home/user/.local/lib/python3.8/site-packages/imagen_pytorch/imagen_pytorch.py", line 1821, in __init__
assert not (exists(video_frames) and video_frames < 1), 'video frames must be at least 1 or greater'
NameError: name 'video_frames' is not defined
Trying to define the missing variable does nothing or returns the blow error depending where I put it
The base dimension of your u-net should ideally be no smaller than 128, as recommended by a professional DDPM trainer https://nonint.com/2022/05/04/friends-dont-let-friends-train-small-diffusion-models/
Traceback (most recent call last):
File "test.py", line 28, in <module>
imagen = Imagen(
TypeError: __init__() got an unexpected keyword argument 'video_frames'
I am not trying to generate videos so I have no idea why it is asking for this in the first place
The text was updated successfully, but these errors were encountered:
Most likely user error but using the examples provided doesn't work
Trying to define the missing variable does nothing or returns the blow error depending where I put it
I am not trying to generate videos so I have no idea why it is asking for this in the first place
The text was updated successfully, but these errors were encountered: