Aaryan-Nakhat commited on
Commit
25db876
1 Parent(s): 1db1ae5

Upload model card

Browse files
Files changed (1) hide show
  1. README.md +236 -0
README.md ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ library_name: transformers
5
+ tags:
6
+ - gpt
7
+ - llm
8
+ - large language model
9
+ - h2o-llmstudio
10
+ inference: false
11
+ thumbnail: https://h2o.ai/etc.clientlibs/h2o/clientlibs/clientlib-site/resources/images/favicon.ico
12
+ ---
13
+ # Model Card
14
+ ## Summary
15
+
16
+ This model was trained using [H2O LLM Studio](https://github.com/h2oai/h2o-llmstudio).
17
+ - Base model: [lmsys/fastchat-t5-3b-v1.0](https://huggingface.co/lmsys/fastchat-t5-3b-v1.0)
18
+
19
+
20
+ ## Usage
21
+
22
+ To use the model with the `transformers` library on a machine with GPUs, first make sure you have the `transformers`, `accelerate` and `torch` libraries installed.
23
+
24
+ ```bash
25
+ pip install transformers==4.36.1
26
+ pip install accelerate==0.23.0
27
+ pip install torch==2.1.2
28
+ ```
29
+
30
+ For inference, you can use the following code snippet:
31
+
32
+ ```python
33
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
34
+
35
+ model_name = "Aaryan-Nakhat/experiment-30-prompt-5-guardrails-finetuning-itr-4-sub-prompt-2" # either local folder or huggingface model name
36
+ # Important: The prompt needs to be in the same format the model was trained with.
37
+ # You can find an example prompt in the experiment logs.
38
+ prompt = "<|prompt|>How are you?</s><|answer|>"
39
+
40
+ tokenizer = AutoTokenizer.from_pretrained(
41
+ model_name,
42
+ use_fast=True,
43
+ trust_remote_code=True,
44
+ )
45
+ model = AutoModelForSeq2SeqLM.from_pretrained(
46
+ model_name,
47
+ torch_dtype="auto",
48
+ device_map={"": "cuda:0"},
49
+ trust_remote_code=True,
50
+ )
51
+ model.cuda().eval()
52
+ inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to("cuda")
53
+
54
+ # generate configuration can be modified to your needs
55
+ tokens = model.generate(
56
+ input_ids=inputs["input_ids"],
57
+ attention_mask=inputs["attention_mask"],
58
+ min_new_tokens=1,
59
+ max_new_tokens=1,
60
+ do_sample=True,
61
+ num_beams=1,
62
+ temperature=float(0.3),
63
+ repetition_penalty=float(1.2),
64
+ renormalize_logits=True
65
+ )[0]
66
+
67
+ answer = tokenizer.decode(tokens, skip_special_tokens=True)
68
+ print(answer)
69
+ ```
70
+
71
+ ## Quantization and sharding
72
+
73
+ 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```.
74
+
75
+ ## Model Architecture
76
+
77
+ ```
78
+ T5ForConditionalGeneration(
79
+ (shared): Embedding(32110, 2048)
80
+ (encoder): T5Stack(
81
+ (embed_tokens): Embedding(32110, 2048)
82
+ (block): ModuleList(
83
+ (0): T5Block(
84
+ (layer): ModuleList(
85
+ (0): T5LayerSelfAttention(
86
+ (SelfAttention): T5Attention(
87
+ (q): Linear(in_features=2048, out_features=2048, bias=False)
88
+ (k): Linear(in_features=2048, out_features=2048, bias=False)
89
+ (v): Linear(in_features=2048, out_features=2048, bias=False)
90
+ (o): Linear(in_features=2048, out_features=2048, bias=False)
91
+ (relative_attention_bias): Embedding(32, 32)
92
+ )
93
+ (layer_norm): T5LayerNorm()
94
+ (dropout): Dropout(p=0.1, inplace=False)
95
+ )
96
+ (1): T5LayerFF(
97
+ (DenseReluDense): T5DenseGatedActDense(
98
+ (wi_0): Linear(in_features=2048, out_features=5120, bias=False)
99
+ (wi_1): Linear(in_features=2048, out_features=5120, bias=False)
100
+ (wo): Linear(in_features=5120, out_features=2048, bias=False)
101
+ (dropout): Dropout(p=0.1, inplace=False)
102
+ (act): NewGELUActivation()
103
+ )
104
+ (layer_norm): T5LayerNorm()
105
+ (dropout): Dropout(p=0.1, inplace=False)
106
+ )
107
+ )
108
+ )
109
+ (1-23): 23 x T5Block(
110
+ (layer): ModuleList(
111
+ (0): T5LayerSelfAttention(
112
+ (SelfAttention): T5Attention(
113
+ (q): Linear(in_features=2048, out_features=2048, bias=False)
114
+ (k): Linear(in_features=2048, out_features=2048, bias=False)
115
+ (v): Linear(in_features=2048, out_features=2048, bias=False)
116
+ (o): Linear(in_features=2048, out_features=2048, bias=False)
117
+ )
118
+ (layer_norm): T5LayerNorm()
119
+ (dropout): Dropout(p=0.1, inplace=False)
120
+ )
121
+ (1): T5LayerFF(
122
+ (DenseReluDense): T5DenseGatedActDense(
123
+ (wi_0): Linear(in_features=2048, out_features=5120, bias=False)
124
+ (wi_1): Linear(in_features=2048, out_features=5120, bias=False)
125
+ (wo): Linear(in_features=5120, out_features=2048, bias=False)
126
+ (dropout): Dropout(p=0.1, inplace=False)
127
+ (act): NewGELUActivation()
128
+ )
129
+ (layer_norm): T5LayerNorm()
130
+ (dropout): Dropout(p=0.1, inplace=False)
131
+ )
132
+ )
133
+ )
134
+ )
135
+ (final_layer_norm): T5LayerNorm()
136
+ (dropout): Dropout(p=0.1, inplace=False)
137
+ )
138
+ (decoder): T5Stack(
139
+ (embed_tokens): Embedding(32110, 2048)
140
+ (block): ModuleList(
141
+ (0): T5Block(
142
+ (layer): ModuleList(
143
+ (0): T5LayerSelfAttention(
144
+ (SelfAttention): T5Attention(
145
+ (q): Linear(in_features=2048, out_features=2048, bias=False)
146
+ (k): Linear(in_features=2048, out_features=2048, bias=False)
147
+ (v): Linear(in_features=2048, out_features=2048, bias=False)
148
+ (o): Linear(in_features=2048, out_features=2048, bias=False)
149
+ (relative_attention_bias): Embedding(32, 32)
150
+ )
151
+ (layer_norm): T5LayerNorm()
152
+ (dropout): Dropout(p=0.1, inplace=False)
153
+ )
154
+ (1): T5LayerCrossAttention(
155
+ (EncDecAttention): T5Attention(
156
+ (q): Linear(in_features=2048, out_features=2048, bias=False)
157
+ (k): Linear(in_features=2048, out_features=2048, bias=False)
158
+ (v): Linear(in_features=2048, out_features=2048, bias=False)
159
+ (o): Linear(in_features=2048, out_features=2048, bias=False)
160
+ )
161
+ (layer_norm): T5LayerNorm()
162
+ (dropout): Dropout(p=0.1, inplace=False)
163
+ )
164
+ (2): T5LayerFF(
165
+ (DenseReluDense): T5DenseGatedActDense(
166
+ (wi_0): Linear(in_features=2048, out_features=5120, bias=False)
167
+ (wi_1): Linear(in_features=2048, out_features=5120, bias=False)
168
+ (wo): Linear(in_features=5120, out_features=2048, bias=False)
169
+ (dropout): Dropout(p=0.1, inplace=False)
170
+ (act): NewGELUActivation()
171
+ )
172
+ (layer_norm): T5LayerNorm()
173
+ (dropout): Dropout(p=0.1, inplace=False)
174
+ )
175
+ )
176
+ )
177
+ (1-23): 23 x T5Block(
178
+ (layer): ModuleList(
179
+ (0): T5LayerSelfAttention(
180
+ (SelfAttention): T5Attention(
181
+ (q): Linear(in_features=2048, out_features=2048, bias=False)
182
+ (k): Linear(in_features=2048, out_features=2048, bias=False)
183
+ (v): Linear(in_features=2048, out_features=2048, bias=False)
184
+ (o): Linear(in_features=2048, out_features=2048, bias=False)
185
+ )
186
+ (layer_norm): T5LayerNorm()
187
+ (dropout): Dropout(p=0.1, inplace=False)
188
+ )
189
+ (1): T5LayerCrossAttention(
190
+ (EncDecAttention): T5Attention(
191
+ (q): Linear(in_features=2048, out_features=2048, bias=False)
192
+ (k): Linear(in_features=2048, out_features=2048, bias=False)
193
+ (v): Linear(in_features=2048, out_features=2048, bias=False)
194
+ (o): Linear(in_features=2048, out_features=2048, bias=False)
195
+ )
196
+ (layer_norm): T5LayerNorm()
197
+ (dropout): Dropout(p=0.1, inplace=False)
198
+ )
199
+ (2): T5LayerFF(
200
+ (DenseReluDense): T5DenseGatedActDense(
201
+ (wi_0): Linear(in_features=2048, out_features=5120, bias=False)
202
+ (wi_1): Linear(in_features=2048, out_features=5120, bias=False)
203
+ (wo): Linear(in_features=5120, out_features=2048, bias=False)
204
+ (dropout): Dropout(p=0.1, inplace=False)
205
+ (act): NewGELUActivation()
206
+ )
207
+ (layer_norm): T5LayerNorm()
208
+ (dropout): Dropout(p=0.1, inplace=False)
209
+ )
210
+ )
211
+ )
212
+ )
213
+ (final_layer_norm): T5LayerNorm()
214
+ (dropout): Dropout(p=0.1, inplace=False)
215
+ )
216
+ (lm_head): Linear(in_features=2048, out_features=32110, bias=False)
217
+ )
218
+ ```
219
+
220
+ ## Model Configuration
221
+
222
+ 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.
223
+
224
+
225
+ ## Disclaimer
226
+
227
+ 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.
228
+
229
+ - 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.
230
+ - 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.
231
+ - 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.
232
+ - 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.
233
+ - 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.
234
+ - 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.
235
+
236
+ 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.