Text Generation
Transformers
Safetensors
English
t5
text2text-generation
speech-to-text
transcript-formatting
asr-post-processing
dictation
knowledge-distillation
text-generation-inference
Instructions to use Akash-Sakala/flan-t5-large-transcript-formatter with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Akash-Sakala/flan-t5-large-transcript-formatter with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Akash-Sakala/flan-t5-large-transcript-formatter")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("Akash-Sakala/flan-t5-large-transcript-formatter") model = AutoModelForSeq2SeqLM.from_pretrained("Akash-Sakala/flan-t5-large-transcript-formatter") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Akash-Sakala/flan-t5-large-transcript-formatter with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Akash-Sakala/flan-t5-large-transcript-formatter" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Akash-Sakala/flan-t5-large-transcript-formatter", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Akash-Sakala/flan-t5-large-transcript-formatter
- SGLang
How to use Akash-Sakala/flan-t5-large-transcript-formatter 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 "Akash-Sakala/flan-t5-large-transcript-formatter" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Akash-Sakala/flan-t5-large-transcript-formatter", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "Akash-Sakala/flan-t5-large-transcript-formatter" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Akash-Sakala/flan-t5-large-transcript-formatter", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Akash-Sakala/flan-t5-large-transcript-formatter with Docker Model Runner:
docker model run hf.co/Akash-Sakala/flan-t5-large-transcript-formatter
Distilled Flan-T5-Large transcript formatter + model card
Browse files- README.md +67 -0
- config.json +34 -0
- generation_config.json +9 -0
- loss_curves.png +0 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +114 -0
README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language: [en]
|
| 4 |
+
base_model: google/flan-t5-large
|
| 5 |
+
pipeline_tag: text2text-generation
|
| 6 |
+
library_name: transformers
|
| 7 |
+
tags:
|
| 8 |
+
- speech-to-text
|
| 9 |
+
- transcript-formatting
|
| 10 |
+
- asr-post-processing
|
| 11 |
+
- dictation
|
| 12 |
+
- knowledge-distillation
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# Flan-T5-Large Transcript Formatter (distilled, < 1 GB target)
|
| 16 |
+
|
| 17 |
+
Raw speech-to-text transcript **in** → clean, formatted transcript **out**
|
| 18 |
+
(punctuation, casing, filler/disfluency removal, ITN, homophones, proper nouns,
|
| 19 |
+
URLs/emails, and layout). The model takes the **raw transcript as its only input**
|
| 20 |
+
(no system prompt) and emits the formatted transcript.
|
| 21 |
+
|
| 22 |
+
## Distillation
|
| 23 |
+
|
| 24 |
+
- **Teacher:** GPT-OSS-120B → Phase-1 distilled **GPT-OSS-20B** formatter, which
|
| 25 |
+
reproduces the L0–L5 + RL curriculum behaviour at ~99.5% adjusted accuracy.
|
| 26 |
+
- **Student:** `google/flan-t5-large` (783M, encoder–decoder).
|
| 27 |
+
- **Method:** off-policy / sequence-level knowledge distillation (prompt
|
| 28 |
+
distillation). Trained on **(raw → formatted)** pairs using the curriculum
|
| 29 |
+
**gold** targets (cleaner than propagating the teacher's residual errors).
|
| 30 |
+
|
| 31 |
+
## Data
|
| 32 |
+
|
| 33 |
+
Sampled from the layered curriculum (L0–L5 + RL), de-duplicated latest-layer-wins,
|
| 34 |
+
with the per-layer val splits held out and made disjoint from train:
|
| 35 |
+
**18,129 train / 2,713 validation** pairs, 21 formatting categories.
|
| 36 |
+
|
| 37 |
+
## Training
|
| 38 |
+
|
| 39 |
+
| | |
|
| 40 |
+
|---|---|
|
| 41 |
+
| Hardware | 1× RTX 5090 (32 GB), bf16 |
|
| 42 |
+
| Optimizer | Adafactor, lr 1e-4, warmup_ratio 0.03 |
|
| 43 |
+
| Batch | 8 × grad-accum 2 = effective 16 |
|
| 44 |
+
| Seq length | max 640 tokens (covers the longest pair, 552 tok; zero truncation) |
|
| 45 |
+
| Regularization | gradient checkpointing; early stopping (patience 3), best-checkpoint by val loss |
|
| 46 |
+
| Result | best **val loss 0.005784 @ step 2250 (~epoch 2.0)**; early-stopped at step 3000 |
|
| 47 |
+
|
| 48 |
+

|
| 49 |
+
|
| 50 |
+
## Usage
|
| 51 |
+
|
| 52 |
+
```python
|
| 53 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 54 |
+
tok = AutoTokenizer.from_pretrained("Akash-Sakala/flan-t5-large-transcript-formatter")
|
| 55 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("Akash-Sakala/flan-t5-large-transcript-formatter")
|
| 56 |
+
raw = "i went to the the store yesterday it was closed so i couldnt get the milk"
|
| 57 |
+
ids = tok(raw, return_tensors="pt")
|
| 58 |
+
print(tok.decode(model.generate(**ids, max_new_tokens=640, num_beams=1)[0], skip_special_tokens=True))
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
## Limitations
|
| 62 |
+
|
| 63 |
+
A 783M student shows a capacity step-down from the 20B teacher on the hardest
|
| 64 |
+
**L4 layout** cases (long email/list blocks); T5 was pretrained mostly at 512
|
| 65 |
+
tokens. For an int8, CPU-only deployment (< 1 GB) convert with CTranslate2.
|
| 66 |
+
|
| 67 |
+
License Apache-2.0 (matches the `openai/gpt-oss` base and the curriculum dataset).
|
config.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"T5ForConditionalGeneration"
|
| 4 |
+
],
|
| 5 |
+
"classifier_dropout": 0.0,
|
| 6 |
+
"d_ff": 2816,
|
| 7 |
+
"d_kv": 64,
|
| 8 |
+
"d_model": 1024,
|
| 9 |
+
"decoder_start_token_id": 0,
|
| 10 |
+
"dense_act_fn": "gelu_new",
|
| 11 |
+
"dropout_rate": 0.1,
|
| 12 |
+
"dtype": "float32",
|
| 13 |
+
"eos_token_id": 1,
|
| 14 |
+
"feed_forward_proj": "gated-gelu",
|
| 15 |
+
"initializer_factor": 1.0,
|
| 16 |
+
"is_decoder": false,
|
| 17 |
+
"is_encoder_decoder": true,
|
| 18 |
+
"is_gated_act": true,
|
| 19 |
+
"layer_norm_epsilon": 1e-06,
|
| 20 |
+
"model_type": "t5",
|
| 21 |
+
"n_positions": 512,
|
| 22 |
+
"num_decoder_layers": 24,
|
| 23 |
+
"num_heads": 16,
|
| 24 |
+
"num_layers": 24,
|
| 25 |
+
"output_past": true,
|
| 26 |
+
"pad_token_id": 0,
|
| 27 |
+
"relative_attention_max_distance": 128,
|
| 28 |
+
"relative_attention_num_buckets": 32,
|
| 29 |
+
"scale_decoder_outputs": false,
|
| 30 |
+
"tie_word_embeddings": true,
|
| 31 |
+
"transformers_version": "5.12.1",
|
| 32 |
+
"use_cache": false,
|
| 33 |
+
"vocab_size": 32128
|
| 34 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"decoder_start_token_id": 0,
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
1
|
| 6 |
+
],
|
| 7 |
+
"pad_token_id": 0,
|
| 8 |
+
"transformers_version": "5.12.1"
|
| 9 |
+
}
|
loss_curves.png
ADDED
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:75d1892934ce91095cd368e07318b678c776f781b35aeaa895857b61b9464c9d
|
| 3 |
+
size 3132668808
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"eos_token": "</s>",
|
| 4 |
+
"extra_ids": 100,
|
| 5 |
+
"extra_special_tokens": [
|
| 6 |
+
"<extra_id_0>",
|
| 7 |
+
"<extra_id_1>",
|
| 8 |
+
"<extra_id_2>",
|
| 9 |
+
"<extra_id_3>",
|
| 10 |
+
"<extra_id_4>",
|
| 11 |
+
"<extra_id_5>",
|
| 12 |
+
"<extra_id_6>",
|
| 13 |
+
"<extra_id_7>",
|
| 14 |
+
"<extra_id_8>",
|
| 15 |
+
"<extra_id_9>",
|
| 16 |
+
"<extra_id_10>",
|
| 17 |
+
"<extra_id_11>",
|
| 18 |
+
"<extra_id_12>",
|
| 19 |
+
"<extra_id_13>",
|
| 20 |
+
"<extra_id_14>",
|
| 21 |
+
"<extra_id_15>",
|
| 22 |
+
"<extra_id_16>",
|
| 23 |
+
"<extra_id_17>",
|
| 24 |
+
"<extra_id_18>",
|
| 25 |
+
"<extra_id_19>",
|
| 26 |
+
"<extra_id_20>",
|
| 27 |
+
"<extra_id_21>",
|
| 28 |
+
"<extra_id_22>",
|
| 29 |
+
"<extra_id_23>",
|
| 30 |
+
"<extra_id_24>",
|
| 31 |
+
"<extra_id_25>",
|
| 32 |
+
"<extra_id_26>",
|
| 33 |
+
"<extra_id_27>",
|
| 34 |
+
"<extra_id_28>",
|
| 35 |
+
"<extra_id_29>",
|
| 36 |
+
"<extra_id_30>",
|
| 37 |
+
"<extra_id_31>",
|
| 38 |
+
"<extra_id_32>",
|
| 39 |
+
"<extra_id_33>",
|
| 40 |
+
"<extra_id_34>",
|
| 41 |
+
"<extra_id_35>",
|
| 42 |
+
"<extra_id_36>",
|
| 43 |
+
"<extra_id_37>",
|
| 44 |
+
"<extra_id_38>",
|
| 45 |
+
"<extra_id_39>",
|
| 46 |
+
"<extra_id_40>",
|
| 47 |
+
"<extra_id_41>",
|
| 48 |
+
"<extra_id_42>",
|
| 49 |
+
"<extra_id_43>",
|
| 50 |
+
"<extra_id_44>",
|
| 51 |
+
"<extra_id_45>",
|
| 52 |
+
"<extra_id_46>",
|
| 53 |
+
"<extra_id_47>",
|
| 54 |
+
"<extra_id_48>",
|
| 55 |
+
"<extra_id_49>",
|
| 56 |
+
"<extra_id_50>",
|
| 57 |
+
"<extra_id_51>",
|
| 58 |
+
"<extra_id_52>",
|
| 59 |
+
"<extra_id_53>",
|
| 60 |
+
"<extra_id_54>",
|
| 61 |
+
"<extra_id_55>",
|
| 62 |
+
"<extra_id_56>",
|
| 63 |
+
"<extra_id_57>",
|
| 64 |
+
"<extra_id_58>",
|
| 65 |
+
"<extra_id_59>",
|
| 66 |
+
"<extra_id_60>",
|
| 67 |
+
"<extra_id_61>",
|
| 68 |
+
"<extra_id_62>",
|
| 69 |
+
"<extra_id_63>",
|
| 70 |
+
"<extra_id_64>",
|
| 71 |
+
"<extra_id_65>",
|
| 72 |
+
"<extra_id_66>",
|
| 73 |
+
"<extra_id_67>",
|
| 74 |
+
"<extra_id_68>",
|
| 75 |
+
"<extra_id_69>",
|
| 76 |
+
"<extra_id_70>",
|
| 77 |
+
"<extra_id_71>",
|
| 78 |
+
"<extra_id_72>",
|
| 79 |
+
"<extra_id_73>",
|
| 80 |
+
"<extra_id_74>",
|
| 81 |
+
"<extra_id_75>",
|
| 82 |
+
"<extra_id_76>",
|
| 83 |
+
"<extra_id_77>",
|
| 84 |
+
"<extra_id_78>",
|
| 85 |
+
"<extra_id_79>",
|
| 86 |
+
"<extra_id_80>",
|
| 87 |
+
"<extra_id_81>",
|
| 88 |
+
"<extra_id_82>",
|
| 89 |
+
"<extra_id_83>",
|
| 90 |
+
"<extra_id_84>",
|
| 91 |
+
"<extra_id_85>",
|
| 92 |
+
"<extra_id_86>",
|
| 93 |
+
"<extra_id_87>",
|
| 94 |
+
"<extra_id_88>",
|
| 95 |
+
"<extra_id_89>",
|
| 96 |
+
"<extra_id_90>",
|
| 97 |
+
"<extra_id_91>",
|
| 98 |
+
"<extra_id_92>",
|
| 99 |
+
"<extra_id_93>",
|
| 100 |
+
"<extra_id_94>",
|
| 101 |
+
"<extra_id_95>",
|
| 102 |
+
"<extra_id_96>",
|
| 103 |
+
"<extra_id_97>",
|
| 104 |
+
"<extra_id_98>",
|
| 105 |
+
"<extra_id_99>"
|
| 106 |
+
],
|
| 107 |
+
"is_local": false,
|
| 108 |
+
"local_files_only": false,
|
| 109 |
+
"model_max_length": 512,
|
| 110 |
+
"pad_token": "<pad>",
|
| 111 |
+
"sp_model_kwargs": {},
|
| 112 |
+
"tokenizer_class": "T5Tokenizer",
|
| 113 |
+
"unk_token": "<unk>"
|
| 114 |
+
}
|