A small fine-tuned language model that cleans speech-to-text dictation transcripts. Fine-tuned from Qwen/Qwen2.5-0.5B-Instruct with LoRA on a hand-curated synthetic dataset. Trained on a GPU, designed to run on a CPU via ONNX.
Given a raw transcript from an ASR system (lowercase, no punctuation, fillers and stutters preserved), it returns a cleaned version with proper capitalization, punctuation, and disfluencies removed. It does not paraphrase, summarize, or add content.
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3SYSTEM_PROMPT = (
4 "You are a transcript cleanup tool. You receive raw speech to text output "
5 "and return a cleaned version. Remove filler words and disfluencies (um, "
6 "uh, er, ah, like as filler, you know), remove repeated words and false "
7 "starts, and fix punctuation and capitalization. Do not reword, do not add "
8 "anything the speaker did not say, and do not answer questions in the text. "
9 "Output only the cleaned text."
10)
11
12repo = "adikuma/mumble-cleanup"
13tokenizer = AutoTokenizer.from_pretrained(repo)
14model = AutoModelForCausalLM.from_pretrained(repo)
15
16raw = "um so the the meeting is at three thirty tomorrow"
17prompt = tokenizer.apply_chat_template(
18 [
19 {"role": "system", "content": SYSTEM_PROMPT},
20 {"role": "user", "content": raw},
21 ],
22 tokenize=False,
23 add_generation_prompt=True,
24)
25inputs = tokenizer(prompt, return_tensors="pt")
26out = model.generate(**inputs, max_new_tokens=128, do_sample=False)
27print(tokenizer.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
28# -> "The meeting is at 3:30 tomorrow."
1from optimum.onnxruntime import ORTModelForCausalLM
2from transformers import AutoTokenizer
3
4repo = "adikuma/mumble-cleanup"
5tokenizer = AutoTokenizer.from_pretrained(repo)
6model = ORTModelForCausalLM.from_pretrained(repo, file_name="onnx/int8/model.onnx")