Extract only the assistant's response from the generated text

parent 407226d7
Pipeline #210 canceled with stages
......@@ -114,7 +114,12 @@ def main():
# Inference: Generation of the output text
text_ids, _ = model.generate(**inputs, use_audio_in_video=False)
text = processor.batch_decode(text_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
full_text = processor.batch_decode(text_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
# Extract only the assistant's response
if "assistant\n" in full_text:
text = full_text.split("assistant\n")[-1].strip()
else:
text = full_text.strip()
# Format timestamps
start_min, start_sec = divmod(start, 60)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment