Instructions to use danielrosehill/Gemma-3-270M-ASR-Paragraph-Breaks with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use danielrosehill/Gemma-3-270M-ASR-Paragraph-Breaks with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="danielrosehill/Gemma-3-270M-ASR-Paragraph-Breaks") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("danielrosehill/Gemma-3-270M-ASR-Paragraph-Breaks") model = AutoModelForCausalLM.from_pretrained("danielrosehill/Gemma-3-270M-ASR-Paragraph-Breaks", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use danielrosehill/Gemma-3-270M-ASR-Paragraph-Breaks with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "danielrosehill/Gemma-3-270M-ASR-Paragraph-Breaks" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "danielrosehill/Gemma-3-270M-ASR-Paragraph-Breaks", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/danielrosehill/Gemma-3-270M-ASR-Paragraph-Breaks
- SGLang
How to use danielrosehill/Gemma-3-270M-ASR-Paragraph-Breaks with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "danielrosehill/Gemma-3-270M-ASR-Paragraph-Breaks" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "danielrosehill/Gemma-3-270M-ASR-Paragraph-Breaks", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "danielrosehill/Gemma-3-270M-ASR-Paragraph-Breaks" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "danielrosehill/Gemma-3-270M-ASR-Paragraph-Breaks", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use danielrosehill/Gemma-3-270M-ASR-Paragraph-Breaks with Docker Model Runner:
docker model run hf.co/danielrosehill/Gemma-3-270M-ASR-Paragraph-Breaks
Gemma 3 270M: ASR paragraph breaks
Adds paragraph breaks to flat speech-to-text output and changes nothing else. Speech recognition
(here, a Parakeet fine-tune) returns punctuated, cased text as one block; this model returns the same
text with paragraphs separated by blank lines. It is small enough to run on a phone after the ASR pass.
An ONNX export for ONNX Runtime is at danielrosehill/Gemma-3-270M-ASR-Paragraph-Breaks-ONNX.
Try it in the demo Space (CPU; optionally chains the email key-line bolding model). Write-up: blog post.
Results
Scored on 26 held-out synthetic voice memos whose paragraph breaks were reviewed by hand, as break-position precision and recall. Any output that changes a non-whitespace character counts as a fallback: the input is returned unchanged, as it should be in deployment.
| Model | Precision | Recall | F1 | Fallbacks |
|---|---|---|---|---|
| Untrained Gemma 3 270M | 0.00 | 0.00 | 0.00 | 26 of 26 |
| Fine-tuned r2-gemma270m (this model) | 0.84 | 0.72 | 0.78 | 2 of 26 |
| Fine-tuned r3-gemma270m-e6 (not published: 804 pairs, 6 epochs) | 0.83 | 0.72 | 0.78 | 1 of 26 |
The grey reference row is the rule-based labeller used to make most of the training data. It starts from an already-paragraphed draft, so it is a ceiling, not a like-for-like baseline: the model starts from flat text.
Usage
Always check the output: if anything other than whitespace changed, use the input instead.
import re
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("danielrosehill/Gemma-3-270M-ASR-Paragraph-Breaks")
model = AutoModelForCausalLM.from_pretrained("danielrosehill/Gemma-3-270M-ASR-Paragraph-Breaks")
SYSTEM = ("Add paragraph breaks to this voice-note transcript. Separate paragraphs with a blank line. "
"Do not change, add or remove any word or punctuation mark.")
def paragraph(text: str) -> str:
prompt = tok.apply_chat_template([{"role": "system", "content": SYSTEM}, {"role": "user", "content": text}],
tokenize=False, add_generation_prompt=True)
enc = tok(prompt, return_tensors="pt")
out = model.generate(**enc, max_new_tokens=1600, do_sample=False)
pred = tok.decode(out[0][enc["input_ids"].shape[1]:], skip_special_tokens=True).strip()
same = re.sub(r"\s+", "", pred) == re.sub(r"\s+", "", text)
return pred if same else text
Training
Full fine-tune of google/gemma-3-270m-it with TRL SFT
on prompt/completion pairs (completion-only loss): 505 training pairs, 3 epochs, learning
rate 5e-05, bf16, one NVIDIA L4 on Modal (run asr-paragraph-r2-gemma270m).
Data: danielrosehill/ASR-Paragraph-Breaks
(the exact train/test split is in its training/ folder). Synthetic voice-memo transcripts were written
by Claude Haiku 5.5, a minority of them paragraphed by hand, and the rest labelled by rules derived from
those hand edits. Code: github.com/danielrosehill/ASR-Paragraph-Breaks.
Limitations
- English only, and trained on synthetic memos rather than real ASR output.
- The paragraphing style is one person's: short paragraphs, the opening line and each sign-off line on their own.
- Memos longer than about 700 words were not in training; split longer transcripts first.
- It is a generative model, so it retypes the whole text. Keep the fallback check.
Licence: Gemma Terms of Use, inherited from the base model.
- Downloads last month
- 636


