Search code examples
pythonlangchainopenai-whisper

Huggingface pipeline with langchain


Hi i am trying to do speaker diarization with open/ai whisper model.
from langchain.llms import HuggingFacePipeline

import torch
from transformers import AutoTokenizer, WhisperProcessor,AutoModelForCausalLM, pipeline, AutoModelForSeq2SeqLM

model_id = 'openai/whisper-large-v2'
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = WhisperProcessor.from_pretrained(model_id)


pipe = pipeline(
    "automatic-speech-recognition",
    model=model, 
    tokenizer=tokenizer, 
    max_length=100
)

local_llm = HuggingFacePipeline(pipeline=pipe)

The error i am getting is " AttributeError: 'WhisperProcessor' object has no attribute 'config'"

Is there anything to change from above code?
Thanks in advance


Solution

  • As of today HuggingFacePipeline only supports text-generation, text2text-generation and summarization