mirror of
https://github.com/WongKinYiu/yolov7.git
synced 2025-02-17 12:50:14 +08:00
added cpu parameter support (#423)
This commit is contained in:
parent
72a9c9628a
commit
1560034c77
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user