facexlib
facexlib copied to clipboard
recognition/__init__.py from 'cuda' to device parameter
Can you change this line only so we can use CPU or GPU.
FROM: model = Backbone(num_layers=50, drop_ratio=0.6, mode='ir_se').to('cuda').eval()
TO: model = Backbone(num_layers=50, drop_ratio=0.6, mode='ir_se').to(device).eval()
Hello reader! Just in case you reached this place trying to fix this locally, change these two lines in init_recognition_model:
- model = Backbone(num_layers=50, drop_ratio=0.6, mode='ir_se').to('cuda').eval()
+ model = Backbone(num_layers=50, drop_ratio=0.6, mode='ir_se').to(device).eval()
And here, unspecified:
- model.load_state_dict(torch.load(model_path), strict=True)
+ model.load_state_dict(torch.load(model_path, map_location=device), strict=True)