Downloads · 30 days
0
sabia0080/llm-jp-3-13b-it-b01_lora
llm-jp-3-13b-it-b01_lora is a machine learning model from sabia0080. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
このモデルはllm-jp-3-13bをベースにEvolutionary Alpaca Generation 3のデータセットでファインチューニングを行ったLoRAアダプタです。
Downloads · 30 days
0
Access
Public
Updated Dec 26, 2024
Repo size
501 MB
Likes
0
Public
Click a slice to open those files.
.safetensors501 MB · 99%
From the Hugging Face model README
このモデルはllm-jp-3-13bをベースにEvolutionary Alpaca Generation 3のデータセットでファインチューニングを行ったLoRAアダプタです。
学習データは以下の手順で前処理を行いました:
from datasets import load_dataset
# データセットの読み込み
processor = DatasetProcessor()
processor.load_and_process_dataset(
dataset_name="GENIAC-Team-Ozaki/Evol-Alpaca-gen3-500_cleaned",
instruction_column="instruction",
output_column="output",
input_column="input",
transform_type="basic"
)
# 処理済みデータをJSONとして保存
processor.save_combined_dataset("evol_alpaca_dataset.json")
本READMEの手順に従うことで、提出したjsonlファイルと同様の出力を再現することができます。再現性を確保するため、以下の点に注意してください:
ELYZA-tasks-100-TVのベンチマーク出力を生成するための手順:
import os
import torch
import json
from tqdm import tqdm
from unsloth import FastLanguageModel, is_bfloat16_supported
# 必要なパッケージのインストール
!pip uninstall unsloth -y
!pip install --upgrade --no-cache-dir "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
!pip install --upgrade torch xformers
# GPU設定の確認
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
print(f"Using device: {device}")
# モデルとトークナイザーの読み込み
max_seq_length = 512
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="[YOUR_USERNAME]/llm-jp-3-13b-it-b01_lora",
dtype=None,
load_in_4bit=True,
trust_remote_code=True,
)
# 推論モードに設定
FastLanguageModel.for_inference(model)
model = model.to(device)
# 評価用データの読み込み
datasets = []
with open("elyza-tasks-100-TV_0.jsonl", "r") as f:
item = ""
for line in f:
line = line.strip()
item += line
if item.endswith("}"):
datasets.append(json.loads(item))
item = ""
# モデルを推論モードに設定し、推論を実行
FastLanguageModel.for_inference(model)
results = []
for dt in tqdm(datasets):
input = dt["input"]
prompt = f"""### 指示\n{input}\n### 回答\n"""
inputs = tokenizer([prompt], return_tensors="pt").to(device)
outputs = model.generate(
**inputs,
max_new_tokens=512,
use_cache=True,
do_sample=False,
repetition_penalty=1.2
)
prediction = tokenizer.decode(outputs[0], skip_special_tokens=True).split('\n### 回答')[-1]
results.append({
"task_id": dt["task_id"],
"input": input,
"output": prediction
})
# 結果をjsonl形式で保存
output_file = "llm-jp-3-13b-it-b01_output.jsonl"
with open(output_file, 'w', encoding='utf-8') as f:
for result in results:
json.dump(result, f, ensure_ascii=False)
f.write('\n')
print(f"Output saved to {output_file}")
必要なファイル:
出力ファイル:
モデルは以下の設定で学習を行いました:
このモデルは、元のllm-jp-3-13bおよびEvolutionary Alpacaデータセットのライセンスに従います。商用利用の際は、各ライセンスをご確認ください。
このモデルを使用する場合は、以下を引用してください:
@misc{llm-jp-3-13b-it-b01,
author = {[YOUR_NAME]},
title = {llm-jp-3-13b-it-b01: Instruction-tuned LLM-JP-3-13B with QLoRA},
year = {2024},
publisher = {Hugging Face},
journal = {Hugging Face Hub},
howpublished = {\url{https://huggingface.co/[YOUR_USERNAME]/llm-jp-3-13b-it-b01_lora}},
}
This llama model was trained 2x faster with Unsloth and Huggingface's TRL library.