Skip to content
Closed
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions unsloth/kernels/rope_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ def forward(ctx, Q, K, cos, sin, rope_indices):
_, n_heads_K, _, _ = K.shape

# Inplace rotary embedding is generally fine
Q_out = Q.clone() if not Q.is_contiguous else Q
K_out = K.clone() if not K.is_contiguous else K
Q_out = Q.contiguous()
K_out = K.contiguous()

if has_indices:
# TRL's rotary indices are always in int32, so casting is just for safety
Expand Down Expand Up @@ -395,8 +395,8 @@ def backward(ctx, dQ, dK):
)

# Inplace rotary embedding is generally fine
dQ_out = dQ.clone() if not dQ.is_contiguous else dQ
dK_out = dK.clone() if not dK.is_contiguous else dK
dQ_out = dQ.contiguous()
dK_out = dK.contiguous()

with torch_gpu_device(dQ.device):
_rope_embedding_QK[(batch * ctx.seq_len, ctx.n_heads_Q)](
Expand Down
1 change: 0 additions & 1 deletion unsloth/models/rl.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import inspect
import os
import re
import torch
from unsloth_zoo.compiler import create_new_function
from unsloth_zoo.log import logger
from unsloth_zoo.logging_utils import PatchRLStatistics
Expand Down
2 changes: 0 additions & 2 deletions unsloth/models/vision.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,9 @@
import os
import gc
import math
import functools
from typing import Optional, Tuple, List, Union
import re, inspect, sys
import contextlib
import types

try:
from huggingface_hub.utils import get_token
Expand Down