Update README.md
Browse files
README.md
CHANGED
@@ -38,10 +38,8 @@ ikedachin/llm-jp-3-13b-october-news-e1-all-3-5
|
|
38 |
|
39 |
# 実行方法
|
40 |
## ライブラリインストール
|
41 |
-
**エラーが発生した場合は再実行し、エラーがないことを確認すること**
|
42 |
```
|
43 |
-
|
44 |
-
!pip install datasets
|
45 |
```
|
46 |
|
47 |
## 実行コード
|
@@ -50,13 +48,9 @@ ikedachin/llm-jp-3-13b-october-news-e1-all-3-5
|
|
50 |
```Python
|
51 |
# import libraries
|
52 |
import tqdm
|
53 |
-
import datasets
|
54 |
import torch
|
55 |
from datasets import load_dataset
|
56 |
-
from transformers import
|
57 |
-
AutoModelForCausalLM,
|
58 |
-
AutoTokenizer,
|
59 |
-
)
|
60 |
|
61 |
# config
|
62 |
model_id = "ikedachin/llm-jp-3-13b-october-news-250128-1-merged-sft-1-bf16_merged"
|
@@ -76,10 +70,7 @@ tokenizer = AutoTokenizer.from_pretrained(model_id, token=HF_TOKEN)
|
|
76 |
|
77 |
# define inference function
|
78 |
def generate_from_model(input):
|
79 |
-
prompt = f"""###
|
80 |
-
{input}
|
81 |
-
### 回答
|
82 |
-
"""
|
83 |
input = tokenizer(prompt, return_tensors='pt', add_special_tokens=True).to(model.device)
|
84 |
input.pop('token_type_ids')
|
85 |
output = model.generate(**input, max_new_tokens = 1000, use_cache = False, do_sample=False, repetition_penalty=1.2)
|
|
|
38 |
|
39 |
# 実行方法
|
40 |
## ライブラリインストール
|
|
|
41 |
```
|
42 |
+
pip install transformers
|
|
|
43 |
```
|
44 |
|
45 |
## 実行コード
|
|
|
48 |
```Python
|
49 |
# import libraries
|
50 |
import tqdm
|
|
|
51 |
import torch
|
52 |
from datasets import load_dataset
|
53 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
|
|
|
|
54 |
|
55 |
# config
|
56 |
model_id = "ikedachin/llm-jp-3-13b-october-news-250128-1-merged-sft-1-bf16_merged"
|
|
|
70 |
|
71 |
# define inference function
|
72 |
def generate_from_model(input):
|
73 |
+
prompt = f"""### 指示\n{input}\n### 回答\n"""
|
|
|
|
|
|
|
74 |
input = tokenizer(prompt, return_tensors='pt', add_special_tokens=True).to(model.device)
|
75 |
input.pop('token_type_ids')
|
76 |
output = model.generate(**input, max_new_tokens = 1000, use_cache = False, do_sample=False, repetition_penalty=1.2)
|