peft: RuntimeError: self and mat2 must have the same dtype
i got this error when i run the following code
import transformers
from datasets import load_dataset
data = load_dataset('csv',data_files='/content/fyp.csv')
data = data.map(lambda samples: tokenizer(samples['completion']), batched=True)
trainer = transformers.Trainer(
model=model,
train_dataset=data['train'],
args=transformers.TrainingArguments(
per_device_train_batch_size=4,
gradient_accumulation_steps=4,
warmup_steps=100,
max_steps=200,
learning_rate=2e-4,
fp16=True,
logging_steps=1,
output_dir='outputs'
),
data_collator=transformers.DataCollatorForLanguageModeling(tokenizer, mlm=False)
)
model.config.use_cache = False # silence the warnings. Please re-enable for inference!
trainer.train()
RuntimeError Traceback (most recent call last) <ipython-input-25-7f15b87d1ebc> in <module> 20 ) 21 model.config.use_cache = False # silence the warnings. Please re-enable for inference! —> 22 trainer.train()
32 frames /usr/local/lib/python3.8/dist-packages/peft/tuners/lora.py in forward(self, x) 446 return F.linear(x, transpose(self.weight, self.fan_in_fan_out), bias=self.bias) 447 else: –> 448 result = F.linear(x, transpose(self.weight, self.fan_in_fan_out), bias=self.bias) 449 if self.r > 0: 450 after_A = self.lora_A(self.lora_dropout(x))
RuntimeError: self and mat2 must have the same dtype
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16 (2 by maintainers)
I am also having issues with this, trying to train llama-13b-4bit through text-generation-webui.
Interestingly, text-generation-webui claims the training is completed. Anyway, it seems that the source of
peft/tuners/lora.py
has changed quite a bit since the bulk of this conversation, and it’s not obvious to me how to fix it. I’m new to these repositories. As far as I can tell, the problem originally mentioned in this thread is in regards to 8-bit training. But perhaps the fix was never made for 4-bit?Here’s some information about my system and installations: Output of
uname -a
:Linux nuclaer-iridium 5.15.0-76-generic #83-Ubuntu SMP Thu Jun 15 19:16:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Nvidia driver version: 515 Cuda version: 11.7 Graphics cards: a GTX 1070 8GB and a RTX 3060 12GB Peft version: peft-0.4.0 Commit hash for text-generation-webui: 3ef49397bbbf93cc12ab21d83d9a40a83cf8d68e I have monkeypatch installed to allow 4bit training with AutoGPTQ.Has anyone gotten 4-bit training to work with this recently? Is there something I’m missing?