Mesmo com QLoRA, é possível o esgotamento de memória no Colab. Estratégias:
per_device_train_batch_sizeComece com 1 ou 2. Compense com gradient_accumulation_steps.
max_seq_lengthReduza de 512 para 256 ou 384 se o conteúdo permitir.
torch.compile (experimental)model = torch.compile(model)
Pode acelerar o treinamento e reduzir a memória, mas nem sempre é estável.
torch.cuda.empty_cache()
Útil após carregar o modelo ou entre experimentos.
CUDA out of memorygradient_accumulation_steps.max_seq_length.Some weights of the model checkpoint ... were not usedNormal se carregado com trust_remote_code=True ou usando PEFT. Não é crítico.
ValueError: Attempting to unscale FP16 gradients.Use optim="adamw_bnb_8bit" ou optim="paged_adamw_8bit" em TrainingArguments.
The model is not in eval modeIgnorar. Trainer lida com o modo automaticamente.