Skip to content

Table question answering pipeline failing to save #32128

Description

@daniellok-db

System Info

  • transformers version: 4.43.0.dev0 (installed from source)
  • Platform: macOS-14.4.1-arm64-arm-64bit
  • Python version: 3.9.13
  • Huggingface_hub version: 0.23.5
  • Safetensors version: 0.4.2
  • Accelerate version: 0.25.0
  • Accelerate config: not found
  • PyTorch version (GPU?): 2.1.1 (False)
  • Tensorflow version (GPU?): 2.16.1 (False)
  • Flax version (CPU?/GPU?/TPU?): not installed (NA)
  • Jax version: not installed
  • JaxLib version: not installed
  • Using distributed or parallel set-up in script?:

Who can help?

@muellerzr @amyeroberts

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

Run the following script (just saving and loading a pipeline)

import transformers

pipe = transformers.pipeline(
    task="table-question-answering", model="google/tapas-tiny-finetuned-wtq"
)

pipe.save_pretrained("test")

this gives the exception:

ValueError: You are trying to save a non contiguous tensor: `tapas.encoder.layer.0.attention.self.query.weight` which is not allowed. It either means you are trying to save tensors which are reference of each other in which case it's recommended to save only the full tensors, and reslice at load time, or simply call `.contiguous()` on your tensor to pack it before saving.

I'm not sure exactly what's going on, but when reverting this commit, it saves successfully.

Is there any way to disable superfast init as a workaround?

Expected behavior

Saving a pretrained pipeline should not fail with an exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions