Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A couple of issues in model_predictions from submission.py #105

Open
aaprasad opened this issue Jun 23, 2022 · 2 comments
Open

A couple of issues in model_predictions from submission.py #105

aaprasad opened this issue Jun 23, 2022 · 2 comments

Comments

@aaprasad
Copy link

aaprasad commented Jun 23, 2022

Hi, I was using your submission example notebook to generate my submission files and I came across a couple of errors that I tried resolving manually and just wanted to make sure these were the right solutions and see if you could update your code to account for them. Both issues came from the model_predictions function in sensorium/sensorium/utility/submission.py

The first was TypeError: model.forward got an unexpected keyword argument 'data_key' this came from line 29. I fixed this by simply removing the data_key=data_key, **batch_kwargs in the model() call. I think this came from your example model having these arguments in model.forward() but just wanted to check.

The second error was RuntimeError: Given groups=1, weight of size [64, 3, 11, 11], expected input[128, 1, 144, 256] to have 3 channels, but got 1 channels instead. I fixed this one by adding a images = torch.cat([images,images,images],dim=1) on line 20 to convert it to 3 channels. I think an easier solution would be to directly open the images as rgb in the dataloader or somehow generalize the input so it works for models trained with either grayscale or rgb.

Let me know if I messed up other things by doing this or if theres a better work around. Thanks!

@KonstantinWilleke
Copy link
Collaborator

Hi, thank your for raising these issues, and we'll look into it.

A quick question: Did these errors occur when you have used your own model? You are right that there assumptions baked into the model that we need to be spell out more explicitly.

And I agree, it would be best generalize the model's forward signature so that the data_key and the number of input channels are taken care of.

Your solutions do seem straightforward and correct. The first issue could also be solved by adding a **kwargs to the forward function, so it works with or without the data_key arg.

@aaprasad
Copy link
Author

Yeah I used my own model!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants