Open whybfq opened 8 months ago
Is there a specific error you get when running MAT? Knowing what error your code is throwing should be able to help us track down what's wrong. On our side, both implementations appear to work.
Is there a specific error you get when running MAT? Knowing what error your code is throwing should be able to help us track down what's wrong. On our side, both implementations appear to work.
yes, of course. Sorry for not co clear in the beginning,
after I changed the model path and the other things the same,
model = ModelLoader(device).load_from_file(r"spandrel/tests/models/Places_512_FullData_G.pth")
there was an error like the following:
torch.Size([1, 3, 800, 800])
torch.Size([1, 1, 800, 800])
An error occurred: shape '[1, 12, 8, 12, 8, 180]' is invalid for input of size 1800000
Traceback (most recent call last):
File "/home/hangyi/Downloads/gaoqing/spandrel/interface.py", line 122, in <module>
main()
File "/home/hangyi/Downloads/gaoqing/spandrel/interface.py", line 105, in main
output = model(image_tensor, mask_tensor)
File "/home/hangyi/.local/lib/python3.10/site-packages/spandrel/__helpers/model_descriptor.py", line 342, in __call__
output = self._call_fn(self.model, image, mask)
File "/home/hangyi/.local/lib/python3.10/site-packages/spandrel/__helpers/model_descriptor.py", line 323, in <lambda>
self._call_fn = call_fn or (lambda model, image, mask: model(image, mask))
File "/home/hangyi/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/hangyi/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/home/hangyi/.local/lib/python3.10/site-packages/spandrel/architectures/MAT/arch/MAT.py", line 1607, in forward
output = self.model(
File "/home/hangyi/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/hangyi/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/home/hangyi/.local/lib/python3.10/site-packages/spandrel/architectures/MAT/arch/MAT.py", line 1583, in forward
img = self.synthesis(images_in, masks_in, ws, noise_mode=noise_mode)
File "/home/hangyi/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/hangyi/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/home/hangyi/.local/lib/python3.10/site-packages/spandrel/architectures/MAT/arch/MAT.py", line 1500, in forward
out_stg1 = self.first_stage(images_in, masks_in, ws, noise_mode=noise_mode)
File "/home/hangyi/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/hangyi/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
I think your mask tensor is the wrong shape but I'm not 100% sure. I can look into this more later
I think your mask tensor is the wrong shape but I'm not 100% sure. I can look into this more later
Thanks for your time.
I thik I know thre reason, for MAT, I need to pad or resize the image to make its size a multiple of 512.
Thanks for letting us know. Sorry I didn't end up looking more into it myself
@RunDevelopment we should confirm if that's the case and if so, set its size requirements accordingly
set its size requirements accordingly
It already is. The repo docs even say that it supports multiples of 512 (and not just exactly 512), so I have no idea why it doesn't work.
does the following way of using the MaskedImageModelDescriptor is true or not, it works for LAMA while not work for MAT, any suggestions? Thanks a lot.