How to use a state_dict pth model to classify molecular image files?

Thank you Dwight: GOOD TRY!!!

I checked your proposal in my original code.
The problem is that the two underscores were already present in my code!!.
I do not know the reason why they were not copied into the web when I copy paste the originals. Also, I noticed that the three first lines were kept out of the code by the web. I did not modified any of that. Sorry but there must be another, yet unknown reason…

Furthermore, the original code (containing the 2 underscores you mention) is the same code that is employed during training and validation and it works perfectly well.
I will continue to search for some other reasons, it seems to be crazy.
I also checked for torch and pytorch been present in the environment, but they are there and as I said above, the training and validation made use of the same code sucessfully. Why it doesnt work here? what is the famous string argument 2 ? . I also though about something required but not been imported,but I cannot discovered what is it. I read and reread the torch nn documentation but nothing clear appeared.
The only code change that made the “song” disappear was to use “class: CNNModel1():” at the begining… :frowning:

This is really weird. I am not sure what the problem is because when I run it on my computer it runs fine. Maybe try copying your code and running it in colab to see if the issue persists there?

Sorry I coud not get anything clear on colab (I must said that I am unfamiliar with it). I tried the raw original models.py from the DEEPScreen program which was used for training and validation. Surprisingly when isolated from the program, the models.py also shows the same commentary on argument 2.bla, bla, bla…

I will check with the author of the program to see if he has some explanation.

Thank you for your time and dedication Dwight.
I will let you know if I can get it to work and find out where the bug is…

Your welcome sorry I couldn’t help with this error I have no idea what is causing the problem your code should work. Maybe create a new post about it and see if anyone can figure it out.

Dwight: I GOT IT !!!
I changed to a new computer very similar to the one I am using, but having anaconda/torch 1.5.0 instead of torch 1.7.0 !!!. I cannot totally explain why, nor wheter that was the problem, but it worked !!

With more time, I will try the script in other computers to track and understand the problem. I may also install torch 1.5.0 in this computer to see if it can fix it.
Still I have to feed the model with 500000 molecular images !!!.
Although already processed, still a long way to go…

THANK YOU VERY MUCH!!!
you gave me the key data when you told me that the script worked in your system.
After all, that was a GREAT HELP !. THANKS!!

1 Like

This seems to work, because print(model) prints out a large set of numbers and other values, which I presume are the values for the weights an biases.

I’m a beginner in deep learning. I’m trying to learn how to load images and generate predictions. How do I read the molecular images after loading the model? Also, how do I transform them? Please help.