Downloads · 30 days
0
sabia0080/llm-jp-3-13b-it-b01-conservative_lora
llm-jp-3-13b-it-b01-conservative_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
250 MB
Likes
0
Public
Click a slice to open those files.
.safetensors250 MB · 98%
From the Hugging Face model README
このモデルは、llm-jp-3-13bをベースに、Evolutionary Alpaca Generation 3のデータセットでファインチューニングを行った LoRA アダプタです。
学習データは以下の手順で前処理を行いました:
from datasets import load_dataset
# データセットの読み込み
dataset = load_dataset("json", data_files="./evol_alpaca_dataset.json")
# プロンプトフォーマットの定義と適用
prompt = """### 指示\n{}\n### 回答\n{}"""
def formatting_prompts_func(examples):
instruction = examples["instruction"]
if examples.get("input"):
instruction = f"{instruction}\n{examples['input']}"
text = prompt.format(instruction, examples["output"]) + EOS_TOKEN
return {"formatted_text": text}
# データセットにフォーマットを適用
dataset = dataset.map(
formatting_prompts_func,
num_proc=4
)
本READMEの手順に従うことで、提出したjsonlファイルと同様の出力を再現することができます。再現性を確保するため、以下の点に注意してください:
ELYZA-tasks-100-TVのベンチマーク出力を生成するための手順:
import torch
from unsloth import FastLanguageModel
from tqdm import tqdm
max_seq_length = 512
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="[YOUR_USERNAME]/llm-jp-3-13b-it-b01-conservative_lora",
dtype=None,
load_in_4bit=True,
trust_remote_code=True,
)
FastLanguageModel.for_inference(model)
import json
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 = ""
results = []
for dt in tqdm(datasets):
input = dt["input"]
prompt = f"""### 指示\n{input}\n### 回答\n"""
inputs = tokenizer([prompt], return_tensors="pt").to(model.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
})
with open("llm-jp-3-13b-it-b01-conservative_output.jsonl", 'w', encoding='utf-8') as f:
for result in results:
json.dump(result, f, ensure_ascii=False)
f.write('\n')
モデルは以下の設定で学習を行いました:
このモデルは、元のllm-jp-3-13bおよびEvolutionary Alpacaデータセットのライセンスに従います。商用利用の際は、各ライセンスをご確認ください。
このモデルを使用する場合は、以下を引用してください:
@misc{llm-jp-3-13b-it-b01-conservative,
author = {[YOUR_NAME]},
title = {llm-jp-3-13b-it-b01-conservative: Instruction-tuned LLM-JP-3-13B},
year = {2024},
publisher = {Hugging Face},
journal = {Hugging Face Hub},
howpublished = {\url{https://huggingface.co/[YOUR_USERNAME]/llm-jp-3-13b-it-b01-conservative_lora}},
}