From 824eba005fdbf52bd31d8e19697f114227b41853 Mon Sep 17 00:00:00 2001 From: Kadir Nar Date: Fri, 5 Aug 2022 22:10:21 +0100 Subject: [PATCH] added cpu parameter support (#423) --- hubconf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hubconf.py b/hubconf.py index f8a8cbe940..50ff257e2a 100644 --- a/hubconf.py +++ b/hubconf.py @@ -65,7 +65,7 @@ def custom(path_or_model='path/to/model.pt', autoshape=True): Returns: pytorch model """ - model = torch.load(path_or_model) if isinstance(path_or_model, str) else path_or_model # load checkpoint + model = torch.load(path_or_model, map_location=torch.device('cpu')) if isinstance(path_or_model, str) else path_or_model # load checkpoint if isinstance(model, dict): model = model['ema' if model.get('ema') else 'model'] # load model