Downloads · 30 days
217
18% of all-time downloads
fukugawa/transformer-lm-japanese-0.1b
transformer-lm-japanese-0.1b is a text generation model from fukugawa. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This is a JAX/Flax-based transformer language model trained on a Japanese dataset. It is based on the official Flax example code (lm1b).
Downloads · 30 days
217
18% of all-time downloads
All-time downloads
1.2K
Public
Repo size
2.6 GB
Likes
0
Public
Click a slice to open those files.
Other1.6 GB · 75%
From the Hugging Face model README
This is a JAX/Flax-based transformer language model trained on a Japanese dataset. It is based on the official Flax example code (lm1b).
We've modified Flax's 'lm1b' example to train on Japanese dataset. You can find the code on Github.
| Model | Params | Layers | Dim | Heads | Dataset | Dataset size | Training time | PPL |
|---|---|---|---|---|---|---|---|---|
| transformer-lm-japanese-0.1b | 0.1B | 12 | 768 | 12 | wiki40b/ja | 2.19GB | 1.5 days | 35.22 |
JGLUE 4-task (2024/05/22)
| Model | Average | JCommonsenseQA | JNLI | MARC-ja | JSQuAD |
|---|---|---|---|---|---|
| transformer-lm-japanese-0.1b | 41.41 | 35.21 | 43.59 | 78.63 | 8.24 |
| Reference: rinna/japanese-gpt-neox-small | 40.75 | 40.39 | 29.13 | 85.48 | 8.02 |
pip install transformers>=4.39.0
pip install jax==0.4.31
pip install flax==0.8.3
pip install sentencepiece==0.1.99
# For CPU
pip install -U "jax[cpu]==0.4.31"
# For GPU
pip install -U "jax[cuda12]==0.4.31"
Note: Set trust_remote_code=True to load our custom model.
from transformers import AutoTokenizer, FlaxAutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("fukugawa/transformer-lm-japanese-0.1b", trust_remote_code=True)
model = FlaxAutoModelForCausalLM.from_pretrained("fukugawa/transformer-lm-japanese-0.1b", trust_remote_code=True)
text = "日本の首都は、"
token_ids = tokenizer.encode(text, return_tensors="jax", add_special_tokens=False)
output_ids = model.generate(
token_ids,
do_sample=True,
temperature=0.6,
top_k=20,
max_new_tokens=100
)
output = tokenizer.decode(output_ids[0][0], skip_special_tokens=True)
print(output)
We tested text generation in a Python 3.10 environment on GCP as follows