VOOZH about

URL: https://huggingface.co/thesugar/llm-jp-3-13b-it_lora-DPO-12-16

⇱ thesugar/llm-jp-3-13b-it_lora-DPO-12-16 · Hugging Face


Uploaded model

  • Developed by: thesugar
  • License: CC-BY-NC-SA
  • Finetuned from model : llm-jp/llm-jp-3-13b

This llama model was trained 2x faster with Unsloth and Huggingface's TRL library.

👁 Image

HOW TO INFERENCE for competition evaluators

Google Colab L4 で実行

!pip install unsloth
!pip uninstall unsloth -y && pip install --upgrade --no-cache-dir --no-deps git+https://github.com/unslothai/unsloth.git

HF_TOKEN = # WRITE YOUR HF_TOKEN
ELYZA_TASKS_100_TV_JSONL_PATH = # WRITE
# Output for elyza-tasks-100-tv is saved as "output.jsonl"


from huggingface_hub import login
login(HF_TOKEN)

from unsloth import FastLanguageModel
import torch

max_seq_length = 2048
dtype = torch.bfloat16
load_in_4bit = True
model, tokenizer = FastLanguageModel.from_pretrained(
 model_name = "thesugar/llm-jp-3-13b-it_lora-DPO-12-16",
 max_seq_length = max_seq_length,
 dtype = dtype,
 load_in_4bit = load_in_4bit,
 token = HF_TOKEN,
)

import json
datasets = []
with open(ELYZA_TASKS_100_TV_JSONL_PATH, "r") as f:
 item = ""
 for line in f:
 line = line.strip()
 item += line
 if item.endswith("}"):
 datasets.append(json.loads(item))
 item = ""

from tqdm import tqdm

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(model.device)

 outputs = model.generate(**inputs, max_new_tokens = 2048, 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("output.jsonl", "w") as f:
 for r in results:
 f.write(json.dumps(r, ensure_ascii=False) + "\n")

Development steps

  • llm-jp/llm-jp-3-13b を量子化
  • インストラクションチューニング
    • ichikara-instruction データセットの ichikara-instruction-003-001-1.json の全データを使用
  • direct policy optimization
    • weblab-GENIAC/aya-ja-nemotron-dpo-masked からランダムに選択した 100 レコードを使用

Used datasets and their licenses

ichikara-instruction: LLMのための日本語インストラクションデータ

関根聡, 安藤まや, 後藤美知子, 鈴木久美, 河原大輔, 井之上直也, 乾健太郎. ichikara-instruction: LLMのための日本語インストラクションデータの構築. 言語処理学会第30回年次大会(2024) CC-BY-NC-SA

weblab-GENIAC/aya-ja-nemotron-dpo-masked

weblab-GENIAC
weblab-GENIAC/aya-ja-nemotron-dpo-masked
Apache License 2.0

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for thesugar/llm-jp-3-13b-it_lora-DPO-12-16

Finetuned
(1082)
this model

Dataset used to train thesugar/llm-jp-3-13b-it_lora-DPO-12-16