YukiTomita-CC
commited on
Commit
•
49ba7b0
1
Parent(s):
7fb28a1
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# AKU-d_ms-0.5B-chat-v0.1
|
2 |
+
## Overview
|
3 |
+
スクラッチで学習したMistralアーキテクチャの0.5BモデルをさらにSFTとDPOで会話タスクにファインチューニングしたモデルです。
|
4 |
+
|
5 |
+
開発の経緯や開発時のメモ書きは下記のURLを参照ください。
|
6 |
+
[Zenn_記事](https://zenn.dev/yuki127/articles/813e72d026f230)
|
7 |
+
|
8 |
+
## Usage
|
9 |
+
---
|
10 |
+
license: apache-2.0
|
11 |
+
language:
|
12 |
+
- ja
|
13 |
+
---
|
14 |
+
```python
|
15 |
+
import torch
|
16 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
17 |
+
|
18 |
+
model_name = "YukiTomita-CC/AKU-d_ms-0.5B-chat-v0.1"
|
19 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.float32, device_map="auto").to("cuda")
|
20 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=False)
|
21 |
+
|
22 |
+
messages = [
|
23 |
+
{"role": "user", "content": "好きな食べ物は何ですか?"}
|
24 |
+
]
|
25 |
+
|
26 |
+
input_ids = tokenizer.apply_chat_template(
|
27 |
+
messages,
|
28 |
+
return_tensors="pt",
|
29 |
+
).to(model.device)
|
30 |
+
outputs = model.generate(input_ids, max_new_tokens=128, do_sample=True, top_p=0.9, top_k=50, num_return_sequences=5)
|
31 |
+
|
32 |
+
for output in outputs:
|
33 |
+
print(tokenizer.decode(output[input_ids.shape[-1]:], skip_special_tokens=True))
|
34 |
+
```
|