Downloads · 30 days
0
stephenfitz/llm-jp-13b-instruct-full-jaster-dpo
llm-jp-13b-instruct-full-jaster-dpo is a machine learning model from stephenfitz. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This is a human preference optimized version of the native Japanese model llm-jp/llm-jp-13b-instruct-full-jaster-v1.0.
Downloads · 30 days
0
Access
Public
Updated Feb 8, 2024
Repo size
629 MB
Likes
0
Public
Click a slice to open those files.
.pt419 MB · 66%
From the Hugging Face model README
This is a human preference optimized version of the native Japanese model llm-jp/llm-jp-13b-instruct-full-jaster-v1.0.
Model type: transformer-based large language model
Total tokens seen: 300B
Parameters: 13B
Layers: 40
Hidden size: 5120
Heads: 40
Context length: 2048
Hardware: 96 A100 40GB GPUs (MDX cluster)
Software: Megatron-DeepSpeed
Hardware: 8 A100 40GB GPUs (MDX cluster)
Software: TRL, PEFT, and DeepSpeed
Hardware: Apple MPS device, M3 Max chip, 16-core CPU, 16-core neural engine, 40-core GPU / 128G unified memory
Software: PyTorch (on MPS), HugginFace Transformers, PEFT (version 0.8.2)
The tokenizer of this model is based on huggingface/tokenizers unigram byte-fallback model. The vocabulary entries were converted from llm-jp-tokenizer v2.1 (50k). Please refer to README.md of llm-ja-tokenizer for details on the vocabulary construction procedure.
This model was aligned with human preferences using an adapter approach from the PEFT library (https://github.com/huggingface/peft). The alignment was based on Direct Preference Optimization (https://arxiv.org/abs/2305.18290).
The data used for DPO was a Japanese translation of of the original Anthropic Helpful-Harmless dataset (https://huggingface.co/datasets/Anthropic/hh-rlhf) for Reinforcement Learning from Human Feedback (https://arxiv.org/abs/2204.05862). The translation is available here: https://huggingface.co/datasets/shi3z/anthropic_hh_rlhf_japanese
from peft import AutoPeftModelForCausalLM
from transformers import AutoTokenizer
model_name = "llmjp/llm-jp-13b-instruct-full-jaster-dpo"
model = AutoPeftModelForCausalLM.from_pretrained(
model_name,
low_cpu_mem_usage=True,
torch_dtype=torch.float16,
load_in_4bit=True,
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
inputs = tokenizer.encode("質問:日本の首都はどこですか?\n\n答え:", return_tensors="pt")
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0]))
Stephen Fitz (https://huggingface.co/stephenfitz) for LLMJP (https://huggingface.co/llm-jp)