Downloads · 30 days
33
4% of all-time downloads
telecomadm1145/NanoSakura-0.3B
NanoSakura-0.3B is a translation model from telecomadm1145. Use it when you need text moved from one language to another. It is set up for transformers. The card lists the license as mit.
This model is a highly efficient, custom-built Hybrid Sequence-to-Sequence (Seq2Seq) model designed for Japanese to Chinese translation. It combines the deep understanding capabilities of a Transformer Encoder with th…
Downloads · 30 days
33
4% of all-time downloads
All-time downloads
874
Public
Parameters
287M
1.7 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors575 MB · 99%
From the Hugging Face model README
This model is a highly efficient, custom-built Hybrid Sequence-to-Sequence (Seq2Seq) model designed for Japanese to Chinese translation. It combines the deep understanding capabilities of a Transformer Encoder with the blazing-fast, memory-efficient generation of a Mamba2 (State Space Model) Decoder.
Traditional Seq2Seq models (like T5 or BART) rely entirely on Transformers. While powerful, the self-attention mechanism in the decoder leads to an $O(N^2)$ computational bottleneck and high KV-cache memory usage during text generation.
This model solves that by introducing a Hybrid Architecture:
With only ~287 Million parameters, it achieves excellent translation quality while maintaining an extremely low hardware footprint, making it ideal for edge deployment or high-throughput API services.
Because this model uses a custom architecture, you must use trust_remote_code=True when loading it with the transformers library. The custom modeling_mamba2_s2s.py will handle the $O(1)$ Mamba2 cache generation automatically.
Use the code below to get started:
import torch
from transformers import AutoModelForSeq2SeqLM, PreTrainedTokenizerFast
repo_id = "telecomadm1145/NanoSakura-0.3B"
device = "cuda" if torch.cuda.is_available() else "cpu"
tokenizer = PreTrainedTokenizerFast.from_pretrained(repo_id)
model = AutoModelForSeq2SeqLM.from_pretrained(
repo_id,
trust_remote_code=True,
dtype=torch.float32
)
model.to(device)
text = "おはようございます、今日の天気はいいですね!"
input_ids = tokenizer.encode(text + "<eos>")
input_tensor = torch.tensor([input_ids]).to(device)
output_ids = model.generate(
input_tensor,
max_new_tokens=256,
bos_token_id=1,
eos_token_id=2
)
result = tokenizer.decode(output_ids[0], skip_special_tokens=True)
print(f"Translation: {result}")
# Output: 早安,今天的天气真好呢!
We evaluated the model on the FLORES-200 benchmark (Japanese to Chinese, ja-zh) and a testset(shard_00134). To provide a comprehensive assessment, we report both lexical-overlap metrics (SacreBLEU) and semantic-similarity neural metrics (COMET).
| Metric | opus-mt-ja-zh(~73M) | NanoSakura-0.3B | nllb-200-1.3B | Qwen3-0.6B(fp16) | Qwen3-0.6B(fp16,thinking) | Qwen3-1.7B(fp16) | Qwen3-1.7B(fp16,thinking) |
|---|---|---|---|---|---|---|---|
| FLORES-200 BLEU | 25.67 | 22.36 | 20.87 | 12.58 | 21.13 | 27.12 | 27.56 |
| FLORES-200 COMET | 0.8371 | 0.8307 | 0.7805 | 0.8020 | 0.8220 | 0.8561 | 0.8571 |
| shard_00134 BLEU | 8.07 | 58.71 | 5.73 | 6.89 | 14.57 | 23.37 | 24.60 |
| shard_00134 COMET | 0.4493 | 0.8654 | 0.5181 | 0.6930 | 0.7414 | 0.8158 | 0.8182 |
All evaluated using greedy decoding.