Skip to content

Commit e156cce

Browse files
ymoslemvince62s
authored andcommitted
Change map_location to be 'cpu' (#1461)
* Change map_location to be 'cpu' If you are on a CPU-only machine, it will give an error otherwise. Model averaging should not require a GPU; moreover, it may be faster to use CPU rather than move all models to the GPU to average them.
1 parent 4f0643f commit e156cce

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tools/average_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def average_models(model_files):
1010
avg_generator = None
1111

1212
for i, model_file in enumerate(model_files):
13-
m = torch.load(model_file)
13+
m = torch.load(model_file, map_location='cpu')
1414
model_weights = m['model']
1515
generator_weights = m['generator']
1616

0 commit comments

Comments
 (0)