# Transformer's trainer runtime error

**URL:** <https://discuss.huggingface.co/t/transformers-trainer-runtime-error/129375>\
**Category:** 🤗Transformers\
**Created:** [December 5, 2024, 9:14am UTC](https://discuss.huggingface.co/t/transformers-trainer-runtime-error/129375 "2024-12-05T09:14:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kein1127](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/kein1127/32/37001_2.png) [@kein1127](https://discuss.huggingface.co/u/kein1127)\
**Post date:** [December 5, 2024, 9:14am UTC](https://discuss.huggingface.co/t/transformers-trainer-runtime-error/129375/1 "2024-12-05T09:14:49Z")

</div>

I performed fine tuning flan-t5-base model using peft.

here is my peft config code

```auto
peft_model = get_peft_model(original_model, 
                            lora_config).to('cuda')

output_dir = f'/kaggle/working/peft-dialogue-summary-lora-training-{str(int(time.time()))}'

peft_training_args = TrainingArguments(
    output_dir=output_dir,
    per_device_train_batch_size=8,
    gradient_accumulation_steps=4,
    learning_rate=1e-3, # Higher learning rate than full fine-tuning.
    num_train_epochs=1,
    save_strategy="epoch",
    logging_steps=15,
     
)
    
peft_trainer = Trainer(
    model=peft_model,
    args=peft_training_args,
    train_dataset=tokenized_datasets["train"],
)

```

original\_model is google/flan-t5-base  
And during perf\_trainer.train() error happened.  
Some tensors share memory, this will lead to duplicate memory on disk and potential differences when loading them again.

Please help me!

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [December 5, 2024, 10:23am UTC](https://discuss.huggingface.co/t/transformers-trainer-runtime-error/129375/2 "2024-12-05T10:23:24Z")

</div>

Possibly same error.

> [@Transformer's Trainer Memory shared Error](https://discuss.huggingface.co/t/transformers-trainer-memory-shared-error/129381):
>
> I performed fine tuning flan-t5-small using peft. here is my code #loading dataset huggingface\_dataset\_name = "knkarthick/dialogsum" dataset = load\_dataset(huggingface\_dataset\_name) dataset #loading original model model\_name='google/flan-t5-base' original\_model = AutoModelForSeq2SeqLM.from\_pretrained(model\_name, torch\_dtype=torch.bfloat16).to('cuda') tokenizer = AutoTokenizer.from\_pretrained(model\_name) def tokenize\_function(example): start\_prompt = 'Summarize the following conversatio…
