Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
|
2 |
```
|
3 |
!pip install -U bitsandbytes
|
@@ -18,9 +19,7 @@ from peft import PeftModel
|
|
18 |
import torch
|
19 |
from tqdm import tqdm
|
20 |
import json
|
21 |
-
```
|
22 |
|
23 |
-
```
|
24 |
model_id = "sarashi0811/llm2024_v3"
|
25 |
|
26 |
# QLoRA config
|
@@ -39,9 +38,7 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
39 |
|
40 |
# Load tokenizer
|
41 |
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
42 |
-
```
|
43 |
|
44 |
-
```
|
45 |
# データセットの読み込み。
|
46 |
# omnicampusの開発環境では、左にタスクのjsonlをドラッグアンドドロップしてから実行。
|
47 |
datasets = []
|
@@ -53,9 +50,7 @@ with open("./elyza-tasks-100-TV_0.jsonl", "r") as f:
|
|
53 |
if item.endswith("}"):
|
54 |
datasets.append(json.loads(item))
|
55 |
item = ""
|
56 |
-
```
|
57 |
|
58 |
-
```
|
59 |
results = []
|
60 |
for data in tqdm(datasets):
|
61 |
|
@@ -80,9 +75,7 @@ for data in tqdm(datasets):
|
|
80 |
output = tokenizer.decode(outputs[tokenized_input.size(1):], skip_special_tokens=True)
|
81 |
|
82 |
results.append({"task_id": data["task_id"], "input": input, "output": output})
|
83 |
-
```
|
84 |
|
85 |
-
```
|
86 |
import re
|
87 |
jsonl_id = re.sub(".*/", "", "check")
|
88 |
with open(f"./{jsonl_id}-outputs.jsonl", 'w', encoding='utf-8') as f:
|
|
|
1 |
+
以下、推論用のコードになります。
|
2 |
|
3 |
```
|
4 |
!pip install -U bitsandbytes
|
|
|
19 |
import torch
|
20 |
from tqdm import tqdm
|
21 |
import json
|
|
|
22 |
|
|
|
23 |
model_id = "sarashi0811/llm2024_v3"
|
24 |
|
25 |
# QLoRA config
|
|
|
38 |
|
39 |
# Load tokenizer
|
40 |
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
|
|
41 |
|
|
|
42 |
# データセットの読み込み。
|
43 |
# omnicampusの開発環境では、左にタスクのjsonlをドラッグアンドドロップしてから実行。
|
44 |
datasets = []
|
|
|
50 |
if item.endswith("}"):
|
51 |
datasets.append(json.loads(item))
|
52 |
item = ""
|
|
|
53 |
|
|
|
54 |
results = []
|
55 |
for data in tqdm(datasets):
|
56 |
|
|
|
75 |
output = tokenizer.decode(outputs[tokenized_input.size(1):], skip_special_tokens=True)
|
76 |
|
77 |
results.append({"task_id": data["task_id"], "input": input, "output": output})
|
|
|
78 |
|
|
|
79 |
import re
|
80 |
jsonl_id = re.sub(".*/", "", "check")
|
81 |
with open(f"./{jsonl_id}-outputs.jsonl", 'w', encoding='utf-8') as f:
|