raytency commited on
Commit
dd6cc59
1 Parent(s): 4ff16d7

Fix AttributeError: 'NoneType' object has no attribute 'tokenizer'

Browse files

Steps to reproduce the issue:
```
import transformers
import librosa

model_name = "fixie-ai/ultravox-v0_4-mistral_nemo"
tokenizer = transformers.AutoTokenizer.from_pretrained(model_name)

pipe = transformers.pipeline(model=model_name, tokenizer=tokenizer, trust_remote_code=True)

path = "foo.ogg"
audio, sr = librosa.load(path, sr=16000)

turns = [
{"role": "user", "content": "Explain what is happening in the audio"}
]

pipe({'audio': audio, 'turns': turns, 'sampling_rate': sr}, max_new_tokens=30)
```

Files changed (1) hide show
  1. ultravox_pipeline.py +2 -2
ultravox_pipeline.py CHANGED
@@ -33,14 +33,14 @@ class UltravoxPipeline(transformers.Pipeline):
33
  model.config.audio_model_id or model.config.audio_config._name_or_path
34
  )
35
 
 
 
36
  self.processor = UltravoxProcessor(
37
  audio_processor=audio_processor,
38
  tokenizer=tokenizer,
39
  stack_factor=model.config.stack_factor,
40
  )
41
 
42
- super().__init__(model=model, tokenizer=tokenizer, **kwargs)
43
-
44
  def _sanitize_parameters(self, **kwargs):
45
  generation_keys = ["temperature", "max_new_tokens", "repetition_penalty"]
46
  generation_kwargs = {k: kwargs[k] for k in kwargs if k in generation_keys}
 
33
  model.config.audio_model_id or model.config.audio_config._name_or_path
34
  )
35
 
36
+ super().__init__(model=model, tokenizer=tokenizer, **kwargs)
37
+
38
  self.processor = UltravoxProcessor(
39
  audio_processor=audio_processor,
40
  tokenizer=tokenizer,
41
  stack_factor=model.config.stack_factor,
42
  )
43
 
 
 
44
  def _sanitize_parameters(self, **kwargs):
45
  generation_keys = ["temperature", "max_new_tokens", "repetition_penalty"]
46
  generation_kwargs = {k: kwargs[k] for k in kwargs if k in generation_keys}