Update README.md
Browse files
README.md
CHANGED
@@ -9,36 +9,13 @@ tags: []
|
|
9 |
|
10 |
## 使い方
|
11 |
当モデルは[densenet121-dog-emotions](https://huggingface.co/shinyice/densenet121-dog-emotions)と一緒に使うことを前提にしています。<br>
|
12 |
-
|
13 |
```sh
|
14 |
-
from transformers.generation.streamers import TextStreamer
|
15 |
-
from llava.constants import DEFAULT_IMAGE_TOKEN, IMAGE_TOKEN_INDEX
|
16 |
-
from llava.conversation import conv_templates, SeparatorStyle
|
17 |
-
from llava.model.llava_gpt2 import LlavaGpt2ForCausalLM
|
18 |
-
from llava.train.arguments_dataclass import ModelArguments, DataArguments, TrainingArguments
|
19 |
-
from llava.train.dataset import tokenizer_image_token
|
20 |
-
import transformers
|
21 |
-
|
22 |
-
model = LlavaGpt2ForCausalLM.from_pretrained(
|
23 |
-
llava_jp_name,
|
24 |
-
low_cpu_mem_usage=True,
|
25 |
-
use_safetensors=True,
|
26 |
-
torch_dtype=torch_dtype,
|
27 |
-
device_map=device,
|
28 |
-
)
|
29 |
-
tokenizer = transformers.AutoTokenizer.from_pretrained(
|
30 |
-
llava_jp_name,
|
31 |
-
model_max_length=1532,
|
32 |
-
padding_side="right",
|
33 |
-
use_fast=False,
|
34 |
-
)
|
35 |
-
model.eval()
|
36 |
-
|
37 |
-
# プロンプトモード設定(V1)
|
38 |
conv_mode = "v1"
|
39 |
conv = conv_templates[conv_mode].copy()
|
40 |
-
```
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
9 |
|
10 |
## 使い方
|
11 |
当モデルは[densenet121-dog-emotions](https://huggingface.co/shinyice/densenet121-dog-emotions)と一緒に使うことを前提にしています。<br>
|
12 |
+
プロンプトは
|
13 |
```sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
conv_mode = "v1"
|
15 |
conv = conv_templates[conv_mode].copy()
|
|
|
16 |
|
17 |
+
class_names = ['angry', 'happy', 'relaxed', 'sad']
|
18 |
+
emotion = class_names[0]
|
19 |
+
prompt = f"[犬の感情]{emotion}\nあなたは犬です。犬として会話をしてください。"
|
20 |
+
```
|
21 |
+
となっています。
|