Skip to content

Commit

Permalink
specify torch.load weights_only
Browse files Browse the repository at this point in the history
  • Loading branch information
wwbrannon committed Sep 24, 2024
1 parent 17e1f0a commit 361291d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion images/sentiment-topic/topic-embeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def _combine_cached_values(self):
ids += [pd.read_csv(fname + '.csv')]

with open(fname + '.pt', 'rb') as obj:
embeds += [torch.load(obj, 'cpu')]
embeds += [torch.load(obj, 'cpu', weights_only=True)]
ids = pd.concat(ids, axis=0)
embeds = torch.cat(embeds, dim=0)

Expand Down
5 changes: 4 additions & 1 deletion images/sentiment-topic/topic-umap.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@

embeds_file = os.path.join(data_dir, 'comment-topics/sentence-embeds.pt')
with open(embeds_file, 'rb') as obj:
embeds = torch.load(obj, 'cpu').float().numpy()[train_mask, ...]
embeds = torch.load(obj, 'cpu', weights_only=True) \
.float() \
.numpy() \
[train_mask, ...]

params = {
'n_neighbors': 15,
Expand Down

0 comments on commit 361291d

Please sign in to comment.