Skip to content

Commit ca5d580

Browse files
Victor Bourginfacebook-github-bot
Victor Bourgin
authored andcommitted
Move SWA Model to AutoUnit.device
Summary: Update torchtnt auto_unit to use self.device for the EMA / SWA model, which may be set from environment in the superclass init. This enables model evaluation in GPU. Differential Revision: D64206735
1 parent b9e7c1f commit ca5d580

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torchtnt/framework/auto_unit.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ def __init__(
512512

513513
self.swa_model = AveragedModel(
514514
module_for_swa,
515-
device=device,
515+
device=self.device,
516516
use_buffers=swa_params.use_buffers,
517517
averaging_method=swa_params.averaging_method,
518518
ema_decay=swa_params.ema_decay,

0 commit comments

Comments
 (0)