File ~/i-Code/i-Code-V3/core/models/model_module_infer.py:143, in model_module.inference(self, xtype, condition, condition_types, n_samples, mix_weight, image_size, ddim_steps, scale, num_frames)
139 raise
140 shapes.append(shape)
--> 143 z, _ = sampler.sample(
144 steps=ddim_steps,
145 shape=shapes,
146 condition=conditioning,
147 unconditional_guidance_scale=scale,
148 xtype=xtype,
149 condition_types=condition_types,
150 eta=ddim_eta,
151 verbose=False,
152 mix_weight=mix_weight)
154 out_all = []
155 for i, xtype_i in enumerate(xtype):
File ~/anaconda/envs/CoDi/lib/python3.8/site-packages/torch/autograd/grad_mode.py:27, in _DecoratorContextManager.__call__.<locals>.decorate_context(*args, **kwargs)
24 @functools.wraps(func)
25 def decorate_context(*args, **kwargs):
26 with self.clone():
---> 27 return func(*args, **kwargs)
File ~/i-Code/i-Code-V3/core/models/ddim_vd.py:34, in DDIMSampler_VD.sample(self, steps, shape, xt, condition, unconditional_guidance_scale, xtype, condition_types, eta, temperature, mix_weight, noise_dropout, verbose, log_every_t)
32 self.make_schedule(ddim_num_steps=steps, ddim_eta=eta, verbose=verbose)
33 print(f'Data shape for DDIM sampling is {shape}, eta {eta}')
---> 34 samples, intermediates = self.ddim_sampling(
35 shape,
36 xt=xt,
37 condition=condition,
38 unconditional_guidance_scale=unconditional_guidance_scale,
39 xtype=xtype,
40 condition_types=condition_types,
41 ddim_use_original_steps=False,
42 noise_dropout=noise_dropout,
43 temperature=temperature,
44 log_every_t=log_every_t,
45 mix_weight=mix_weight,)
46 return samples, intermediates
File ~/anaconda/envs/CoDi/lib/python3.8/site-packages/torch/autograd/grad_mode.py:27, in _DecoratorContextManager.__call__.<locals>.decorate_context(*args, **kwargs)
24 @functools.wraps(func)
25 def decorate_context(*args, **kwargs):
26 with self.clone():
---> 27 return func(*args, **kwargs)
File ~/i-Code/i-Code-V3/core/models/ddim_vd.py:93, in DDIMSampler_VD.ddim_sampling(self, shape, xt, condition, unconditional_guidance_scale, xtype, condition_types, ddim_use_original_steps, timesteps, noise_dropout, temperature, mix_weight, log_every_t)
90 index = total_steps - i - 1
91 ts = torch.full((bs,), step, device=device, dtype=torch.long)
---> 93 outs = self.p_sample_ddim(
94 pred_xt,
95 condition,
96 ts, index,
97 unconditional_guidance_scale=unconditional_guidance_scale,
98 xtype=xtype,
99 condition_types=condition_types,
100 use_original_steps=ddim_use_original_steps,
101 noise_dropout=noise_dropout,
102 temperature=temperature,
103 mix_weight=mix_weight,)
104 pred_xt, pred_x0 = outs
106 if index % log_every_t == 0 or index == total_steps - 1:
File ~/anaconda/envs/CoDi/lib/python3.8/site-packages/torch/autograd/grad_mode.py:27, in _DecoratorContextManager.__call__.<locals>.decorate_context(*args, **kwargs)
24 @functools.wraps(func)
25 def decorate_context(*args, **kwargs):
26 with self.clone():
---> 27 return func(*args, **kwargs)
File ~/i-Code/i-Code-V3/core/models/ddim_vd.py:132, in DDIMSampler_VD.p_sample_ddim(self, x, condition, t, index, unconditional_guidance_scale, xtype, condition_types, repeat_noise, use_original_steps, noise_dropout, temperature, mix_weight)
129 x_in.append(torch.cat([x_i] * 2))
130 t_in = torch.cat([t] * 2)
--> 132 out = self.model.model.diffusion_model(
133 x_in, t_in, condition, xtype=xtype, condition_types=condition_types, mix_weight=mix_weight)
134 e_t = []
135 for out_i in out:
File ~/anaconda/envs/CoDi/lib/python3.8/site-packages/torch/nn/modules/module.py:1130, in Module._call_impl(self, *input, **kwargs)
1126 # If we don't have any hooks, we want to skip the rest of the logic in
1127 # this function, and just call forward.
1128 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1129 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1130 return forward_call(*input, **kwargs)
1131 # Do not call functions when jit is used
1132 full_backward_hooks, non_full_backward_hooks = [], []
File ~/i-Code/i-Code-V3/core/models/openaimodel.py:1109, in UNetModelVD.forward(self, x, timesteps, condition, xtype, condition_types, mix_weight)
1107 emb_image = self.unet_image.time_embed(t_emb)
1108 emb_text = self.unet_text.time_embed(t_emb)
-> 1109 emb_audio = self.unet_audio.time_embed(t_emb)
1111 for i in range(len(xtype)):
1112 if xtype[i] == 'text':
File ~/anaconda/envs/CoDi/lib/python3.8/site-packages/torch/nn/modules/module.py:1130, in Module._call_impl(self, *input, **kwargs)
1126 # If we don't have any hooks, we want to skip the rest of the logic in
1127 # this function, and just call forward.
1128 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1129 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1130 return forward_call(*input, **kwargs)
1131 # Do not call functions when jit is used
1132 full_backward_hooks, non_full_backward_hooks = [], []
File ~/anaconda/envs/CoDi/lib/python3.8/site-packages/torch/nn/modules/container.py:139, in Sequential.forward(self, input)
137 def forward(self, input):
138 for module in self:
--> 139 input = module(input)
140 return input
File ~/anaconda/envs/CoDi/lib/python3.8/site-packages/torch/nn/modules/module.py:1130, in Module._call_impl(self, *input, **kwargs)
1126 # If we don't have any hooks, we want to skip the rest of the logic in
1127 # this function, and just call forward.
1128 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1129 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1130 return forward_call(*input, **kwargs)
1131 # Do not call functions when jit is used
1132 full_backward_hooks, non_full_backward_hooks = [], []
File ~/anaconda/envs/CoDi/lib/python3.8/site-packages/torch/nn/modules/linear.py:114, in Linear.forward(self, input)
113 def forward(self, input: Tensor) -> Tensor:
--> 114 return F.linear(input, self.weight, self.bias)
RuntimeError: mat1 and mat2 shapes cannot be multiplied (2x320 and 192x768)
File ~/anaconda/envs/CoDi/lib/python3.8/site-packages/torch/nn/modules/module.py:1130, in Module._call_impl(self, *input, **kwargs)
1126 # If we don't have any hooks, we want to skip the rest of the logic in
1127 # this function, and just call forward.
1128 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1129 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1130 return forward_call(*input, **kwargs)
1131 # Do not call functions when jit is used
1132 full_backward_hooks, non_full_backward_hooks = [], []
File ~/anaconda/envs/CoDi/lib/python3.8/site-packages/torch/nn/modules/linear.py:114, in Linear.forward(self, input)
113 def forward(self, input: Tensor) -> Tensor:
--> 114 return F.linear(input, self.weight, self.bias)
RuntimeError: mat1 and mat2 shapes cannot be multiplied (8x320 and 192x768)
File ~/anaconda/envs/CoDi/lib/python3.8/site-packages/torch/nn/modules/linear.py:114, in Linear.forward(self, input)
113 def forward(self, input: Tensor) -> Tensor:
--> 114 return F.linear(input, self.weight, self.bias)
RuntimeError: mat1 and mat2 shapes cannot be multiplied (2x320 and 192x768)
And so on.
I use clean installation on A100 + 64GB RAM. No memory limitation was reached.