maddes8cht commited on
Commit
b67957f
โ€ข
1 Parent(s): a0a467f

"Update README.md"

Browse files
Files changed (1) hide show
  1. README.md +194 -0
README.md ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - ja
4
+ tags:
5
+ - japanese-stablelm
6
+ - causal-lm
7
+ pipeline_tag: text-generation
8
+ license: apache-2.0
9
+ extra_gated_fields:
10
+ Name: text
11
+ Email: text
12
+ Country: text
13
+ Organization or Affiliation: text
14
+ I allow Stability AI to contact me about information related to its models and research: checkbox
15
+ ---
16
+ [![banner](https://maddes8cht.github.io/assets/buttons/Huggingface-banner.jpg)]()
17
+
18
+ I'm constantly enhancing these model descriptions to provide you with the most relevant and comprehensive information
19
+
20
+ # japanese-stablelm-3b-4e1t-instruct - GGUF
21
+ - Model creator: [stabilityai](https://huggingface.co/stabilityai)
22
+ - Original model: [japanese-stablelm-3b-4e1t-instruct](https://huggingface.co/stabilityai/japanese-stablelm-3b-4e1t-instruct)
23
+
24
+ # StableLM
25
+ This is a Model based on StableLM.
26
+ Stablelm is a familiy of Language Models by Stability AI.
27
+
28
+ ## Note:
29
+ Current (as of 2023-11-15) implementations of Llama.cpp only support GPU offloading up to 34 Layers with these StableLM Models.
30
+ The model will crash immediately if -ngl is larger than 34.
31
+ The model works fine however without any gpu acceleration.
32
+
33
+
34
+
35
+ # About GGUF format
36
+
37
+ `gguf` is the current file format used by the [`ggml`](https://github.com/ggerganov/ggml) library.
38
+ A growing list of Software is using it and can therefore use this model.
39
+ The core project making use of the ggml library is the [llama.cpp](https://github.com/ggerganov/llama.cpp) project by Georgi Gerganov
40
+
41
+ # Quantization variants
42
+
43
+ There is a bunch of quantized files available to cater to your specific needs. Here's how to choose the best option for you:
44
+
45
+ # Legacy quants
46
+
47
+ Q4_0, Q4_1, Q5_0, Q5_1 and Q8 are `legacy` quantization types.
48
+ Nevertheless, they are fully supported, as there are several circumstances that cause certain model not to be compatible with the modern K-quants.
49
+ ## Note:
50
+ Now there's a new option to use K-quants even for previously 'incompatible' models, although this involves some fallback solution that makes them not *real* K-quants. More details can be found in affected model descriptions.
51
+ (This mainly refers to Falcon 7b and Starcoder models)
52
+
53
+ # K-quants
54
+
55
+ K-quants are designed with the idea that different levels of quantization in specific parts of the model can optimize performance, file size, and memory load.
56
+ So, if possible, use K-quants.
57
+ With a Q6_K, you'll likely find it challenging to discern a quality difference from the original model - ask your model two times the same question and you may encounter bigger quality differences.
58
+
59
+
60
+
61
+
62
+ ---
63
+
64
+ # Original Model Card:
65
+ # Japanese StableLM-3B-4E1T Instruct
66
+
67
+ ## Model Description
68
+
69
+ This is a 3B-parameter decoder-only Japanese language model fine-tuned on instruction-following datasets, built on top of the base model [Japanese StableLM-3B-4E1T Base](https://huggingface.co/stabilityai/japanese-stablelm-3b-4e1t-base).
70
+
71
+ *If you are in search of a larger model, please check [Japanese Stable LM Instruct Gamma 7B](https://huggingface.co/stabilityai/japanese-stablelm-instruct-gamma-7b)*.
72
+
73
+
74
+ ## Usage
75
+
76
+
77
+ ```python
78
+ import torch
79
+ from transformers import AutoTokenizer, AutoModelForCausalLM
80
+
81
+ tokenizer = AutoTokenizer.from_pretrained("stabilityai/japanese-stablelm-3b-4e1t-instruct")
82
+ model = AutoModelForCausalLM.from_pretrained(
83
+ "stabilityai/japanese-stablelm-3b-4e1t-instruct",
84
+ trust_remote_code=True,
85
+ torch_dtype="auto",
86
+ )
87
+ model.eval()
88
+
89
+ if torch.cuda.is_available():
90
+ model = model.to("cuda")
91
+
92
+ def build_prompt(user_query, inputs="", sep="\n\n### "):
93
+ sys_msg = "ไปฅไธ‹ใฏใ€ใ‚ฟใ‚นใ‚ฏใ‚’่ชฌๆ˜Žใ™ใ‚‹ๆŒ‡็คบใจใ€ๆ–‡่„ˆใฎใ‚ใ‚‹ๅ…ฅๅŠ›ใฎ็ต„ใฟๅˆใ‚ใ›ใงใ™ใ€‚่ฆๆฑ‚ใ‚’้ฉๅˆ‡ใซๆบ€ใŸใ™ๅฟœ็ญ”ใ‚’ๆ›ธใใชใ•ใ„ใ€‚"
94
+ p = sys_msg
95
+ roles = ["ๆŒ‡็คบ", "ๅฟœ็ญ”"]
96
+ msgs = [": \n" + user_query, ": \n"]
97
+ if inputs:
98
+ roles.insert(1, "ๅ…ฅๅŠ›")
99
+ msgs.insert(1, ": \n" + inputs)
100
+ for role, msg in zip(roles, msgs):
101
+ p += sep + role + msg
102
+ return p
103
+
104
+ # Infer with prompt without any additional input
105
+ user_inputs = {
106
+ "user_query": "ไธŽใˆใ‚‰ใ‚ŒใŸใ“ใจใ‚ใ–ใฎๆ„ๅ‘ณใ‚’ๅฐๅญฆ็”Ÿใงใ‚‚ๅˆ†ใ‹ใ‚‹ใ‚ˆใ†ใซๆ•™ใˆใฆใใ ใ•ใ„ใ€‚",
107
+ "inputs": "ๆƒ…ใ‘ใฏไบบใฎใŸใ‚ใชใ‚‰ใš"
108
+ }
109
+ prompt = build_prompt(**user_inputs)
110
+
111
+ input_ids = tokenizer.encode(
112
+ prompt,
113
+ add_special_tokens=False,
114
+ return_tensors="pt"
115
+ )
116
+
117
+ tokens = model.generate(
118
+ input_ids.to(device=model.device),
119
+ max_new_tokens=256,
120
+ temperature=1,
121
+ top_p=0.95,
122
+ do_sample=True,
123
+ )
124
+
125
+ out = tokenizer.decode(tokens[0][input_ids.shape[1]:], skip_special_tokens=True).strip()
126
+ print(out)
127
+ ```
128
+
129
+ ## Model Details
130
+
131
+ * **Developed by**: [Stability AI](https://stability.ai/)
132
+ * **Model type**: `Japanese StableLM-3B-4E1T Instruct` model is an auto-regressive language model based on the transformer decoder architecture.
133
+ * **Language(s)**: Japanese
134
+ * **License**: This model is licensed under [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).
135
+ * **Contact**: For questions and comments about the model, please join [Stable Community Japan](https://discord.gg/StableJP). For future announcements / information about Stability AI models, research, and events, please follow https://twitter.com/StabilityAI_JP.
136
+
137
+ ### Model Architecture
138
+
139
+ The model is a decoder-only transformer similar to the LLaMA ([Touvron et al., 2023](https://arxiv.org/abs/2307.09288)) architecture with the following modifications:
140
+
141
+ | Parameters | Hidden Size | Layers | Heads | Sequence Length |
142
+ |----------------|-------------|--------|-------|-----------------|
143
+ | 2,795,443,200 | 2560 | 32 | 32 | 4096 |
144
+
145
+ * **Position Embeddings**: Rotary Position Embeddings ([Su et al., 2021](https://arxiv.org/abs/2104.09864)) applied to the first 25% of head embedding dimensions for improved throughput following [Black et al. (2022)](https://arxiv.org/pdf/2204.06745.pdf).
146
+ * **Normalization**: LayerNorm ([Ba et al., 2016](https://arxiv.org/abs/1607.06450)) with learned bias terms as opposed to RMSNorm ([Zhang & Sennrich, 2019](https://arxiv.org/abs/1910.07467)).
147
+ * **Tokenizer**: GPT-NeoX ([Black et al., 2022](https://arxiv.org/abs/2204.06745)).
148
+
149
+
150
+ ### Training Datasets
151
+
152
+ - [Japanese translation of the Databricks Dolly-15k dataset](https://huggingface.co/datasets/kunishou/databricks-dolly-15k-ja)
153
+ - [Japanese translation of the subset of the Anthropic HH dataset](https://huggingface.co/datasets/fujiki/japanese_hh-rlhf-49k)
154
+ - [Wikinews](https://ja.wikinews.org/wi) [subset](https://huggingface.co/datasets/fujiki/llm-japanese-dataset_wikinews) of the [izumi-lab/llm-japanese-dataset](https://huggingface.co/datasets/izumi-lab/llm-japanese-dataset)
155
+
156
+
157
+
158
+ ## Use and Limitations
159
+
160
+ ### Intended Use
161
+
162
+ The model is intended to be used by all individuals as a foundational model for application-specific fine-tuning without strict limitations on commercial use.
163
+
164
+ ### Limitations and bias
165
+
166
+ The pre-training dataset may have contained offensive or inappropriate content even after applying data cleansing filters which can be reflected in the model-generated text. We recommend users exercise reasonable caution when using these models in production systems. Do not use the model for any applications that may cause harm or distress to individuals or groups.
167
+
168
+ ## Credits
169
+
170
+ The fine-tuning was carried out by [Fujiki Nakamura](https://huggingface.co/fujiki).
171
+ Other aspects, including data preparation and evaluation, were handled by the Language Team of Stability AI Japan, notably [Meng Lee](https://huggingface.co/leemeng), [Makoto Shing](https://huggingface.co/mkshing), [Paul McCann](https://huggingface.co/polm-stability), [Naoki Orii](https://huggingface.co/mrorii), and [Takuya Akiba](https://huggingface.co/iwiwi).
172
+
173
+ ## Acknowledgements
174
+
175
+ We are grateful for the contributions of the EleutherAI Polyglot-JA team in helping us to collect a large amount of pre-training data in Japanese. Polyglot-JA members includes Hyunwoong Ko (Project Lead), Fujiki Nakamura (originally started this project when he commited to the Polyglot team), Yunho Mo, Minji Jung, KeunSeok Im, and Su-Kyeong Jang.
176
+
177
+ We are also appreciative of [AI Novelist/Sta (Bit192, Inc.)](https://ai-novel.com/index.php) and the numerous contributors from [Stable Community Japan](https://discord.gg/VPrcE475HB) for assisting us in gathering a large amount of high-quality Japanese textual data for model training.
178
+
179
+ ***End of original Model File***
180
+ ---
181
+
182
+
183
+ ## Please consider to support my work
184
+ **Coming Soon:** I'm in the process of launching a sponsorship/crowdfunding campaign for my work. I'm evaluating Kickstarter, Patreon, or the new GitHub Sponsors platform, and I am hoping for some support and contribution to the continued availability of these kind of models. Your support will enable me to provide even more valuable resources and maintain the models you rely on. Your patience and ongoing support are greatly appreciated as I work to make this page an even more valuable resource for the community.
185
+
186
+ <center>
187
+
188
+ [![GitHub](https://maddes8cht.github.io/assets/buttons/github-io-button.png)](https://maddes8cht.github.io)
189
+ [![Stack Exchange](https://stackexchange.com/users/flair/26485911.png)](https://stackexchange.com/users/26485911)
190
+ [![GitHub](https://maddes8cht.github.io/assets/buttons/github-button.png)](https://github.com/maddes8cht)
191
+ [![HuggingFace](https://maddes8cht.github.io/assets/buttons/huggingface-button.png)](https://huggingface.co/maddes8cht)
192
+ [![Twitter](https://maddes8cht.github.io/assets/buttons/twitter-button.png)](https://twitter.com/maddes1966)
193
+
194
+ </center>