maddes8cht commited on
Commit
b6021ee
1 Parent(s): 2843e3b

"Update README.md"

Browse files
Files changed (1) hide show
  1. README.md +270 -0
README.md ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ library_name: transformers
5
+ tags:
6
+ - gpt
7
+ - llm
8
+ - large language model
9
+ - PAIX.Cloud
10
+ inference: true
11
+ thumbnail: >-
12
+ https://static.wixstatic.com/media/bdee4e_8aa5cefc86024bc88f7e20e3e19d9ff3~mv2.png/v1/fill/w_192%2Ch_192%2Clg_1%2Cusm_0.66_1.00_0.01/bdee4e_8aa5cefc86024bc88f7e20e3e19d9ff3~mv2.png
13
+ license: apache-2.0
14
+ ---
15
+ [![banner](https://maddes8cht.github.io/assets/buttons/Huggingface-banner.jpg)]()
16
+
17
+ I'm constantly enhancing these model descriptions to provide you with the most relevant and comprehensive information
18
+
19
+ # Astrid-3B - GGUF
20
+ - Model creator: [PAIXAI](https://huggingface.co/PAIXAI)
21
+ - Original model: [Astrid-3B](https://huggingface.co/PAIXAI/Astrid-3B)
22
+
23
+ # StableLM
24
+ This is a Model based on StableLM. Stablelm is a familiy of Language Models by Stability AI.
25
+
26
+ ## Note:
27
+ Current (as of. 2023-11-15) implementations of Llama.cpp only support GPU offloading up to 34 Layers with these StableLM Models.
28
+ The model will crash immediately if -ngl is larger than 34.
29
+ The model works fine however without any gpu acceleration.
30
+
31
+
32
+
33
+ # About GGUF format
34
+
35
+ `gguf` is the current file format used by the [`ggml`](https://github.com/ggerganov/ggml) library.
36
+ A growing list of Software is using it and can therefore use this model.
37
+ The core project making use of the ggml library is the [llama.cpp](https://github.com/ggerganov/llama.cpp) project by Georgi Gerganov
38
+
39
+ # Quantization variants
40
+
41
+ There is a bunch of quantized files available to cater to your specific needs. Here's how to choose the best option for you:
42
+
43
+ # Legacy quants
44
+
45
+ Q4_0, Q4_1, Q5_0, Q5_1 and Q8 are `legacy` quantization types.
46
+ Nevertheless, they are fully supported, as there are several circumstances that cause certain model not to be compatible with the modern K-quants.
47
+ ## Note:
48
+ 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.
49
+ (This mainly refers to Falcon 7b and Starcoder models)
50
+
51
+ # K-quants
52
+
53
+ 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.
54
+ So, if possible, use K-quants.
55
+ 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.
56
+
57
+
58
+
59
+
60
+ ---
61
+
62
+ # Original Model Card:
63
+ # Model Card
64
+ ## Summary
65
+
66
+ This model, Astrid-3B, is a StableLMEpochModel model for causal language modeling, designed to generate human-like text.
67
+ It's part of our mission to make AI technology accessible to everyone, focusing on personalization, data privacy, and transparent AI governance.
68
+ Trained in English, it's a versatile tool for a variety of applications.
69
+ This model is one of the many models available on our platform, and we currently have a 1B and 7B open-source model.
70
+
71
+ This model was trained by [PAIX.Cloud](https://www.paix.cloud/).
72
+ - Wait list: [Wait List](https://www.paix.cloud/join-waitlist)
73
+
74
+
75
+ ## Usage
76
+
77
+ To use the model with the `transformers` library on a machine with GPUs, first make sure you have the `transformers` library installed.
78
+
79
+ ```bash
80
+ pip install transformers==4.34.0
81
+ ```
82
+
83
+ Also make sure you are providing your huggingface token to the pipeline if the model is lying in a private repo.
84
+ - Either leave `token=True` in the `pipeline` and login to hugginface_hub by running
85
+ ```python
86
+ import huggingface_hub
87
+ huggingface_hub.login(<ACCES_TOKEN>)
88
+ ```
89
+ - Or directly pass your <ACCES_TOKEN> to `token` in the `pipeline`
90
+
91
+ ```python
92
+ from transformers import pipeline
93
+
94
+ generate_text = pipeline(
95
+ model="PAIXAI/Astrid-3B",
96
+ torch_dtype="auto",
97
+ trust_remote_code=True,
98
+ use_fast=True,
99
+ device_map={"": "cuda:0"},
100
+ token=True,
101
+ )
102
+
103
+ res = generate_text(
104
+ "Why is drinking water so healthy?",
105
+ min_new_tokens=2,
106
+ max_new_tokens=256,
107
+ do_sample=False,
108
+ num_beams=1,
109
+ temperature=float(0.3),
110
+ repetition_penalty=float(1.2),
111
+ renormalize_logits=True
112
+ )
113
+ print(res[0]["generated_text"])
114
+ ```
115
+
116
+ You can print a sample prompt after the preprocessing step to see how it is feed to the tokenizer:
117
+
118
+ ```python
119
+ print(generate_text.preprocess("Why is drinking water so healthy?")["prompt_text"])
120
+ ```
121
+
122
+ ```bash
123
+ <|prompt|>Why is drinking water so healthy?<|endoftext|><|answer|>
124
+ ```
125
+
126
+ Alternatively, you can download [h2oai_pipeline.py](h2oai_pipeline.py), store it alongside your notebook, and construct the pipeline yourself from the loaded model and tokenizer. If the model and the tokenizer are fully supported in the `transformers` package, this will allow you to set `trust_remote_code=False`.
127
+
128
+ ```python
129
+ from h2oai_pipeline import H2OTextGenerationPipeline
130
+ from transformers import AutoModelForCausalLM, AutoTokenizer
131
+
132
+ tokenizer = AutoTokenizer.from_pretrained(
133
+ "PAIXAI/Astrid-3B",
134
+ use_fast=True,
135
+ padding_side="left",
136
+ trust_remote_code=True,
137
+ )
138
+ model = AutoModelForCausalLM.from_pretrained(
139
+ "PAIXAI/Astrid-3B",
140
+ torch_dtype="auto",
141
+ device_map={"": "cuda:0"},
142
+ trust_remote_code=True,
143
+ )
144
+ generate_text = H2OTextGenerationPipeline(model=model, tokenizer=tokenizer)
145
+
146
+ res = generate_text(
147
+ "Why is drinking water so healthy?",
148
+ min_new_tokens=2,
149
+ max_new_tokens=256,
150
+ do_sample=False,
151
+ num_beams=1,
152
+ temperature=float(0.3),
153
+ repetition_penalty=float(1.2),
154
+ renormalize_logits=True
155
+ )
156
+ print(res[0]["generated_text"])
157
+ ```
158
+
159
+
160
+ You may also construct the pipeline from the loaded model and tokenizer yourself and consider the preprocessing steps:
161
+
162
+ ```python
163
+ from transformers import AutoModelForCausalLM, AutoTokenizer
164
+
165
+ model_name = "PAIXAI/Astrid-3B" # either local folder or huggingface model name
166
+ # Important: The prompt needs to be in the same format the model was trained with.
167
+ # You can find an example prompt in the experiment logs.
168
+ prompt = "<|prompt|>How are you?<|endoftext|><|answer|>"
169
+
170
+ tokenizer = AutoTokenizer.from_pretrained(
171
+ model_name,
172
+ use_fast=True,
173
+ trust_remote_code=True,
174
+ )
175
+ model = AutoModelForCausalLM.from_pretrained(
176
+ model_name,
177
+ torch_dtype="auto",
178
+ device_map={"": "cuda:0"},
179
+ trust_remote_code=True,
180
+ )
181
+ model.cuda().eval()
182
+ inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to("cuda")
183
+
184
+ # generate configuration can be modified to your needs
185
+ tokens = model.generate(
186
+ input_ids=inputs["input_ids"],
187
+ attention_mask=inputs["attention_mask"],
188
+ min_new_tokens=2,
189
+ max_new_tokens=256,
190
+ do_sample=False,
191
+ num_beams=1,
192
+ temperature=float(0.3),
193
+ repetition_penalty=float(1.2),
194
+ renormalize_logits=True
195
+ )[0]
196
+
197
+ tokens = tokens[inputs["input_ids"].shape[1]:]
198
+ answer = tokenizer.decode(tokens, skip_special_tokens=True)
199
+ print(answer)
200
+ ```
201
+
202
+ ## Quantization and sharding
203
+
204
+ You can load the models using quantization by specifying ```load_in_8bit=True``` or ```load_in_4bit=True```. Also, sharding on multiple GPUs is possible by setting ```device_map=auto```.
205
+
206
+ ## Model Architecture
207
+
208
+ ```
209
+ StableLMEpochForCausalLM(
210
+ (model): StableLMEpochModel(
211
+ (embed_tokens): Embedding(50304, 2560, padding_idx=0)
212
+ (layers): ModuleList(
213
+ (0-31): 32 x DecoderLayer(
214
+ (self_attn): Attention(
215
+ (q_proj): Linear(in_features=2560, out_features=2560, bias=False)
216
+ (k_proj): Linear(in_features=2560, out_features=2560, bias=False)
217
+ (v_proj): Linear(in_features=2560, out_features=2560, bias=False)
218
+ (o_proj): Linear(in_features=2560, out_features=2560, bias=False)
219
+ (rotary_emb): RotaryEmbedding()
220
+ )
221
+ (mlp): MLP(
222
+ (gate_proj): Linear(in_features=2560, out_features=6912, bias=False)
223
+ (up_proj): Linear(in_features=2560, out_features=6912, bias=False)
224
+ (down_proj): Linear(in_features=6912, out_features=2560, bias=False)
225
+ (act_fn): SiLU()
226
+ )
227
+ (input_layernorm): LayerNorm((2560,), eps=1e-05, elementwise_affine=True)
228
+ (post_attention_layernorm): LayerNorm((2560,), eps=1e-05, elementwise_affine=True)
229
+ )
230
+ )
231
+ (norm): LayerNorm((2560,), eps=1e-05, elementwise_affine=True)
232
+ )
233
+ (lm_head): Linear(in_features=2560, out_features=50304, bias=False)
234
+ )
235
+ ```
236
+
237
+ ## Model Configuration
238
+
239
+ This model was trained using H2O LLM Studio and with the configuration in [cfg.yaml](cfg.yaml). Visit [H2O LLM Studio](https://github.com/h2oai/h2o-llmstudio) to learn how to train your own large language models.
240
+
241
+
242
+ ## Disclaimer
243
+
244
+ Please read this disclaimer carefully before using the large language model provided in this repository. Your use of the model signifies your agreement to the following terms and conditions.
245
+
246
+ - Biases and Offensiveness: The large language model is trained on a diverse range of internet text data, which may contain biased, racist, offensive, or otherwise inappropriate content. By using this model, you acknowledge and accept that the generated content may sometimes exhibit biases or produce content that is offensive or inappropriate. The developers of this repository do not endorse, support, or promote any such content or viewpoints.
247
+ - Limitations: The large language model is an AI-based tool and not a human. It may produce incorrect, nonsensical, or irrelevant responses. It is the user's responsibility to critically evaluate the generated content and use it at their discretion.
248
+ - Use at Your Own Risk: Users of this large language model must assume full responsibility for any consequences that may arise from their use of the tool. The developers and contributors of this repository shall not be held liable for any damages, losses, or harm resulting from the use or misuse of the provided model.
249
+ - Ethical Considerations: Users are encouraged to use the large language model responsibly and ethically. By using this model, you agree not to use it for purposes that promote hate speech, discrimination, harassment, or any form of illegal or harmful activities.
250
+ - Reporting Issues: If you encounter any biased, offensive, or otherwise inappropriate content generated by the large language model, please report it to the repository maintainers through the provided channels. Your feedback will help improve the model and mitigate potential issues.
251
+ - Changes to this Disclaimer: The developers of this repository reserve the right to modify or update this disclaimer at any time without prior notice. It is the user's responsibility to periodically review the disclaimer to stay informed about any changes.
252
+
253
+ By using the large language model provided in this repository, you agree to accept and comply with the terms and conditions outlined in this disclaimer. If you do not agree with any part of this disclaimer, you should refrain from using the model and any content generated by it.
254
+
255
+ ***End of original Model File***
256
+ ---
257
+
258
+
259
+ ## Please consider to support my work
260
+ **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.
261
+
262
+ <center>
263
+
264
+ [![GitHub](https://maddes8cht.github.io/assets/buttons/github-io-button.png)](https://maddes8cht.github.io)
265
+ [![Stack Exchange](https://stackexchange.com/users/flair/26485911.png)](https://stackexchange.com/users/26485911)
266
+ [![GitHub](https://maddes8cht.github.io/assets/buttons/github-button.png)](https://github.com/maddes8cht)
267
+ [![HuggingFace](https://maddes8cht.github.io/assets/buttons/huggingface-button.png)](https://huggingface.co/maddes8cht)
268
+ [![Twitter](https://maddes8cht.github.io/assets/buttons/twitter-button.png)](https://twitter.com/maddes1966)
269
+
270
+ </center>