Text Generation
Transformers
Safetensors
Chinese
English
qwen3
transcript-normalization
chinese
qwen3-asr
code-switching
full-finetuning
numbered-lists
numeric-normalization
conversational
text-generation-inference
Instructions to use WIlfLin/S1-mini-Chinese with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use WIlfLin/S1-mini-Chinese with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="WIlfLin/S1-mini-Chinese") 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("WIlfLin/S1-mini-Chinese") model = AutoModelForCausalLM.from_pretrained("WIlfLin/S1-mini-Chinese", 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 WIlfLin/S1-mini-Chinese with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "WIlfLin/S1-mini-Chinese" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "WIlfLin/S1-mini-Chinese", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/WIlfLin/S1-mini-Chinese
- SGLang
How to use WIlfLin/S1-mini-Chinese 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 "WIlfLin/S1-mini-Chinese" \ --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": "WIlfLin/S1-mini-Chinese", "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 "WIlfLin/S1-mini-Chinese" \ --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": "WIlfLin/S1-mini-Chinese", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use WIlfLin/S1-mini-Chinese with Docker Model Runner:
docker model run hf.co/WIlfLin/S1-mini-Chinese
File size: 2,067 Bytes
eb970af 99de2e5 eb970af 99de2e5 eb970af 99de2e5 eb970af 99de2e5 eb970af | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | """Join dictated single-letter runs before the text model, never after it."""
import re
NORMALIZATION_VERSION = "spelled-letter-runs-v2"
# Horizontal whitespace only: distinct lines/paragraphs are not one spelling run.
_RUN = re.compile(r'(?<![A-Za-z0-9_./:@+\-])(?>[A-Za-z](?:(?:[-‐‑‒–—]|[ \t\u00a0]+)[A-Za-z])+)(?![A-Za-z0-9_./:@+\-])')
_LITERAL = re.compile(
r'```[\s\S]*?(?:```|\Z)|`[^`\n]*(?:`|\Z)'
r'|https?://[^\s,。!?;、)]+'
r'|[A-Za-z0-9._%+\-]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,}'
r'|(?:~/|/)[A-Za-z0-9_./~\-]+'
r'|\b[A-Za-z_]\w*\s*(?:==|!=|<=|>=|:=|[+*/\-]?=)\s*[^;\n,。]+'
)
def spelled_letter_runs(text):
"""Yield unambiguous-enough spelling spans, preserving letter order.
Three or more separate letters, or two uppercase space-separated letters.
A two-letter hyphenated expression such as X-Y is left alone.
Literal code, paths, URLs and emails are not interpreted as dictation.
"""
literals=[m.span() for m in _LITERAL.finditer(text)]
for match in _RUN.finditer(text):
a,b=match.span()
if any(a<end and b>start for start,end in literals):continue
letters=re.findall('[A-Za-z]',match[0])
if len(letters)<3 and not (all(c.isupper() for c in letters) and re.search('[ \t\u00a0]',match[0])):continue
yield a,b,''.join(letters).lower()
def sentence_start(text,position):
prefix=text[:position]
line=prefix.rsplit('\n',1)[-1]
if re.fullmatch(r"[ \t]*(?:(?:[-*•]|\d+[.)、])[ \t]+)?[“‘\"'「((\[]*[ \t]*",line):return True
prefix=prefix.rstrip()
while prefix and prefix[-1] in '“‘"\'「(([':
prefix=prefix[:-1].rstrip()
return not prefix or prefix[-1] in '.!?。!?'
def normalize_spelled_letters(text):
pieces=[];position=0;count=0
for start,end,word in spelled_letter_runs(text):
if sentence_start(text,start):word=word.capitalize()
pieces.extend([text[position:start],word]);position=end;count+=1
pieces.append(text[position:])
return ''.join(pieces),count
|