Introduction
In this tutorial, you'll learn how to use S1-mini, a lightweight text normalizer from Superwhisper that cleans up raw automatic speech recognition (ASR) transcripts. ASR systems like Whisper can produce transcripts with filler words, self-corrections, and other artifacts that make them hard to read. S1-mini fixes this by taking those messy transcripts and converting them into clean, readable text.
This tutorial will walk you through installing S1-mini, preparing sample data, and running the normalizer on your own audio transcripts. By the end, you'll have a working pipeline that transforms raw ASR output into professional-quality text.
Prerequisites
Before starting this tutorial, you'll need:
- A computer with Python 3.7 or higher installed
- Basic knowledge of command-line operations
- Internet access to download the S1-mini model
- Some sample ASR transcripts to test with (or you can create your own)
Step-by-Step Instructions
1. Install Required Python Packages
First, we need to install the necessary Python libraries. Open your terminal or command prompt and run:
pip install torch transformers
Why this step? The S1-mini model is built using PyTorch and Hugging Face's Transformers library, so we need to install these dependencies to run the model properly.
2. Download S1-mini Model
Next, we'll download the S1-mini model. You can get it from the Hugging Face model hub. Create a new Python file called s1_mini_demo.py and add this code:
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
# Load the S1-mini model
model_name = "superwhisper/s1-mini"
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
Why this step? This downloads the pre-trained S1-mini model and tokenizer from the Hugging Face hub, which contains all the weights and configurations needed to perform text normalization.
3. Prepare Sample Input Data
Now let's create some sample raw ASR transcripts to test with. Add this code to your Python file:
# Sample raw ASR transcripts
raw_transcripts = [
"Hello, um, I was just wondering if you could help me with this problem, um, you know, like, it's kind of confusing.",
"The weather today, um, it's really nice, isn't it? Yeah, I mean, it's quite pleasant, actually.",
"So, um, I think we should probably start with the basics, right? Like, what do we need to do first?"
]
Why this step? These sample inputs represent typical ASR outputs with filler words like 'um' and 'you know' that S1-mini will clean up.
4. Create the Normalization Function
We'll now create a function that uses the S1-mini model to normalize our transcripts:
def normalize_text(raw_text):
# Tokenize the input
inputs = tokenizer(raw_text, return_tensors="pt", max_length=512, truncation=True)
# Generate normalized output
outputs = model.generate(
**inputs,
max_length=512,
num_beams=4,
early_stopping=True
)
# Decode the output
normalized_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
return normalized_text
Why this step? This function takes raw text, processes it through the model's tokenizer, generates normalized output using the model's generation capabilities, and then decodes the result back into readable text.
5. Run Normalization on Sample Data
Now let's process our sample transcripts:
# Process all transcripts
for i, transcript in enumerate(raw_transcripts):
print(f"\nOriginal {i+1}: {transcript}")
normalized = normalize_text(transcript)
print(f"Normalized {i+1}: {normalized}")
Why this step? This loop demonstrates how the model transforms each raw transcript into a cleaner version, showing the before and after results.
6. Save Results to File
To save your normalized results for later use, add this code:
# Save results to a file
with open('normalized_transcripts.txt', 'w') as f:
for i, transcript in enumerate(raw_transcripts):
normalized = normalize_text(transcript)
f.write(f"Original {i+1}: {transcript}\n")
f.write(f"Normalized {i+1}: {normalized}\n\n")
print("Results saved to normalized_transcripts.txt")
Why this step? Saving results to a file allows you to keep track of your normalized transcripts and use them in other applications.
7. Test with Your Own Audio Transcript
Finally, let's make it easy to test with your own data:
# Function to process your own transcript
def process_your_transcript(custom_text):
print(f"\nProcessing your custom transcript:")
print(f"Original: {custom_text}")
normalized = normalize_text(custom_text)
print(f"Normalized: {normalized}")
return normalized
# Example usage with your own text
your_text = "Um, I was just, um, thinking about how we could improve this project, you know, it's quite important."
process_your_transcript(your_text)
Why this step? This allows you to easily test the model with your own ASR outputs, making it practical for real-world use cases.
Summary
In this tutorial, you've learned how to use S1-mini, a 462 MB open-weight text normalizer that cleans up raw ASR transcripts. You've installed the required packages, downloaded the model, prepared sample data, and run the normalization process on both sample and custom transcripts.
The key benefits of using S1-mini include:
- Removing filler words like 'um', 'uh', and 'you know'
- Resolving self-corrections in speech
- Producing clean, readable text from noisy ASR outputs
- Being lightweight at only 462 MB
This tool is especially useful for researchers, content creators, and developers working with speech-to-text applications who want to improve the quality of their transcript data.



