I'm re-running the Supervised_Instruct_tuning_OpenLLaMA_... notebook on Colab Pro with A100 GPU. I got the following error during supervised_finetuning_trainer.train()
step (a quick Stack Overflow search suggests shape mismatch as the likely cause, but I did not change anything in the code):
You're using a LlamaTokenizerFast tokenizer. Please note that with a fast tokenizer, using the __call__
method is faster than using a method to encode the text followed by a call to the pad
method to get a padded encoding.
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ in <cell line: 1>:1 โ
โ โ
โ /usr/local/lib/python3.10/dist-packages/transformers/trainer.py:1696 in train โ
โ โ
โ 1693 โ โ inner_training_loop = find_executable_batch_size( โ
โ 1694 โ โ โ self._inner_training_loop, self._train_batch_size, args.auto_find_batch_size โ
โ 1695 โ โ ) โ
โ โฑ 1696 โ โ return inner_training_loop( โ
โ 1697 โ โ โ args=args, โ
โ 1698 โ โ โ resume_from_checkpoint=resume_from_checkpoint, โ
โ 1699 โ โ โ trial=trial, โ
โ โ
โ /usr/local/lib/python3.10/dist-packages/transformers/trainer.py:1973 in _inner_training_loop โ
โ โ
โ 1970 โ โ โ โ โ with model.no_sync(): โ
โ 1971 โ โ โ โ โ โ tr_loss_step = self.training_step(model, inputs) โ
โ 1972 โ โ โ โ else: โ
โ โฑ 1973 โ โ โ โ โ tr_loss_step = self.training_step(model, inputs) โ
โ 1974 โ โ โ โ โ
โ 1975 โ โ โ โ if ( โ
โ 1976 โ โ โ โ โ args.logging_nan_inf_filter โ
โ โ
โ /usr/local/lib/python3.10/dist-packages/transformers/trainer.py:2787 in training_step โ
โ โ
โ 2784 โ โ โ return loss_mb.reduce_mean().detach().to(self.args.device) โ
โ 2785 โ โ โ
โ 2786 โ โ with self.compute_loss_context_manager(): โ
โ โฑ 2787 โ โ โ loss = self.compute_loss(model, inputs) โ
โ 2788 โ โ โ
โ 2789 โ โ if self.args.n_gpu > 1: โ
โ 2790 โ โ โ loss = loss.mean() # mean() to average on multi-gpu parallel training โ
โ โ
โ /usr/local/lib/python3.10/dist-packages/transformers/trainer.py:2819 in compute_loss โ
โ โ
โ 2816 โ โ โ labels = inputs.pop("labels") โ
โ 2817 โ โ else: โ
โ 2818 โ โ โ labels = None โ
โ โฑ 2819 โ โ outputs = model(**inputs) โ
โ 2820 โ โ # Save past state if it exists โ
โ 2821 โ โ # TODO: this needs to be fixed and made cleaner later. โ
โ 2822 โ โ if self.args.past_index >= 0: โ
โ โ
โ /usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py:1501 in _call_impl โ
โ โ
โ 1498 โ โ if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks โ
โ 1499 โ โ โ โ or _global_backward_pre_hooks or _global_backward_hooks โ
โ 1500 โ โ โ โ or _global_forward_hooks or _global_forward_pre_hooks): โ
โ โฑ 1501 โ โ โ return forward_call(*args, **kwargs) โ
โ 1502 โ โ # Do not call functions when jit is used โ
โ 1503 โ โ full_backward_hooks, non_full_backward_hooks = [], [] โ
โ 1504 โ โ backward_pre_hooks = [] โ
โ โ
โ /usr/local/lib/python3.10/dist-packages/peft/peft_model.py:827 in forward โ
โ โ
โ 824 โ โ โ โ โ **kwargs, โ
โ 825 โ โ โ โ ) โ
โ 826 โ โ โ โ
โ โฑ 827 โ โ โ return self.base_model( โ
โ 828 โ โ โ โ input_ids=input_ids, โ
โ 829 โ โ โ โ attention_mask=attention_mask, โ
โ 830 โ โ โ โ inputs_embeds=inputs_embeds, โ
โ โ
โ /usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py:1501 in _call_impl โ
โ โ
โ 1498 โ โ if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks โ
โ 1499 โ โ โ โ or _global_backward_pre_hooks or _global_backward_hooks โ
โ 1500 โ โ โ โ or _global_forward_hooks or _global_forward_pre_hooks): โ
โ โฑ 1501 โ โ โ return forward_call(*args, **kwargs) โ
โ 1502 โ โ # Do not call functions when jit is used โ
โ 1503 โ โ full_backward_hooks, non_full_backward_hooks = [], [] โ
โ 1504 โ โ backward_pre_hooks = [] โ
โ โ
โ /usr/local/lib/python3.10/dist-packages/accelerate/hooks.py:165 in new_forward โ
โ โ
โ 162 โ โ โ with torch.no_grad(): โ
โ 163 โ โ โ โ output = old_forward(*args, **kwargs) โ
โ 164 โ โ else: โ
โ โฑ 165 โ โ โ output = old_forward(*args, **kwargs) โ
โ 166 โ โ return module._hf_hook.post_forward(module, output) โ
โ 167 โ โ
โ 168 โ module.forward = new_forward โ
โ โ
โ /usr/local/lib/python3.10/dist-packages/transformers/models/llama/modeling_llama.py:687 in โ
โ forward โ
โ โ
โ 684 โ โ return_dict = return_dict if return_dict is not None else self.config.use_return โ
โ 685 โ โ โ
โ 686 โ โ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn) โ
โ โฑ 687 โ โ outputs = self.model( โ
โ 688 โ โ โ input_ids=input_ids, โ
โ 689 โ โ โ attention_mask=attention_mask, โ
โ 690 โ โ โ position_ids=position_ids, โ
โ โ
โ /usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py:1501 in _call_impl โ
โ โ
โ 1498 โ โ if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks โ
โ 1499 โ โ โ โ or _global_backward_pre_hooks or _global_backward_hooks โ
โ 1500 โ โ โ โ or _global_forward_hooks or _global_forward_pre_hooks): โ
โ โฑ 1501 โ โ โ return forward_call(*args, **kwargs) โ
โ 1502 โ โ # Do not call functions when jit is used โ
โ 1503 โ โ full_backward_hooks, non_full_backward_hooks = [], [] โ
โ 1504 โ โ backward_pre_hooks = [] โ
โ โ
โ /usr/local/lib/python3.10/dist-packages/accelerate/hooks.py:165 in new_forward โ
โ โ
โ 162 โ โ โ with torch.no_grad(): โ
โ 163 โ โ โ โ output = old_forward(*args, **kwargs) โ
โ 164 โ โ else: โ
โ โฑ 165 โ โ โ output = old_forward(*args, **kwargs) โ
โ 166 โ โ return module._hf_hook.post_forward(module, output) โ
โ 167 โ โ
โ 168 โ module.forward = new_forward โ
โ โ
โ /usr/local/lib/python3.10/dist-packages/transformers/models/llama/modeling_llama.py:536 in โ
โ forward โ
โ โ
โ 533 โ โ โ attention_mask = torch.ones( โ
โ 534 โ โ โ โ (batch_size, seq_length_with_past), dtype=torch.bool, device=inputs_embe โ
โ 535 โ โ โ ) โ
โ โฑ 536 โ โ attention_mask = self._prepare_decoder_attention_mask( โ
โ 537 โ โ โ attention_mask, (batch_size, seq_length), inputs_embeds, past_key_values_len โ
โ 538 โ โ ) โ
โ 539 โ
โ โ
โ /usr/local/lib/python3.10/dist-packages/transformers/models/llama/modeling_llama.py:464 in โ
โ _prepare_decoder_attention_mask โ
โ โ
โ 461 โ โ # [bsz, seq_len] -> [bsz, 1, tgt_seq_len, src_seq_len] โ
โ 462 โ โ combined_attention_mask = None โ
โ 463 โ โ if input_shape[-1] > 1: โ
โ โฑ 464 โ โ โ combined_attention_mask = _make_causal_mask( โ
โ 465 โ โ โ โ input_shape, โ
โ 466 โ โ โ โ inputs_embeds.dtype, โ
โ 467 โ โ โ โ device=inputs_embeds.device, โ
โ โ
โ /usr/local/lib/python3.10/dist-packages/transformers/models/llama/modeling_llama.py:49 in โ
โ make_causal_mask โ
โ โ
โ 46 โ Make causal mask used for bi-directional self-attention. โ
โ 47 โ """ โ
โ 48 โ bsz, tgt_len = input_ids_shape โ
โ โฑ 49 โ mask = torch.full((tgt_len, tgt_len), torch.tensor(torch.finfo(dtype).min, device=de โ
โ 50 โ mask_cond = torch.arange(mask.size(-1), device=device) โ
โ 51 โ mask.masked_fill(mask_cond < (mask_cond + 1).view(mask.size(-1), 1), 0) โ
โ 52 โ mask = mask.to(dtype) โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
RuntimeError: CUDA error: device-side assert triggered
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be
incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
Compile with TORCH_USE_CUDA_DSA
to enable device-side assertions.