How to finetune the LLM to output the text with SSML tags?

41 Views Asked by At

I need to train a model to add the SSML tags and punctuation to the input text. For example, from the sentence "Hello world." I'd like to get the <speak> Hello! world. </speak> output.

Another example:

Input: "In reverse bias, the electrons flow from anode to cathode (P -> N), while the holes (positive charges) flow from cathode to anode (N -> P). This happens because in reverse bias, a greater voltage is wired to N, attracting electrons to outside, while the least voltage does the same with holes."

Output:<speak>In reverse bias, the electrons, flow from anode to cathode (P -> N), while the holes (positive charges), flow from cathode to anode (N -> P). <break time = "0.5s" /> This happens because in reverse bias, a greater voltage, is wired to N, attracting electrons to outside, while the least voltage, does the same with holes. </speak>

I followed the standard Seq2Seq training using the huggings face tutorials, but had no luck. the output text is the same as the input. I used a Flan-T5-base model. My data is 1200 pairs.

Any suggestion how to force the model to show the ssml tags and the "incorrect" punctuation?

0

There are 0 best solutions below