Merge pull request #108 from akarazniewicz/device-model-mapping-for-CPU-inference

Mapping loaded, pretrained model to actual device.
This commit is contained in:
Baek JeongHun 2019-11-11 21:18:02 +09:00 committed by GitHub
commit 6593928855
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -30,7 +30,7 @@ def demo(opt):
# load model
print('loading pretrained model from %s' % opt.saved_model)
model.load_state_dict(torch.load(opt.saved_model))
model.load_state_dict(torch.load(opt.saved_model, map_location=device))
# prepare data. two demo images from https://github.com/bgshih/crnn#run-demo
AlignCollate_demo = AlignCollate(imgH=opt.imgH, imgW=opt.imgW, keep_ratio_with_pad=opt.PAD)

View File

@ -165,7 +165,7 @@ def test(opt):
# load model
print('loading pretrained model from %s' % opt.saved_model)
model.load_state_dict(torch.load(opt.saved_model))
model.load_state_dict(torch.load(opt.saved_model, map_location=device))
opt.experiment_name = '_'.join(opt.saved_model.split('/')[1:])
# print(model)