Sumi
Collection
1 item • Updated
How to use tohoku-nlp/sumi-7b with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="tohoku-nlp/sumi-7b", trust_remote_code=True) # Load model directly
from transformers import AutoModelForMaskGeneration
model = AutoModelForMaskGeneration.from_pretrained("tohoku-nlp/sumi-7b", trust_remote_code=True, dtype="auto")How to use tohoku-nlp/sumi-7b with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "tohoku-nlp/sumi-7b"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "tohoku-nlp/sumi-7b",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/tohoku-nlp/sumi-7b
How to use tohoku-nlp/sumi-7b with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "tohoku-nlp/sumi-7b" \
--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": "tohoku-nlp/sumi-7b",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "tohoku-nlp/sumi-7b" \
--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": "tohoku-nlp/sumi-7b",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use tohoku-nlp/sumi-7b with Docker Model Runner:
docker model run hf.co/tohoku-nlp/sumi-7b
We recommend transformers==5.8.1.
For more details, please refer to our project page and technical report.
import torch
from transformers import AutoModelForMaskGeneration, AutoTokenizer
model_id = "tohoku-nlp/sumi-7b"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForMaskGeneration.from_pretrained(
model_id, trust_remote_code=True, dtype=torch.bfloat16
).to("cuda").eval()
prompt = "Our journey into exploring diffusion language model begins,"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
out = model.generate(
**inputs,
max_new_tokens=256, # content budget; the EOS/BOS delimiter is anchored here
num_denoising_steps=64, # refinement iterations — the main quality/compute dial
sampler="ancestral", # "ancestral" (default) or "adaptive" (sharper, for code/math)
temperature=0.7,
)
print(tokenizer.decode(out.sequences[0], skip_special_tokens=True))
generate() returns the trimmed completion in out.sequences and the full untrimmed canvas in out.canvas.
@misc{ye2026sumi,
title={Sumi: Open Uniform Diffusion Language Model from Scratch},
author={Mengyu Ye and Keito Kudo and Wataru Ikeda and Ryosuke Matsuda and Keisuke Sakaguchi and Jun Suzuki},
year={2026},
eprint={2606.19005},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2606.19005},
}