Evan-Lin commited on
Commit
7f3abba
1 Parent(s): 8d88f31

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +2 -2
handler.py CHANGED
@@ -3,8 +3,8 @@ from transformers import pipeline
3
 
4
  class EndpointHandler():
5
  def __init__(self, path=""):
6
- self.pipeline = pipeline("automatic-speech-recognition", model=path)
7
- self.pipeline.model.config.forced_decoder_ids = self.pipeline.model.processor.get_decoder_prompt_ids(language="Chinese", task="transcribe")
8
  self.pipeline.model.generation_config.forced_decoder_ids = self.pipeline.model.config.forced_decoder_ids # just to be sure!
9
 
10
  def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
 
3
 
4
  class EndpointHandler():
5
  def __init__(self, path=""):
6
+ self.pipeline = pipeline(task= "automatic-speech-recognition", model=path)
7
+ self.pipeline.model.config.forced_decoder_ids = self.pipeline.tokenizer.get_decoder_prompt_ids(language="Chinese", task="transcribe")
8
  self.pipeline.model.generation_config.forced_decoder_ids = self.pipeline.model.config.forced_decoder_ids # just to be sure!
9
 
10
  def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]: