Skip to content

ValueError: the image you passed in is not of the correct dimensions #83

Open
@Aabie

Description

@Aabie

Hey i trying to train this model using my dataset, but i got this error in second step, how can i solve this problem?


ValueError Traceback (most recent call last)
Cell In[22], line 2
1 if name == "main":
----> 2 main()

Cell In[21], line 526
524 # Train the model!
525 accelerator.print("Starting training!")
--> 526 trainer.train()
528 # Clean up and wait for other processes to finish (loggers etc.)
529 if accelerator.is_main_process:

File e:\Tugas Akhir\muse2\muse_maskgit_pytorch\trainers\maskgit_trainer.py:165, in MaskGitTrainer.train(self)
160 text_embeds = t5_encode_text_from_encoded(
161 input_ids, attn_mask, self.model.transformer.t5, self.accelerator.device
162 )
164 with self.accelerator.accumulate(self.model), self.accelerator.autocast():
--> 165 loss = self.model(imgs, text_embeds=text_embeds)
166 self.accelerator.backward(loss)
167 if self.max_grad_norm is not None and self.accelerator.sync_gradients:

File e:\Anaconda3\Lib\site-packages\torch\nn\modules\module.py:1511, in Module._wrapped_call_impl(self, *args, **kwargs)
1509 return self._compiled_call_impl(*args, **kwargs) # type: ignore[misc]
1510 else:
-> 1511 return self._call_impl(*args, **kwargs)

File e:\Anaconda3\Lib\site-packages\torch\nn\modules\module.py:1520, in Module._call_impl(self, *args, **kwargs)
1515 # If we don't have any hooks, we want to skip the rest of the logic in
1516 # this function, and just call forward.
1517 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
1518 or _global_backward_pre_hooks or _global_backward_hooks
1519 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1520 return forward_call(*args, **kwargs)
1522 try:
1523 result = None

File e:\Anaconda3\Lib\site-packages\accelerate\utils\operations.py:825, in convert_outputs_to_fp32..forward(*args, **kwargs)
824 def forward(*args, **kwargs):
--> 825 return model_forward(*args, **kwargs)

File e:\Anaconda3\Lib\site-packages\accelerate\utils\operations.py:813, in ConvertOutputsToFp32.call(self, *args, **kwargs)
812 def call(self, *args, **kwargs):
--> 813 return convert_to_fp32(self.model_forward(*args, **kwargs))

File e:\Anaconda3\Lib\site-packages\torch\amp\autocast_mode.py:16, in autocast_decorator..decorate_autocast(*args, **kwargs)
13 @functools.wraps(func)
14 def decorate_autocast(*args, **kwargs):
15 with autocast_instance:
---> 16 return func(*args, **kwargs)

File <@beartype(muse_maskgit_pytorch.muse_maskgit_pytorch.MaskGit.forward) at 0x207570d2ac0>:134, in forward(__beartype_object_2230262900624, __beartype_get_violation, __beartype_conf, __beartype_object_2230548286144, __beartype_object_140704628379520, __beartype_getrandbits, __beartype_func, *args, **kwargs)

File e:\Tugas Akhir\muse2\muse_maskgit_pytorch\muse_maskgit_pytorch.py:640, in MaskGit.forward(self, images_or_ids, ignore_index, cond_images, cond_token_ids, texts, text_embeds, cond_drop_prob, train_only_generator, sample_temperature)
638 if not all([height_or_width == self.image_size for height_or_width in images_or_ids.shape[-2:]]):
639 print(images_or_ids.shape[-2:])
--> 640 raise ValueError("the image you passed in is not of the correct dimensions")
642 with torch.no_grad():
643 _, ids, _ = self.vae.encode(images_or_ids)

ValueError: the image you passed in is not of the correct dimensions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions