Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sdm/models/base/icl.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ def fit(
)

if x.is_cuda and len(contexts) > 1:
# Keep class labels on GPU for compiled prediction.
classes = batch_cache.pop("classes")
try: # Copy to pinned CPU memory:
batch_cache = batch_cache._apply_tensor(
lambda tensor: torch.ops.aten._to_copy.default(
Expand All @@ -345,6 +347,7 @@ def fit(
)
)
finally:
batch_cache["classes"] = classes
torch.cuda.current_stream(x.device).synchronize()

cache[i] = batch_cache
Expand Down
Loading