Skip to content

trainer save_model ValueError You are trying to save a non contiguous tensor #1582

@smilieSushmitha

Description

@smilieSushmitha

Describe the bug
Fine-tuning mt5 model, and trying to save the fine-tuned model is throwing a ValueError: You are trying to save a non contiguous tensor:

To Reproduce
Attaching a notebook to reproduce the issue: Colab

Expected behavior
Model.train() should train the model and should save the model to the output directory

Screenshots
If applicable, add screenshots to help explain your problem.
Screenshot 2024-11-08 131354

Desktop (please complete the following information):
Run on google Colab
Select:

  1. Runtime type: Python 3
  2. Hardware accelerator: T4

image

Cause of Error:
In the Hugging Face transformers repository, the PR #27064 - "Safetensors serialization by default" updates the save_pretrained() method in transformers/src/transformers/modeling_utils.py to set the safe_serialization argument to True by default. However, the simpletransformers library's model.train_model() function does not currently offer a way to pass a different value for safe_serialization to the save_pretrained() method, which limits control over this setting when saving models.

Please help me with a workaround to this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions