ai4bharat / Cadence-Fast

huggingface.co
Total runs: 5.7K
24-hour runs: 117
7-day runs: -669
30-day runs: 3.3K
Model's Last Updated: November 21 2025
token-classification

Introduction of Cadence-Fast

Model Details of Cadence-Fast

Cadence-Fast

A multilingual punctuation restoration model based on Gemma-3-270M. Cadence-Fast supports English and 22 other Indian langauges.

Cadence-Fast is distilled from ai4bharat/Cadence for punctuation prediction on English and Indic languages text. Cadence-Fast achieves over 93.8% performance of Cadence at a much faster speed.

arXiv Mark My Words: A Robust Multilingual Model for Punctuation in Text and Speech Transcripts
Model Description
  • Model Type : Token Classification (Punctuation Prediction)
  • Base Model : Gemma-3-270M
  • Languages : English + 22 Indic Languages
  • Task : Automatic punctuation restoration
Installation (Optional)

Python package has features such as sliding-window decoding, (rule-based) capitalisation of English text and some (rule-based) corrections for the errors made by the model.

pip install cadence-punctuation
Quick Start
Using the python package (Recommended)
from Cadence import PunctuationModel

# Load model from local path or downloads at the specified directory
model = PunctuationModel(model="Cadence-Fast","path/to/model")

# Punctuate single text
text = "hello world how are you today"
result = model.punctuate([text])
print(result[0])  # "Hello world, how are you today?"

# Punctuate multiple texts
texts = [
    "hello world how are you",
    "this is another test sentence",
    "यह एक हिंदी वाक्य है"  # Hindi example
]
results = model.punctuate(texts, batch_size=8)
for original, punctuated in zip(texts, results):
    print(f"Original: {original}")
    print(f"Punctuated: {punctuated}")
    print()
Using AutoModel
from transformers import AutoTokenizer, AutoModel
import torch
# Load model and tokenizer
model_name = "ai4bharat/Cadence-Fast"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModel.from_pretrained(model_name, trust_remote_code=True)
id2label = model.config.id2label
text = "यह एक वाक्य है इसका क्या मतलब है"
# text = "this is a test sentence what do you think"
# Tokenize input and prepare for model
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
input_ids = inputs['input_ids'][0] # Get input_ids for the first (and only) sentence
with torch.no_grad():
    outputs = model(**inputs)
    predictions_for_sentence = torch.argmax(outputs.logits, dim=-1)[0]
result_tokens_and_punctuation = []
all_token_strings = tokenizer.convert_ids_to_tokens(input_ids.tolist()) # Get all token strings
for i, token_id_value in enumerate(input_ids.tolist()):
    # Process only non-padding tokens based on the attention mask
    if inputs['attention_mask'][0][i] == 0:
        continue
    current_token_string = all_token_strings[i]
    is_special_token = token_id_value in tokenizer.all_special_ids
    
    if not is_special_token:
        result_tokens_and_punctuation.append(current_token_string)
    
    predicted_punctuation_id = predictions_for_sentence[i].item()
    punctuation_character = id2label[predicted_punctuation_id]
    if punctuation_character != "O" and not is_special_token:
        result_tokens_and_punctuation.append(punctuation_character)
punctuated_text = tokenizer.convert_tokens_to_string(result_tokens_and_punctuation)
print(f"Original Text: {text}")
print(f"Punctuated Text: {punctuated_text}")
Officially Supported Languages
  • English, Assamese, Bengali, Bodo, Dogri, Gujarati, Hindi, Kannada, Kashmiri, Konkani, Maithili, Malayalam, Manipuri, Marathi, Nepali, Odia, Punjabi, Sanskrit, Santali, Sindhi, Tamil, Telugu, Urdu

Tokenizer doesn't support Manipuri's Meitei script well. The model can punctuate if the text is transliterated to Bengali's script.

One can try using this model for languages not listed above. Performance may vary.

Supported Punctuation

The model can predict the following punctuation marks:

  • Period (.)
  • Comma (,)
  • Question mark (?)
  • Exclamation mark (!)
  • Semicolon (;)
  • Colon (:)
  • Hyphen (-)
  • Quotes (" and ')
  • Ellipse (...)
  • Parentheses ()
  • Hindi Danda (।)
  • Urdu punctuation (۔، ؟)
  • Arabic punctuation (٬ ،)
  • Santali punctuation (᱾ ᱾।)
  • Sanskrit punctuation (॥)
  • And various combinations
Configuration Options for cadence-puncuation
PunctuationModel Parameters

All the parameters are optional to pass.

  • model : Can be choosen between "Cadence" (based on Gemma-3-1B) and "Cadence-Fast" (based on Gemma-3-270M). (default: "Cadence")
  • model_path : Path to a local directory where model weights will be downloaded to and cached, or from which pre-downloaded weights will be loaded. If None, weights downloaded to default HuggingFace cache location.
  • gpu_id : Specific GPU device ID to use (e.g., 0, 1). If None, the model will attempt to auto-detect and use an available GPU. This parameter is ignored if cpu is True. (default: None)
  • cpu : If True, forces the model to run on the CPU, even if a GPU is available. (default: False)
  • max_length : Maximum sequence length the model can process at once. If sliding_window is True, this value is used as the width of each sliding window. If sliding_window is False, texts longer than max_length will be truncated. (default: 300)
  • attn_implementation : The attention implementation to use. (default: "eager")
  • sliding_window : If True, enables sliding window mechanism to process texts longer than max_length. The text is split into overlapping chunks of max_length. If False, texts longer than max_length are truncated. (default: True)
  • verbose : Enable verbose logging. (default: False)
  • d_type : Precision with which weights are loaded. (default: bfloat16)
  • batch_size ((for punctuate() method)): Batch size to use. (default: 8)
# Custom configuration
model = PunctuationModel(
    model="Cadence-Fast"
    model_path="path/to/download/weights",
    gpu_id=0,  # Use specific GPU
    max_length=512,  # length for trunation; also used as window size when sliding_window=True
    attn_implementation="flash_attention_2",
    sliding_window=True,  # Handle long texts
    verbose=False,  # Quiet mode
    d_type="bfloat16"
)
batch_size=32 
# Process long texts with sliding window
long_text = "Your very long text here..." * 100
short_text = "a short text"
result = model.punctuate([long_text, short_text],batch_size=batch_size)
License

MIT License

Runs of ai4bharat Cadence-Fast on huggingface.co

5.7K
Total runs
117
24-hour runs
-742
3-day runs
-669
7-day runs
3.3K
30-day runs

More Information About Cadence-Fast huggingface.co Model

More Cadence-Fast license Visit here:

https://choosealicense.com/licenses/mit

Cadence-Fast huggingface.co

Cadence-Fast huggingface.co is an AI model on huggingface.co that provides Cadence-Fast's model effect (), which can be used instantly with this ai4bharat Cadence-Fast model. huggingface.co supports a free trial of the Cadence-Fast model, and also provides paid use of the Cadence-Fast. Support call Cadence-Fast model through api, including Node.js, Python, http.

ai4bharat Cadence-Fast online free

Cadence-Fast huggingface.co is an online trial and call api platform, which integrates Cadence-Fast's modeling effects, including api services, and provides a free online trial of Cadence-Fast, you can try Cadence-Fast online for free by clicking the link below.

ai4bharat Cadence-Fast online free url in huggingface.co:

https://huggingface.co/ai4bharat/Cadence-Fast

Cadence-Fast install

Cadence-Fast is an open source model from GitHub that offers a free installation service, and any user can find Cadence-Fast on GitHub to install. At the same time, huggingface.co provides the effect of Cadence-Fast install, users can directly use Cadence-Fast installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

Cadence-Fast install url in huggingface.co:

https://huggingface.co/ai4bharat/Cadence-Fast

Url of Cadence-Fast

Cadence-Fast huggingface.co Url

Provider of Cadence-Fast huggingface.co

ai4bharat
ORGANIZATIONS

Other API from ai4bharat

huggingface.co

Total runs: 240.9K
Run Growth: -11.3K
Growth Rate: -4.67%
Updated:August 08 2022
huggingface.co

Total runs: 30.5K
Run Growth: 2.8K
Growth Rate: 9.09%
Updated:October 06 2026
huggingface.co

Total runs: 9.3K
Run Growth: -649
Growth Rate: -7.00%
Updated:December 21 2022
huggingface.co

Total runs: 3.6K
Run Growth: 3.0K
Growth Rate: 84.05%
Updated:November 19 2025
huggingface.co

Total runs: 2.7K
Run Growth: -331
Growth Rate: -12.27%
Updated:August 08 2022
huggingface.co

Total runs: 654
Run Growth: -1.4K
Growth Rate: -189.17%
Updated:March 11 2024
huggingface.co

Total runs: 371
Run Growth: 258
Growth Rate: 69.54%
Updated:June 01 2022
huggingface.co

Total runs: 132
Run Growth: 38
Growth Rate: 28.79%
Updated:September 01 2026
huggingface.co

Total runs: 101
Run Growth: 12
Growth Rate: 11.88%
Updated:October 18 2024
huggingface.co

Total runs: 90
Run Growth: 11
Growth Rate: 12.22%
Updated:October 18 2024
huggingface.co

Total runs: 86
Run Growth: -2
Growth Rate: -2.33%
Updated:October 18 2024
huggingface.co

Total runs: 85
Run Growth: 12
Growth Rate: 14.12%
Updated:October 18 2024