AlexHung29629 commited on
Commit
6f9768a
1 Parent(s): b332d5e

Update ultravox_processing.py

Browse files
Files changed (1) hide show
  1. ultravox_processing.py +7 -5
ultravox_processing.py CHANGED
@@ -52,12 +52,13 @@ class UltravoxProcessor(transformers.ProcessorMixin):
52
  self.encoder_ds_factor = encoder_ds_factor
53
  self.stack_factor = stack_factor
54
  self.audio_placeholder = audio_placeholder
55
- self.audio_token_replacement = tokenizer.eos_token
56
- assert (
57
- self.audio_token_replacement is not None
58
- ), "The tokenizer has no EOS token. Cannot recover."
59
  if tokenizer.pad_token_id is None:
60
  tokenizer.pad_token_id = tokenizer.eos_token_id
 
 
 
 
61
 
62
  super().__init__(audio_processor=audio_processor, tokenizer=tokenizer)
63
 
@@ -76,7 +77,8 @@ class UltravoxProcessor(transformers.ProcessorMixin):
76
  pretrained_model_name_or_path, **kwargs
77
  )
78
  tokenizer.padding_side = "left"
79
- tokenizer.pad_token = tokenizer.eos_token
 
80
 
81
  return cls(
82
  audio_processor=audio_processor,
 
52
  self.encoder_ds_factor = encoder_ds_factor
53
  self.stack_factor = stack_factor
54
  self.audio_placeholder = audio_placeholder
55
+
 
 
 
56
  if tokenizer.pad_token_id is None:
57
  tokenizer.pad_token_id = tokenizer.eos_token_id
58
+ self.audio_token_replacement = tokenizer.pad_token
59
+ assert (
60
+ self.audio_token_replacement is not None
61
+ ), "The tokenizer has no PAD token. Cannot recover."
62
 
63
  super().__init__(audio_processor=audio_processor, tokenizer=tokenizer)
64
 
 
77
  pretrained_model_name_or_path, **kwargs
78
  )
79
  tokenizer.padding_side = "left"
80
+ if tokenizer.pad_token_id is None:
81
+ tokenizer.pad_token_id = tokenizer.eos_token_id
82
 
83
  return cls(
84
  audio_processor=audio_processor,