Tomtom84 commited on
Commit
5637a00
·
verified ·
1 Parent(s): b1de4bc

Update orpheus-tts/engine_class.py

Browse files
Files changed (1) hide show
  1. orpheus-tts/engine_class.py +10 -19
orpheus-tts/engine_class.py CHANGED
@@ -100,11 +100,15 @@ class OrpheusModel:
100
  else:
101
  full_prompt = prompt
102
 
103
- # Kartoffel model format - exakt wie in der Referenz-Implementierung
104
- import torch
 
 
 
 
105
 
106
  start_token = torch.tensor([[128259]], dtype=torch.int64)
107
- end_tokens = torch.tensor([[128009, 128260]], dtype=torch.int64)
108
  input_ids = self.tokenizer(full_prompt, return_tensors="pt").input_ids
109
 
110
  print(f"DEBUG KARTOFFEL: Original prompt: '{full_prompt}'")
@@ -115,24 +119,11 @@ class OrpheusModel:
115
  print(f"DEBUG KARTOFFEL: modified_input_ids shape: {modified_input_ids.shape}")
116
  print(f"DEBUG KARTOFFEL: modified_input_ids: {modified_input_ids[0].tolist()}")
117
 
118
- # Versuchen wir verschiedene Dekodierungsoptionen
119
  decoded_text = self.tokenizer.decode(modified_input_ids[0], skip_special_tokens=False)
120
- print(f"DEBUG KARTOFFEL: Decoded with skip_special_tokens=False: '{decoded_text}'")
121
-
122
- # Prüfen wir, ob die speziellen Tokens im Vokabular sind
123
- special_tokens = ['<custom_token_3>', '<custom_token_4>', '<|begin_of_text|>', '<|eot_id|>']
124
- for token in special_tokens:
125
- if token in self.tokenizer.get_vocab():
126
- print(f"DEBUG KARTOFFEL: Token '{token}' found in vocab with ID: {self.tokenizer.get_vocab()[token]}")
127
- else:
128
- print(f"DEBUG KARTOFFEL: Token '{token}' NOT found in vocab")
129
-
130
- # Versuchen wir es mit dem einfachen Prompt ohne spezielle Tokens
131
- # um zu sehen, ob vLLM überhaupt funktioniert
132
- simple_prompt = full_prompt
133
- print(f"DEBUG KARTOFFEL: Trying simple prompt without special tokens: '{simple_prompt}'")
134
 
135
- return simple_prompt # Temporär: nur den einfachen Prompt verwenden
136
  else:
137
  # Original Orpheus format (für Canopy-Deutsch und English)
138
  if model_type == "smaller":
 
100
  else:
101
  full_prompt = prompt
102
 
103
+ # Kartoffel model format - basierend auf Referenz-Implementierung
104
+
105
+ # Wichtig: Die Referenz zeigt diese Token-Sequenz:
106
+ # start_token = 128259
107
+ # end_tokens = [128009, 128260]
108
+ # Aber für Audio-Generierung brauchen wir auch das Audio-Start-Token!
109
 
110
  start_token = torch.tensor([[128259]], dtype=torch.int64)
111
+ end_tokens = torch.tensor([[128009, 128260, 128261, 128257]], dtype=torch.int64) # 128257 ist CODE_START_TOKEN_ID
112
  input_ids = self.tokenizer(full_prompt, return_tensors="pt").input_ids
113
 
114
  print(f"DEBUG KARTOFFEL: Original prompt: '{full_prompt}'")
 
119
  print(f"DEBUG KARTOFFEL: modified_input_ids shape: {modified_input_ids.shape}")
120
  print(f"DEBUG KARTOFFEL: modified_input_ids: {modified_input_ids[0].tolist()}")
121
 
122
+ # Zurück zu Text dekodieren
123
  decoded_text = self.tokenizer.decode(modified_input_ids[0], skip_special_tokens=False)
124
+ print(f"DEBUG KARTOFFEL: Final decoded prompt: '{decoded_text}'")
 
 
 
 
 
 
 
 
 
 
 
 
 
125
 
126
+ return decoded_text
127
  else:
128
  # Original Orpheus format (für Canopy-Deutsch und English)
129
  if model_type == "smaller":