cpu to device select
This commit is contained in:
Binary file not shown.
@ -76,8 +76,8 @@ class Config:
|
|||||||
lr_decay = 0.95 # 0.98
|
lr_decay = 0.95 # 0.98
|
||||||
weight_decay = 5e-4
|
weight_decay = 5e-4
|
||||||
loss = 'cross_entropy' # ['focal_loss', 'cross_entropy']
|
loss = 'cross_entropy' # ['focal_loss', 'cross_entropy']
|
||||||
device = torch.device('cuda:1' if torch.cuda.is_available() else 'cpu')
|
# device = torch.device('cuda:1' if torch.cuda.is_available() else 'cpu')
|
||||||
# device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
|
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
|
||||||
|
|
||||||
pin_memory = True # if memory is large, set it True to speed up a bit
|
pin_memory = True # if memory is large, set it True to speed up a bit
|
||||||
num_workers = 4 # dataloader
|
num_workers = 4 # dataloader
|
||||||
|
Binary file not shown.
@ -76,7 +76,7 @@ def attempt_load(weights, device=None, inplace=True, fuse=True):
|
|||||||
|
|
||||||
model = Ensemble()
|
model = Ensemble()
|
||||||
for w in weights if isinstance(weights, list) else [weights]:
|
for w in weights if isinstance(weights, list) else [weights]:
|
||||||
ckpt = torch.load(attempt_download(w), map_location='cpu') # load
|
ckpt = torch.load(attempt_download(w), map_location=device) # load
|
||||||
ckpt = (ckpt.get('ema') or ckpt['model']).to(device).float() # FP32 model
|
ckpt = (ckpt.get('ema') or ckpt['model']).to(device).float() # FP32 model
|
||||||
|
|
||||||
# Model compatibility updates
|
# Model compatibility updates
|
||||||
|
Reference in New Issue
Block a user