davidnvq/grit

Some problems about load pretrain model

zml110120 opened this issue · 2 comments

Dear author @davidnvq ,
It is a perfect work! When i use it, there are some problems. How can i solve it? I use "detector_checkpoint_vg.pth" pretrain model. But some problems occur.
image

Could i change code of line 69?
before change:
detector=detector.module,
after change:
detector=detector.det_module,

Thank you for your interest. Indeed, I can't reproduce your error. The logic of detector.module is correct.

The reason why we use detector.module because I wrapped the detector with DDP (to make it compatible with previous training of detector on object detection) as follows.

detector = DDP(detector, device_ids=[gpu])

However, to simplify it, we can remove the above line and change detector=detector.

# detector = DDP(detector, device_ids=[gpu])
...
model = Transformer(
    grit_net,
    cap_generator,
    detector=detector, # .module,
    use_gri_feat=config.model.use_gri_feat,
    use_reg_feat=config.model.use_reg_feat,
    config=config,
)

FYI, the latest hydra version (1.2.0) has unexpected problems when training/evaluation although it is not related to the above bug. It saves the files in undesired locations.
If you don't want to install the new environment again, please downgrade the hydra version to make it run properly

conda activate grit
pip uninstall hydra-core
pip install hydra-core=1.1.0

# I make new commits to handle with hydra issues, please pull the project again (or clone the new code).
git pull origin main

Sorry for this inconvenience.