Skip to content

save_pretrained no longer works for AutomaticSpeechRecognitionPipeline #28162

Description

@bruno-hays

System Info

transformers-4.37.0.dev0

Who can help?

@Narsil

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

from transformers import pipeline

asr_pipeline = pipeline('automatic-speech-recognition',
                        model="openai/whisper-tiny")

asr_pipeline.save_pretrained("pipeline_save")

Gives this error:

Traceback (most recent call last):
  File "/Users/bruno/testing.py", line 6, in <module>
    asr_pipeline.save_pretrained("pipeline_save")
  File "/Users/bruno/venv/lib/python3.11/site-packages/transformers/pipelines/base.py", line 883, in save_pretrained
    if self.image_processor is not None:
       ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'AutomaticSpeechRecognitionPipeline' object has no attribute 'image_processor'

Expected behavior

The pipeline should be saved.

save_pretrained a pipeline is used by BentoML, as a result versions of transformers newer than 4.32.1 cannot be used to serve a AutomaticSpeechRecognitionPipeline with bentoML.

bentoml/BentoML#4339

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions