nitky commited on
Commit
95755a1
·
verified ·
1 Parent(s): d5fc5b4

Upload README.md.txt

Browse files
Files changed (1) hide show
  1. README.md.txt +150 -0
README.md.txt ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model:
3
+ - CohereForAI/c4ai-command-r-plus
4
+ library_name: transformers
5
+ tags:
6
+ - mergekit
7
+ - merge
8
+ language:
9
+ - en
10
+ - fr
11
+ - de
12
+ - es
13
+ - it
14
+ - pt
15
+ - ja
16
+ - ko
17
+ - zh
18
+ - ar
19
+ pipeline_tag: text-generation
20
+ license: cc-by-nc-4.0
21
+ ---
22
+ # Megac4ai-command-r-plus
23
+
24
+ 🚨 **This model is created using the special mergekit that supports c4ai-command-r-plus.**
25
+
26
+ This is a 160b frankenmerge model created by interleaving layers of [CohereForAI/c4ai-command-r-plus](https://huggingface.co/CohereForAI/c4ai-command-r-plus) with itself using mergekit.
27
+
28
+ ## Output comparison
29
+ ### Test Case Details
30
+
31
+ Condition: temperature=0.3
32
+
33
+ ```
34
+ <|START_OF_TURN_TOKEN|><|USER_TOKEN|>ティム: やあ、調子はどう?
35
+ キム: いろいろやろうとしてたんだけど、また先延ばしにしちゃったよ。
36
+ ティム: 何をしようとしていたの?
37
+ キム: 大学の課題だよ。どうにもやる気が出なくてね。
38
+ ティム: 集中できないなら、ポモドーロ・テクニックをするといいよ。
39
+ キム: 何それ?
40
+ ティム: 25分作業して、5分休憩するのを繰り返すんだよ。一回あたりの作業時間が短くて集中できるよ。
41
+ キム: うーん、集中っていうわけじゃないんだよね
42
+ ティム: じゃあ1日に5分だけでいいから机で課題をするっていうのはどう?
43
+ キム: 5分じゃ何もできなくない?
44
+ ティム: 短い時間でもいいから机で作業するっていうのがポイントなんだよ。むしろもっとやりたい、くらいで止めておくと毎日続くもっと長い時間できるようになるよ。
45
+ キム: 確かにそれならできるかも。ありがとう!
46
+ Q: キムは何をやってみようとしていますか?また何故それをやろうとしていますか?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
47
+ ```
48
+
49
+ This task is included in [elyza/ELYZA-tasks-100](https://huggingface.co/datasets/elyza/ELYZA-tasks-100).
50
+
51
+ ### Output Example
52
+
53
+ | Model | Output |
54
+ |-------|--------|
55
+ | CohereForAI/c4ai-command-r-plus | キムは大学の課題をやろうとしています。しかし、やる気が起きず、先延ばしにしてしまったようです。 |
56
+ | nitky/Megac4ai-command-r-plus | キムは大学の課題をやろうとしています。やる気が出ず、集中して作業することができないため、ティムにアドバイスを求めています。ティムが提案したポモドーロ・テクニックや、1日に5分だけ机で課題をするという方法を試すことで、課題に取り組む習慣を身につけようとしています。 |
57
+
58
+ ## Test environment
59
+
60
+ This model was tested using [text-generation-webui](https://github.com/oobabooga/text-generation-webui/tree/main). I use preset `min_p` and `Null preset` with temperature=0.3 for Generation.
61
+
62
+ ## Usage
63
+
64
+ Please install `transformers` from the source repository that includes the necessary changes for this model.
65
+ ```python
66
+ # pip install 'git+https://github.com/huggingface/transformers.git'
67
+ from transformers import AutoTokenizer, AutoModelForCausalLM
68
+
69
+ model_id = "nitky/megac4ai-command-r-plus"
70
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
71
+ model = AutoModelForCausalLM.from_pretrained(model_id)
72
+
73
+ # Format message with the command-r-plus chat template
74
+ messages = [{"role": "user", "content": "Hello, how are you?"}]
75
+ input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
76
+ ## <BOS_TOKEN><|START_OF_TURN_TOKEN|><|USER_TOKEN|>Hello, how are you?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
77
+
78
+ gen_tokens = model.generate(
79
+ input_ids,
80
+ max_new_tokens=100,
81
+ do_sample=True,
82
+ temperature=0.3,
83
+ )
84
+
85
+ gen_text = tokenizer.decode(gen_tokens[0])
86
+ print(gen_text)
87
+ ```
88
+
89
+ ### Quantized model through bitsandbytes, 4-bit precision
90
+
91
+ ```python
92
+ # pip install 'git+https://github.com/huggingface/transformers.git' bitsandbytes accelerate
93
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
94
+
95
+ bnb_config = BitsAndBytesConfig(load_in_4bit=True)
96
+
97
+ model_id = "nitky/megac4ai-command-r-plus"
98
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
99
+ model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=bnb_config)
100
+
101
+ # Format message with the command-r-plus chat template
102
+ messages = [{"role": "user", "content": "Hello, how are you?"}]
103
+ input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
104
+ ## <BOS_TOKEN><|START_OF_TURN_TOKEN|><|USER_TOKEN|>Hello, how are you?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
105
+
106
+ gen_tokens = model.generate(
107
+ input_ids,
108
+ max_new_tokens=100,
109
+ do_sample=True,
110
+ temperature=0.3,
111
+ )
112
+
113
+ gen_text = tokenizer.decode(gen_tokens[0])
114
+ print(gen_text)
115
+ ```
116
+
117
+ ## Merge Details
118
+ ### Merge Method
119
+
120
+ This model was merged using the passthrough merge method.
121
+
122
+ ### Models Merged
123
+
124
+ The following models were included in the merge:
125
+ * [CohereForAI/c4ai-command-r-plus](https://huggingface.co/CohereForAI/c4ai-command-r-plus)
126
+
127
+ ### Configuration
128
+
129
+ The following YAML configuration was used to produce this model:
130
+
131
+ ```yaml
132
+ dtype: float16
133
+ merge_method: passthrough
134
+ slices:
135
+ - sources:
136
+ - layer_range: [0, 20]
137
+ model: CohereForAI/c4ai-command-r-plus
138
+ - sources:
139
+ - layer_range: [11, 31]
140
+ model: CohereForAI/c4ai-command-r-plus
141
+ - sources:
142
+ - layer_range: [22, 42]
143
+ model: CohereForAI/c4ai-command-r-plus
144
+ - sources:
145
+ - layer_range: [33, 53]
146
+ model: CohereForAI/c4ai-command-r-plus
147
+ - sources:
148
+ - layer_range: [44, 64]
149
+ model: CohereForAI/c4ai-command-r-plus
150
+ ```