Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- ja
|
5 |
+
- en
|
6 |
+
tags:
|
7 |
+
- japanese
|
8 |
+
- causal-lm
|
9 |
+
inference: false
|
10 |
+
---
|
11 |
+
# CyberAgentLM2-7B-Chat
|
12 |
+
|
13 |
+
## Model Description
|
14 |
+
|
15 |
+
CyberAgentLM2-Chat is a fine-tuned model of [CyberAgentLM2](https://huggingface.co/cyberagent/calm2-7b) for dialogue use cases.
|
16 |
+
|
17 |
+
## Requirements
|
18 |
+
- transformers >= 4.34.1
|
19 |
+
- accelerate
|
20 |
+
|
21 |
+
## Usage
|
22 |
+
|
23 |
+
```python
|
24 |
+
import transformers
|
25 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
|
26 |
+
|
27 |
+
assert transformers.__version__ >= "4.34.1"
|
28 |
+
|
29 |
+
model = AutoModelForCausalLM.from_pretrained("cyberagent/calm2-7b-chat", device_map="auto", torch_dtype="auto")
|
30 |
+
tokenizer = AutoTokenizer.from_pretrained("cyberagent/calm2-7b-chat")
|
31 |
+
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
|
32 |
+
|
33 |
+
prompt = """USER: AIによって私達の暮らしはどのように変わりますか?
|
34 |
+
ASSISTANT: """
|
35 |
+
|
36 |
+
token_ids = tokenizer.encode(prompt, return_tensors="pt")
|
37 |
+
output_ids = model.generate(
|
38 |
+
input_ids=token_ids.to(model.device),
|
39 |
+
max_new_tokens=300,
|
40 |
+
do_sample=True,
|
41 |
+
temperature=0.8,
|
42 |
+
streamer=streamer,
|
43 |
+
)
|
44 |
+
```
|
45 |
+
|
46 |
+
## Chat Template
|
47 |
+
```
|
48 |
+
USER: {user_message1}
|
49 |
+
ASSISTANT: {assistant_message1}<|endoftext|>
|
50 |
+
USER: {user_message2}
|
51 |
+
ASSISTANT: {assistant_message2}<|endoftext|>
|
52 |
+
USER: {user_message3}
|
53 |
+
ASSISTANT: {assistant_message3}<|endoftext|>
|
54 |
+
```
|
55 |
+
|
56 |
+
## Model Details
|
57 |
+
|
58 |
+
* **Model size**: 7B
|
59 |
+
* **Context length**: 32768
|
60 |
+
* **Model type**: Transformer-based Language Model
|
61 |
+
* **Language(s)**: Japanese, English
|
62 |
+
* **Developed by**: [CyberAgent, Inc.](https://www.cyberagent.co.jp/)
|
63 |
+
* **License**: Apache-2.0
|
64 |
+
|
65 |
+
## Author
|
66 |
+
|
67 |
+
[Ryosuke Ishigami](https://huggingface.co/rishigami)
|
68 |
+
|
69 |
+
## Citations
|
70 |
+
```tex
|
71 |
+
@article{touvron2023llama,
|
72 |
+
title={LLaMA: Open and Efficient Foundation Language Models},
|
73 |
+
author={Touvron, Hugo and Lavril, Thibaut and Izacard, Gautier and Martinet, Xavier and Lachaux, Marie-Anne and Lacroix, Timoth{\'e}e and Rozi{\`e}re, Baptiste and Goyal, Naman and Hambro, Eric and Azhar, Faisal and Rodriguez, Aurelien and Joulin, Armand and Grave, Edouard and Lample, Guillaume},
|
74 |
+
journal={arXiv preprint arXiv:2302.13971},
|
75 |
+
year={2023}
|
76 |
+
}
|
77 |
+
```
|