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

AttributeError: type object 'CTLModel' has no attribute '_load_model_state' #14

Open
real-wind opened this issue Jun 18, 2024 · 1 comment

Comments

@real-wind
Copy link

Thank you for the hardwork and sharing of your code, I have encountered some issues while attempting to replicate the results for the PRCC dataset with the CTL model.
I executed the inference script:
python /GEFF/Scripts/inference.py prcc CTL --reid_config /GEFF/ReIDModules/centroids_reid/configs/256_resnet50.yml --dataset_path /GEFF/datasets/prcc --device "cuda:0" --reid_checkpoint GEFF/checkpoints/CTL/dukemtmcreid_resnet50_256_128_epoch_120.ckpt --alpha 0.75 --detection_threshold 0.7
Actual Results:
Setting seed to: 0
Traceback (most recent call last):
File "/GEFF/Scripts/inference.py", line 472, in
main(args)
File "/GEFF/Scripts/inference.py", line 467, in main
run_inference(args, config=config)
File "/GEFF/Scripts/inference.py", line 399, in run_inference
qd_pids, qd_camids, qd_clothes_ids, g_pids, g_camids, g_clothes_ids = reid_inference_on_prcc(args, config)
File "/GEFF/Scripts/inference.py", line 184, in reid_inference_on_prcc
reid_model.init_model(config, args.reid_checkpoint)
File "/GEFF/./ReIDModules/CTL_model.py", line 17, in init_model
self.model = CTL._load_model_state(checkpoint)
AttributeError: type object 'CTLModel' has no attribute '_load_model_state'

I have double-checked the steps and parameters, but I still face difficulties .Any guidance on how to proceed or troubleshoot this issue would be greatly appreciated.

@darkushin
Copy link
Collaborator

Hi @real-wind,

The issue you encountered seems to be related to the environment and not an issue with the code itself (more specifically, the function that fails is the pytorch-lightning function _load_model_state as the original CTL model was built using pytorch-lightning).

Setting up the environment for CTL was quite challenging, therefore, we don't support it in the Colab notebook demo, and I would recommend using one of the other models we support (CAL/AIM).

If you still want to use the CTL model I would suggest to first try to run the model as described by the authors of the model (centroids-reid repo), and once you are able to use their model, try to modify the CTL init_model function in our repo so that it will be able to load the pre-trained checkpoint of the model.

Good luck!

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