Svngoku commited on
Commit
c3aa0fd
1 Parent(s): 1f0a0b6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +66 -162
README.md CHANGED
@@ -16,9 +16,74 @@ tags:
16
 
17
  <!-- Provide a quick summary of what the model is/does. -->
18
 
 
19
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
- ## Model Details
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  ### Model Description
24
 
@@ -66,164 +131,3 @@ generated_ids = model.generate(
66
  generated_text = wrapped_tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
67
  print(generated_text)
68
  ```
69
-
70
- ### Direct Use
71
-
72
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
73
-
74
- [More Information Needed]
75
-
76
- ### Downstream Use [optional]
77
-
78
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
79
-
80
- [More Information Needed]
81
-
82
- ### Out-of-Scope Use
83
-
84
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
85
-
86
- [More Information Needed]
87
-
88
- ## Bias, Risks, and Limitations
89
-
90
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
91
-
92
- [More Information Needed]
93
-
94
- ### Recommendations
95
-
96
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
97
-
98
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
99
-
100
- ## How to Get Started with the Model
101
-
102
- Use the code below to get started with the model.
103
-
104
- [More Information Needed]
105
-
106
- ## Training Details
107
-
108
- ### Training Data
109
-
110
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
111
-
112
- [More Information Needed]
113
-
114
- ### Training Procedure
115
-
116
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
117
-
118
- #### Preprocessing [optional]
119
-
120
- [More Information Needed]
121
-
122
-
123
- #### Training Hyperparameters
124
-
125
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
126
-
127
- #### Speeds, Sizes, Times [optional]
128
-
129
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
130
-
131
- [More Information Needed]
132
-
133
- ## Evaluation
134
-
135
- <!-- This section describes the evaluation protocols and provides the results. -->
136
-
137
- ### Testing Data, Factors & Metrics
138
-
139
- #### Testing Data
140
-
141
- <!-- This should link to a Dataset Card if possible. -->
142
-
143
- [More Information Needed]
144
-
145
- #### Factors
146
-
147
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
148
-
149
- [More Information Needed]
150
-
151
- #### Metrics
152
-
153
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
154
-
155
- [More Information Needed]
156
-
157
- ### Results
158
-
159
- [More Information Needed]
160
-
161
- #### Summary
162
-
163
-
164
-
165
- ## Model Examination [optional]
166
-
167
- <!-- Relevant interpretability work for the model goes here -->
168
-
169
- [More Information Needed]
170
-
171
- ## Environmental Impact
172
-
173
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
174
-
175
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
176
-
177
- - **Hardware Type:** [More Information Needed]
178
- - **Hours used:** [More Information Needed]
179
- - **Cloud Provider:** [More Information Needed]
180
- - **Compute Region:** [More Information Needed]
181
- - **Carbon Emitted:** [More Information Needed]
182
-
183
- ## Technical Specifications [optional]
184
-
185
- ### Model Architecture and Objective
186
-
187
- [More Information Needed]
188
-
189
- ### Compute Infrastructure
190
-
191
- [More Information Needed]
192
-
193
- #### Hardware
194
-
195
- [More Information Needed]
196
-
197
- #### Software
198
-
199
- [More Information Needed]
200
-
201
- ## Citation [optional]
202
-
203
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
204
-
205
- **BibTeX:**
206
-
207
- [More Information Needed]
208
-
209
- **APA:**
210
-
211
- [More Information Needed]
212
-
213
- ## Glossary [optional]
214
-
215
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
216
-
217
- [More Information Needed]
218
-
219
- ## More Information [optional]
220
-
221
- [More Information Needed]
222
-
223
- ## Model Card Authors [optional]
224
-
225
- [More Information Needed]
226
-
227
- ## Model Card Contact
228
-
229
- [More Information Needed]
 
16
 
17
  <!-- Provide a quick summary of what the model is/does. -->
18
 
19
+ ## Model Details
20
 
21
+ - `Tokenizer`
22
+ ```py
23
+ from transformers import PreTrainedTokenizerFast
24
+
25
+ # Assuming your custom tokenizer is `tokenizer`
26
+ wrapped_tokenizer = PreTrainedTokenizerFast(
27
+ tokenizer_object=tokenizer,
28
+ bos_token="[BOS]", # Replace with your special tokens
29
+ eos_token="[EOS]", # Replace with your special tokens
30
+ unk_token="[UNK]",
31
+ pad_token="[PAD]"
32
+ )
33
 
34
+ # Ensure padding is applied to the right side (used in causal language modeling)
35
+ wrapped_tokenizer.padding_side = "right"
36
+
37
+ ```
38
+
39
+ - `Model`
40
+ ```py
41
+ from transformers import LlamaConfig, LlamaForCausalLM
42
+
43
+ config = LlamaConfig(
44
+ vocab_size=len(wrapped_tokenizer), # Get vocab size from the wrapped tokenizer
45
+ hidden_size=512, # Adjust model size as needed
46
+ intermediate_size=1024,
47
+ num_hidden_layers=8, # Set number of layers and heads
48
+ num_attention_heads=8,
49
+ max_position_embeddings=512,
50
+ rms_norm_eps=1e-6,
51
+ initializer_range=0.02,
52
+ use_cache=True,
53
+ pad_token_id=wrapped_tokenizer.pad_token_id,
54
+ bos_token_id=wrapped_tokenizer.bos_token_id,
55
+ eos_token_id=wrapped_tokenizer.eos_token_id,
56
+ )
57
+
58
+ model = LlamaForCausalLM(config)
59
+ ```
60
+
61
+ - `Trainer`
62
+ ```py
63
+ from transformers import TrainingArguments, Trainer
64
+
65
+ # Define training arguments
66
+ training_args = TrainingArguments(
67
+ output_dir="kongo-llama", # Output directory for model and checkpoints
68
+ num_train_epochs=1,
69
+ per_device_train_batch_size=8,
70
+ learning_rate=5e-5,
71
+ warmup_steps=500,
72
+ weight_decay=0.01,
73
+ logging_dir="./logs",
74
+ logging_steps=10,
75
+ save_steps=1000,
76
+ )
77
+
78
+
79
+ trainer = Trainer(
80
+ model=model, # Your model instance
81
+ args=training_args, # Training arguments
82
+ train_dataset=dataset, # Tokenized dataset with input_ids and labels
83
+ tokenizer=wrapped_tokenizer, # Wrapped tokenizer
84
+ data_collator=data_collator, # Data collator for causal language modeling
85
+ )
86
+ ````
87
 
88
  ### Model Description
89
 
 
131
  generated_text = wrapped_tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
132
  print(generated_text)
133
  ```