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

How can I call use a pretrained model to generate a prediction on an image? #4

Closed
texturejc opened this issue May 1, 2021 · 1 comment

Comments

@texturejc
Copy link

texturejc commented May 1, 2021

Thanks for making this code available. Apologies if I am merely ignorant about Pytorch here, but I have a question about the pretrained models that are available for download. I'd like to use these to generate text on unseen images. To do this, I downloaded the the SAT-Speaker-with-emotion-grounding (431MB) model from the repo. However, I don't seem to be able to load it. When I download the model and run the script below, I get a dictionary and not the model.

Loading the model:

model_emo = torch_load_model('best_model.pt', map_location=torch.device('cpu'))

Running the model

model_emo(image)

The error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-12-e80ccbe8b6ed> in <module>
----> 1 model_emo(image)

TypeError: 'dict' object is not callable

Now, the PyTorch docs say that I should instantiate the model class and then load the checkpoint data. However, I don't know what model class this belongs to, and the README doesn't say. Do you have any advice on how to proceed with this issue? Thanks.

@pentium10
Copy link

@texturejc whats the best way to connect with you outside of github?

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