Edit model card

AIBunCho/japanese-novel-gpt-j-6b

AI BunChoで利用しているモデルです。2021年に作った小説用言語モデルです。

Model Details

GPT-J-6BをTPUで2週間日本語tokenizerを用いて日本語データで事前学習し、その後2週間小説データで転移学習したものです。

Uses

Google colabのT4 High-RAMで動作確認しています。

pip install transformers sentencepiece accelerate
from transformers import GPTJForCausalLM, AlbertTokenizer
import torch

tokenizer = AlbertTokenizer.from_pretrained('AIBunCho/japanese-novel-gpt-j-6b', keep_accents=True, remove_space=False)

model = GPTJForCausalLM.from_pretrained("AIBunCho/japanese-novel-gpt-j-6b", torch_dtype=torch.float16, low_cpu_mem_usage=True)

model.half()
model.eval()

if torch.cuda.is_available():
    model = model.to("cuda")

prompt = """
わたくしといふ現象は
""".strip()

input_ids = tokenizer.encode(
    prompt,
    add_special_tokens=False,
    return_tensors="pt"
).cuda()

# this is for reproducibility.
# feel free to change to get different result
seed = 27  
torch.manual_seed(seed)

tokens = model.generate(
    input_ids.to(device=model.device),
    max_new_tokens=32,
    temperature=0.6,
    top_p=0.9,
    repetition_penalty=1.2,
    do_sample=True,
    pad_token_id=tokenizer.pad_token_id,
    bos_token_id=tokenizer.bos_token_id,
    eos_token_id=tokenizer.eos_token_id
)

out = tokenizer.decode(tokens[0], skip_special_tokens=True)
print(out)
"""わたくしといふ現象は、その因果律を断ち切ることができるのです。"""

Bias, Risks, and Limitations

The pre-training dataset may have contained offensive or inappropriate content even after applying data cleansing filters which can be reflected in the model generated text. We recommend users exercise reasonable caution when using these models in production systems. Do not use the model for any applications that may cause harm or distress to individuals or groups.

Training Data

cc100の日本語データ

Wikipedia

その他webデータ

Author

X(旧Twitter): @OsoneHiroyuki

Acknowledgements

Google TPU research cloudの支援を受けて学習を行いました。

Appendix

2023/08/26追記 AIBunCho/japanese-novel-gpt-j-6bの1000DLを記念してAI BunChoプランの50%オフクーポンを配布しています 【HF1000DL】を入力するとどのプランでも50%オフになります

Downloads last month
248
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Dataset used to train AIBunCho/japanese-novel-gpt-j-6b