Downloads · 30 days
0
kazuyamaa/llm-jp-3-13b_r128_int_20241209_2
llm-jp-3-13b_r128_int_20241209_2 is a machine learning model from kazuyamaa. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
0
Access
Public
Updated Dec 23, 2024
Repo size
2 GB
Likes
0
Public
Click a slice to open those files.
.safetensors2 GB · 100%
From the Hugging Face model README
1.本モデルの使い方
本モデルを用いて推論を行うには、「Model_Inference_Template_unsloth.ipynb」に本モデルのリンクを貼り付け、ロードを行い、 そのまま各セルの実行結果出力に従い、.jsonlファイルを出力してください。
model_name変数に「Kazki/llm-jp-3-13b_r128_int_20241209_2」をコピペし、そのままセルを実行してください。 ※new_model_idは任意の変数名で可能
また、max_seq_lenghtとmax_new_tokensはデフォルトの512ですと、出力文字が途中で切れてしまうことがあるため、max_seq_lenghtとmax_new_tokenは2048を前提に設計されています。こちらも、推論時の設定をお忘れないようご注意ください。
その他は、特段変わったことはしていなく、松尾研運営から配布された「Model_Inference_Template_unsloth.ipynb」に従って、実行してください。
base_model: llm-jp/llm-jp-3-13b tags:
This llama model was trained 2x faster with Unsloth and Huggingface's TRL library.
Execute following code in Google Colab
from google.colab import drive
drive.mount('/content/drive')
%%capture
!pip install unsloth
!pip uninstall unsloth -y && pip install --upgrade --no-cache-dir "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
from unsloth import FastLanguageModel
import torch
import json
# モデルのロード
model_name = "Kazki/llm-jp-3-13b_r128_int_20241209_2"
max_seq_length = 2048
dtype = None
load_in_4bit = True
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = model_name,
max_seq_length = max_seq_length,
dtype = dtype,
load_in_4bit = load_in_4bit,
token = "Your Token",
)
FastLanguageModel.for_inference(model)
# データセットの読み込み。
# omnicampusの開発環境では、左にタスクのjsonlをドラッグアンドドロップしてから実行。
datasets = []
with open("/content/drive/MyDrive/2024 LLM/99_最終課題(コンペ)/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 = ""
from tqdm import tqdm
# 推論
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})
# jsonlで保存
new_model_id="llm-jp-3-13b_r128_int_20241209_2"
with open(f"{new_model_id}_output.jsonl", 'w', encoding='utf-8') as f:
for result in results:
json.dump(result, f, ensure_ascii=False)
f.write('\n')
The models have been fine-tuned on the following datasets.
| Language | Dataset | description |
|---|---|---|
| Japanese | GENIAC-Team-Ozaki/databricks-dolly-15k-ja-newans | A manually constructed instruction dataset based on databricks-dolly-15k-ja-newans |
| Synthesized data from Elyza-tasks-100 | Synthesize data from Elyza-tasks-100 by using LLM(llm-jp/llm-jp-3-13b-instruct) |