ryota-komatsu/SylReg
Viewer • Updated • 35.8M • 266
How to use ryota-komatsu/SylReg-LM-7B with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="ryota-komatsu/SylReg-LM-7B")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("ryota-komatsu/SylReg-LM-7B")
model = AutoModelForCausalLM.from_pretrained("ryota-komatsu/SylReg-LM-7B")
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=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use ryota-komatsu/SylReg-LM-7B with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "ryota-komatsu/SylReg-LM-7B"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "ryota-komatsu/SylReg-LM-7B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/ryota-komatsu/SylReg-LM-7B
How to use ryota-komatsu/SylReg-LM-7B with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "ryota-komatsu/SylReg-LM-7B" \
--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": "ryota-komatsu/SylReg-LM-7B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "ryota-komatsu/SylReg-LM-7B" \
--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": "ryota-komatsu/SylReg-LM-7B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use ryota-komatsu/SylReg-LM-7B with Docker Model Runner:
docker model run hf.co/ryota-komatsu/SylReg-LM-7B
Use the code below to get started with the model.
git clone https://github.com/ryota-komatsu/speaker_disentangled_hubert.git
cd speaker_disentangled_hubert
sudo apt install git-lfs # for UTMOS
conda create -y -n py310 -c pytorch -c nvidia -c conda-forge python=3.10 pip=24.0 setuptools=81.0.0 faiss-gpu=1.13.2
conda activate py310
pip install -r requirements/requirements.txt
sh scripts/setup.sh
import re
import torch
import torchaudio
from transformers import AutoModelForCausalLM, AutoTokenizer
from src.flow_matching import FlowMatchingWithBigVGan
from src.s5hubert import SylRegForSyllableDiscovery
wav_path = "/path/to/wav"
# download pretrained models from hugging face hub
encoder = SylRegForSyllableDiscovery.from_pretrained("ryota-komatsu/SylReg-Distill", device_map="cuda", dtype="auto")
decoder = FlowMatchingWithBigVGan.from_pretrained("ryota-komatsu/SylReg-Decoder", device_map="cuda", dtype="auto")
speechlm = AutoModelForCausalLM.from_pretrained("ryota-komatsu/SylReg-LM-7B", device_map="cuda", dtype="auto")
tokenizer = AutoTokenizer.from_pretrained("ryota-komatsu/SylReg-LM-7B")
# load a waveform
waveform, sr = torchaudio.load(wav_path)
waveform = torchaudio.functional.resample(waveform, sr, 16000)
# encode a waveform into syllabic units
outputs = encoder(waveform.to(encoder.device))
units = outputs[0]["units"] # [3950, 67, ..., 503]
# speech language modeling
text = "".join(f"<{unit}>" for unit in units)
input_ids = tokenizer(text, padding=True, return_tensors="pt").input_ids.to(speechlm.device)
generated_ids = speechlm.generate(input_ids=input_ids, do_sample=True, temperature=0.8)[0]
units = tokenizer.decode(generated_ids)
units = torch.tensor([int(unit) for unit in re.findall(r"<(\d+)>", units)], device=decoder.device)
# unit-to-speech synthesis
generated_speech = decoder(units.unsqueeze(0)).waveform.cpu()
| Hours | License | Provider | |
|---|---|---|---|
| LibriSpeech | 960 | CC BY 4.0 | V. Panayotov et al. |
| Libriheavy | 50,978 | public domain | W. Kang et al. |
| Emilia-Large | 4,447 | CC BY 4.0, CC BY-NC 4.0 | H. He et al. |
| People's Speech (clean, clean_sa) | 5,640 | CC-BY, CC-BY-SA | D. Galvez et al. |
| VoxPopuli | 543 | CC0-1.0 | C. Wang et al. |
| TinyStories | 27,810 | cdla-sharing-1.0 | R. Eldan et al. |
| Cosmopedia-v2 | 38,986 | odc-by | L. B. Allal et al. |
| Total | 129,364 |
32 NVIDIA H100 GPUs
BibTeX:
@article{Komatsu_SylReg_2026,
author = {Komatsu, Ryota and Kawakita, Kota and Okamoto, Takuma and Shinozaki, Takahiro},
title = {Speaker-Disentangled Chunk-Wise Regression for Syllabic Tokenization},
year = {2026},
volume = {7},
journal = {IEEE Open Journal of Signal Processing},
pages = {},
}