Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
[FIX] Move labels to logits device in cross-entropy loss for multi-GPU support (#4041) (#4059)
anonymous devba1688c609e7
diff --git a/unsloth/kernels/cross_entropy_loss.py b/unsloth/kernels/cross_entropy_loss.pyindex fbb14013ff6..cdd5b1cf12c 100644--- a/unsloth/kernels/cross_entropy_loss.py+++ b/unsloth/kernels/cross_entropy_loss.py@@ -301,6 +301,7 @@ class Fast_CrossEntropyLoss(torch.autograd.Function):vocab_size: intn_rows, vocab_size = logits.shapedevice = logits.device+ labels = labels.to(device)div, mod = divmod(vocab_size, MAX_FUSED_SIZE)n_chunks: int = div + (mod != 0)