Views
No views yet
sample_10BT, the first 2.3B tokens (Chinchilla-optimal budget for a 117M
model)training_log.jsonl and samples.jsonl in this repository.1import torch
2from transformers import GPT2LMHeadModel, AutoTokenizer
3
4model = GPT2LMHeadModel.from_pretrained("sakasegawa/gpt2-jp-small")
5tok = AutoTokenizer.from_pretrained("sakasegawa/gpt2-jp-small")
6
7enc = tok("日本の首都は", return_tensors="pt")
8y = model.generate(enc.input_ids, attention_mask=enc.attention_mask,
9 max_new_tokens=60, do_sample=True, top_k=40,
10 temperature=0.8, pad_token_id=tok.eos_token_id)
11print(tok.decode(y[0], skip_special_tokens=True))LlamaTokenizerFast so that AutoTokenizer.from_pretrained works directly.
Special tokens reuse the IDs that already exist in the SentencePiece vocab
(<unk>=0, <|endoftext|>=1, <|pad|>=2). The conversion + push script
from the nanoGPT checkpoint to this HF-compatible layout is at
scripts/04_push_to_hub.py.