Facing "RunTimeError" for Usage code
See original GitHub issueHello @lucidrains,
I have tried running the below code:
import torch
from imagen_pytorch import Unet, 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 = Imagen(
unets = (unet1, unet2),
image_sizes = (64, 256),
timesteps = 1000,
cond_drop_prob = 0.1
).cuda()
text_embeds = torch.randn(4, 256, 768).cuda()
text_masks = torch.ones(4, 256).bool().cuda()
images = torch.randn(4, 3, 256, 256).cuda()
for i in (1, 2):
loss = imagen(images, text_embeds = text_embeds, text_masks = text_masks, unet_number = i)
loss.backward()
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)
After executing the above code I am facing the below error :
RuntimeError: Expected weight to be a vector of size equal to the number of channels in input, but got weight of shape [256] and input of shape [4, 128, 8, 8]
I am getting this error for the below line:
loss = imagen(images, text_embeds = text_embeds, text_masks = text_masks, unet_number = i)
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Facing RUNTIME error SIGKILL in this code - Stack Overflow
The rules: rewrite small numbers from input to output. Stop processing input after reading in the number 42.
Read more >Switching to Pulsar backend - facing runtime error #466 - GitHub
To solve the problem, either use n_channels=3 when creating the renderer or use a 4D feature vector. :) ...
Read more >Runtime Error: What It Is and How to Fix It - Lifewire
Runtime errors prevent a program from working properly. Here's how to fix runtime errors caused my memory issues, unpatched bugs, and more.
Read more >Facing Run-time error '619' while running T code solar02 ...
Hi , To view TD's in SOLMAN using T code solar02, we are automating the procedure with VBA script. We are facing a...
Read more >Runtime Errors - GeeksforGeeks
A runtime error in a program is an error that occurs while the program is running after being successfully compiled.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks!
addresses https://github.com/lucidrains/imagen-pytorch/issues/86