Skip to content

Commit

Permalink
Merge pull request #150 from ViCCo-Group/mem_leak_fix
Browse files Browse the repository at this point in the history
Memory leak fix when only extracting cls token
  • Loading branch information
LukasMut authored Aug 4, 2023
2 parents 39dd9d7 + 68ab922 commit 8a3a416
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion thingsvision/core/extraction/torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def _extract_batch(
act = self.activations[module_name]
if hasattr(self, "extract_cls_token"):
# we are only interested in the representations of the first token, i.e., [cls] token
act = act[:, 0, :]
act = act[:, 0, :].clone()
if flatten_acts:
if self.model_name.lower().startswith("clip"):
act = self.flatten_acts(act, batch, module_name)
Expand Down

0 comments on commit 8a3a416

Please sign in to comment.