Closed DerrickGuu closed 4 months ago
Thank you for helping me find this bug. I have uploaded a script in the Lesion-based-Contrastive-Learning repository that can be used to process your pre-trained model so it can be directly loaded in pytorch-classification.
Please find the script tools/model2weights.py
in the Lesion-based CL repository and run it with the following command:
python model2weights.py --pretrained-model [path/to/your/model] --output [path/to/new/file]
Then update the "checkpoint" item in ~/configs/eyepacs.yaml
with [path/to/new/file]
. Make sure to keep strict=False
in load_state_dict
.
Additionally, I have updated the method for saving pre-trained models in the Lesion-based CL repository. If you use the latest code, you won't need to run this script.
Thanks for solving this issue! It worked fine to me, and now the results from Lesion-based CL can be directly loaded!
%%%
%%%
Originally posted by @YijinHuang in https://github.com/YijinHuang/pytorch-classification/issues/10#issuecomment-2188984591
I still got the same attribute error after doing so. Are there any further detailed instructions about how can I train the classification model to evaluate the weights from Lesion-based-Contrastive-Learning? Or are there any other parts I have to modify in the script?
Thanks for the help!