Update README.md
Browse files
README.md
CHANGED
@@ -6,17 +6,65 @@ tags:
|
|
6 |
- unsloth
|
7 |
- llama
|
8 |
- trl
|
9 |
-
license:
|
|
|
|
|
10 |
language:
|
11 |
- en
|
12 |
---
|
13 |
-
|
14 |
# Uploaded model
|
15 |
|
16 |
- **Developed by:** RAYU555
|
17 |
-
- **License:** apache-2.0
|
18 |
- **Finetuned from model :** llm-jp/llm-jp-3-13b
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
21 |
|
22 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
- unsloth
|
7 |
- llama
|
8 |
- trl
|
9 |
+
license:
|
10 |
+
- apache-2.0
|
11 |
+
- cc-by-sa-4.0
|
12 |
language:
|
13 |
- en
|
14 |
---
|
|
|
15 |
# Uploaded model
|
16 |
|
17 |
- **Developed by:** RAYU555
|
18 |
+
- **License:** apache-2.0 cc-by-sa-4.0
|
19 |
- **Finetuned from model :** llm-jp/llm-jp-3-13b
|
20 |
|
21 |
+
# 出力方法
|
22 |
+
|
23 |
+
下記のコードを上から実行してください。
|
24 |
+
|
25 |
+
(使用ライブラリなどは適宜自身のpcにあったバージョンの物などをインストールしてから実行してください)
|
26 |
+
|
27 |
+
```
|
28 |
+
"""
|
29 |
+
本リポジトリのモデルを読み込んでから実行してください
|
30 |
+
"""
|
31 |
+
|
32 |
+
import json
|
33 |
+
datasets = []
|
34 |
+
with open("./elyza-tasks-100-TV_0.jsonl", "r") as f:
|
35 |
+
item = ""
|
36 |
+
for line in f:
|
37 |
+
line = line.strip()
|
38 |
+
item += line
|
39 |
+
if item.endswith("}"):
|
40 |
+
datasets.append(json.loads(item))
|
41 |
+
item = ""
|
42 |
+
|
43 |
+
# 学習したモデルを用いてタスクを実行
|
44 |
+
from tqdm import tqdm
|
45 |
+
|
46 |
+
results = []
|
47 |
+
for dt in tqdm(datasets):
|
48 |
+
input = dt["input"]
|
49 |
+
|
50 |
+
prompt = f"""### 指示\n{input}\n### 回答\n"""
|
51 |
+
|
52 |
+
inputs = tokenizer([prompt], return_tensors = "pt").to(model.device)
|
53 |
+
|
54 |
+
outputs = model.generate(**inputs, max_new_tokens = 512, use_cache = True, do_sample=False, repetition_penalty=1.2)
|
55 |
+
prediction = tokenizer.decode(outputs[0], skip_special_tokens=True).split('\n### 回答')[-1]
|
56 |
+
|
57 |
+
results.append({"task_id": dt["task_id"], "input": input, "output": prediction})
|
58 |
+
|
59 |
+
```
|
60 |
+
|
61 |
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
62 |
|
63 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
64 |
+
|
65 |
+
|
66 |
+
Used [ELYZA-tasks-100](https://huggingface.co/datasets/elyza/ELYZA-tasks-100) for fineturning.
|
67 |
+
|
68 |
+
|
69 |
+
ELYZA-tasks-100: 日本語instructionモデル評価データセット © 2023 Akira Sasaki and Masato Hirakawa and Shintaro Horie and Tomoaki Nakamura ([CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)
|
70 |
+
)
|