IRIS0-SPAN icon indicating copy to clipboard operation
IRIS0-SPAN copied to clipboard

About trainer.py

Open johnny-lo opened this issue 3 years ago • 4 comments

Hi, I'm really interested in your work, especially the use of the Attention mechanism.

However, I run into two problems. First, I can't load the weights cause I only got one GPU

Second, when I try to use the trainer.py I can't find the file "COVERAGE_image_new.list" after I download the coverage dataset.

do I have to make it by myself, or it is on the internet.

Thanks.

johnny-lo avatar Aug 28 '21 22:08 johnny-lo

Hi Johnny,

To load data-parallel checkpoints on single GPU, you can try to make your model to be a dataparallel model first, load the model and change your model back. If your machine prohibit you from making you model into a dataparallel model with one GPU, try this code:

model = your model checkpoint = torch.load(your checkpoint) state_dict = checkpoint['state_dict']

for k in list(state_dict.keys()): if k.startswith('module.'): state_dict[k[len("module."):]] = state_dict[k] del state_dict[k]

log = model.load_state_dict(state_dict, strict=False) print(log.missing_keys)

I have attached the missing file also. Please let me know if you have further problems.

Sincerely, Xuefeng

On Aug 28, 2021, at 3:25 PM, johnny-lo @.***> wrote:

Hi, I'm really interested in your work, especially the use of the Attention mechanism.

However, I run into two problems. First, I can't load the weights cause I only got one GPU

Second, when I try to use the trainer.py I can't find the file "COVERAGE_image_new.list" after I download the coverage dataset.

do I have to make it by myself, or it is on the internet.

Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ZhiHanZ/IRIS0-SPAN/issues/8, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADI7BMD75KQLYNN2HXZYAO3T7FO55ANCNFSM5C7RQTLQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

michiganleon avatar Aug 29 '21 01:08 michiganleon

Hi, Thanks for answer my question so fast,

but the code you offer seems for Pytorch instead of TensorFlow.

I download the Github zip again, but I didn't find the missing file that you have attached.

Thanks for your helping again.

Sincerely, Johnny

johnny-lo avatar Aug 29 '21 12:08 johnny-lo

My bad. It has been a while and I forgot that was tf code. For tensorflow you can check this code: https://stackoverflow.com/questions/41342098/keras-load-checkpoint-weights-hdf5-generated-by-multiple-gpus https://stackoverflow.com/questions/41342098/keras-load-checkpoint-weights-hdf5-generated-by-multiple-gpus This is keras but I remember normal TF model can be loaded similarly. (Using model.layers[-2])

Sincerely, Xuefeng

On Aug 29, 2021, at 5:31 AM, johnny-lo @.***> wrote:

Hi, Thanks for answer my question so fast,

but the code you offer seems for Pytorch instead of TensorFlow.

I download the Github zip again, I didn't find the missing file that you have attached.

Thanks for your helping again.

Sincerely, Johnny

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ZhiHanZ/IRIS0-SPAN/issues/8#issuecomment-907784001, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADI7BMGOHYHC4H6ELL256KLT7ISAPANCNFSM5C7RQTLQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

michiganleon avatar Aug 29 '21 22:08 michiganleon

bug I have no idea why model.layers[-2] can work at his code but didn't work on evaluator.py

and I tried the other code from your link, seems I have to successfully load the weight first, then I can transform it into single GPU mode.

Sincerely, Johnny

johnny-lo avatar Aug 30 '21 21:08 johnny-lo