Instructions to use kuramot6f/classical-smollm2-trunk with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kuramot6f/classical-smollm2-trunk with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kuramot6f/classical-smollm2-trunk")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("kuramot6f/classical-smollm2-trunk") model = AutoModelForCausalLM.from_pretrained("kuramot6f/classical-smollm2-trunk", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kuramot6f/classical-smollm2-trunk with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kuramot6f/classical-smollm2-trunk" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kuramot6f/classical-smollm2-trunk", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/kuramot6f/classical-smollm2-trunk
- SGLang
How to use kuramot6f/classical-smollm2-trunk 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 "kuramot6f/classical-smollm2-trunk" \ --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": "kuramot6f/classical-smollm2-trunk", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "kuramot6f/classical-smollm2-trunk" \ --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": "kuramot6f/classical-smollm2-trunk", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use kuramot6f/classical-smollm2-trunk with Docker Model Runner:
docker model run hf.co/kuramot6f/classical-smollm2-trunk
classical-smollm2-trunk: a language model that has only read pre-1868 texts
A 125M-parameter language model trained from scratch on about 1 billion tokens of texts written before 1868: classical Japanese, Edo-period Japanese and Literary Chinese. It has never seen modern Japanese, English or anything from the web.
It is a research artifact for studying what a model learns from premodern text alone: its vocabulary, its "world knowledge" and its style. It also gives a period-faithful baseline for working with historical documents. It is a base model: it continues text and does not follow instructions. For a conversational version, see classical-smollm2-sft.
Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "kuramot6f/classical-smollm2-trunk"
tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype=torch.bfloat16).eval()
inputs = tok("春はあけぼの", return_tensors="pt")
out = model.generate(**inputs, max_new_tokens=64, do_sample=True, top_p=0.95, temperature=0.8)
print(tok.decode(out[0], skip_special_tokens=True))
trust_remote_code=True is needed only for the small SentencePiece tokenizer wrapper
(classical_tokenizer.py). The model is a standard LlamaForCausalLM.
Model
| architecture | Llama (SmolLM2-135M shape): 30 layers, hidden 576, 9 heads / 3 KV heads, MLP 1536 |
| parameters | 124.6M (tied input/output embeddings) |
| context | 8,192 positions (trained on 2,048-token sequences) |
| vocabulary | 32,000, classical-ja-tokenizer |
| training tokens | 1.00B: NDL 440M, Kanripo 427M, Wikisource 108M, Minna de Honkoku 25M |
Training
- Data: classical-ja-pretrain, train split.
- 30,518 updates, bf16, AdamW (weight decay 0.1), warmup-stable-decay learning-rate schedule. Single GPU, PyTorch + 🤗 Transformers + Accelerate.
- Data mixture: most of training sampled about 50% NDL, 48.5% Kanripo, 1.25% Wikisource and 0.25% Minna de Honkoku. During the final learning-rate decay (updates 24,415–30,518), the mixture moved toward the curated literary sources: 65% Wikisource, 15% Minna de Honkoku, 10% NDL, 10% Kanripo.
- This repo holds the final checkpoint.
training_config.jsonhas the full configuration andmetrics.jsonlthe per-step loss and learning rate.
Limitations
- It is small: generations drift and repeat after a few sentences.
- About 44% of the training tokens are uncorrected OCR, so the model sometimes reproduces OCR noise.
- It knows only what pre-1868 texts say, and their views, including religious, political and social views that may be offensive today. It must not be used as a source of facts.
License
Weights and code: Apache-2.0.
Training data note: the model was trained on texts under several licenses. These are public domain (NDL OCR); CC BY-SA 4.0 (Kanripo, Wikisource, Minna de Honkoku); and CC BY-NC-SA 3.0 TW for CBETA-derived Buddhist texts, about 13% of the corpus tokens. See the dataset LICENSES. The license on the weights does not change the licenses of the training texts. If the model reproduces a passage from its training data, that passage stays under its original license.
- Downloads last month
- 18