Skip to content

Commit

Permalink
use map location to cpu when torch.load
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Feb 17, 2023
1 parent 0abb04d commit aaf0d2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions audiolm_pytorch/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def unwrapped_soundstream(self):
def load(self, path):
path = Path(path)
assert path.exists()
pkg = torch.load(str(path))
pkg = torch.load(str(path), map_location = 'cpu')

self.unwrapped_soundstream.load_state_dict(pkg['model'])

Expand Down Expand Up @@ -585,7 +585,7 @@ def save(self, path):
def load(self, path):
path = Path(path)
assert path.exists()
pkg = torch.load(str(path))
pkg = torch.load(str(path), map_location = 'cpu')

transformer = self.accelerator.unwrap_model(self.transformer)
transformer.load_state_dict(pkg['model'])
Expand Down Expand Up @@ -822,7 +822,7 @@ def save(self, path):
def load(self, path):
path = Path(path)
assert path.exists()
pkg = torch.load(str(path))
pkg = torch.load(str(path), map_location = 'cpu')

transformer = self.accelerator.unwrap_model(self.transformer)
transformer.load_state_dict(pkg['model'])
Expand Down Expand Up @@ -1054,7 +1054,7 @@ def save(self, path):
def load(self, path):
path = Path(path)
assert path.exists()
pkg = torch.load(str(path))
pkg = torch.load(str(path), map_location = 'cpu')

transformer = self.accelerator.unwrap_model(self.transformer)
transformer.load_state_dict(pkg['model'])
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name = 'audiolm-pytorch',
packages = find_packages(exclude=[]),
version = '0.14.0',
version = '0.14.1',
license='MIT',
description = 'AudioLM - Language Modeling Approach to Audio Generation from Google Research - Pytorch',
author = 'Phil Wang',
Expand Down

0 comments on commit aaf0d2d

Please sign in to comment.