Deepmalya25 commited on
Commit
916eca2
Β·
verified Β·
1 Parent(s): 0e3c8f1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +55 -100
README.md CHANGED
@@ -42,8 +42,6 @@ This model recreates the GPT architecture scaled down just to 10.8M parameters.
42
  <!-- Provide the basic links for the model. -->
43
 
44
  - **Repository:** [(https://github.com/Deepmalya2506/From-Kernel-to-Silicon---Transformers)]
45
- - **Paper [optional]:** [More Information Needed]
46
- - **Demo [optional]:** [More Information Needed]
47
 
48
  ## Uses
49
 
@@ -88,107 +86,64 @@ Use the code below to get started with the model.
88
  #### Training Hyperparameters
89
 
90
  - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
 
 
 
 
 
 
 
 
 
 
91
 
92
- #### Speeds, Sizes, Times [optional]
93
-
94
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
95
-
96
- [More Information Needed]
97
 
98
  ## Evaluation
99
 
100
  <!-- This section describes the evaluation protocols and provides the results. -->
101
 
102
- ### Testing Data, Factors & Metrics
103
-
104
- #### Testing Data
105
-
106
- <!-- This should link to a Dataset Card if possible. -->
107
-
108
- [More Information Needed]
109
-
110
- #### Factors
111
-
112
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
113
-
114
- [More Information Needed]
115
-
116
- #### Metrics
117
-
118
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
119
-
120
- [More Information Needed]
121
-
122
- ### Results
123
-
124
- [More Information Needed]
125
-
126
- #### Summary
127
-
128
-
129
-
130
- ## Model Examination [optional]
131
-
132
- <!-- Relevant interpretability work for the model goes here -->
133
-
134
- [More Information Needed]
135
-
136
- ## Environmental Impact
137
-
138
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
139
-
140
- 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).
141
-
142
- - **Hardware Type:** [More Information Needed]
143
- - **Hours used:** [More Information Needed]
144
- - **Cloud Provider:** [More Information Needed]
145
- - **Compute Region:** [More Information Needed]
146
- - **Carbon Emitted:** [More Information Needed]
147
-
148
- ## Technical Specifications [optional]
149
-
150
- ### Model Architecture and Objective
151
-
152
- [More Information Needed]
153
-
154
- ### Compute Infrastructure
155
-
156
- [More Information Needed]
157
-
158
- #### Hardware
159
-
160
- [More Information Needed]
161
-
162
- #### Software
163
-
164
- [More Information Needed]
165
-
166
- ## Citation [optional]
167
-
168
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
169
-
170
- **BibTeX:**
171
-
172
- [More Information Needed]
173
-
174
- **APA:**
175
-
176
- [More Information Needed]
177
-
178
- ## Glossary [optional]
179
-
180
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
181
-
182
- [More Information Needed]
183
-
184
- ## More Information [optional]
185
-
186
- [More Information Needed]
187
-
188
- ## Model Card Authors [optional]
189
-
190
- [More Information Needed]
191
-
192
- ## Model Card Contact
193
-
194
- [More Information Needed]
 
42
  <!-- Provide the basic links for the model. -->
43
 
44
  - **Repository:** [(https://github.com/Deepmalya2506/From-Kernel-to-Silicon---Transformers)]
 
 
45
 
46
  ## Uses
47
 
 
86
  #### Training Hyperparameters
87
 
88
  - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
89
+ - batch_size = 64 # how many independent sequences will we process in parallel?
90
+ - block_size = 256 # what is the maximum context length for predictions?
91
+ - max_iters = 5000
92
+ - eval_interval = 500
93
+ - learning_rate = 3e-4
94
+ - device = 'cuda' if torch.cuda.is_available() else 'cpu'
95
+ - eval_iters = 200
96
+ - n_embed=384
97
+ - n_head=6 # therefore every head (head_size)= 384//6 = 64 dim
98
+ - dropout=0.2
99
 
 
 
 
 
 
100
 
101
  ## Evaluation
102
 
103
  <!-- This section describes the evaluation protocols and provides the results. -->
104
 
105
+ * step 0: train loss 4.3585, val loss 4.3557
106
+ * step 500: train loss 2.0170, val loss 2.0917
107
+ * step 1000: train loss 1.6125, val loss 1.7842
108
+ * step 1500: train loss 1.4475, val loss 1.6449
109
+ * step 2000: train loss 1.3575, val loss 1.5784
110
+ * step 2500: train loss 1.2872, val loss 1.5347
111
+ * step 3000: train loss 1.2367, val loss 1.5039
112
+ * step 3500: train loss 1.1909, val loss 1.4929
113
+ * step 4000: train loss 1.1529, val loss 1.4847
114
+ * step 4500: train loss 1.1201, val loss 1.4798
115
+
116
+
117
+ #### Overview & Purpose
118
+ To prevent overfitting on the 1.1M character TinyShakespeare dataset, **Dropout (0.2)** is injected into:
119
+ 1. Attention softmax weights (dropping attention edges).
120
+ 2. Multi-Head projection layer outputs.
121
+ 3. FeedForward Network layer outputs.
122
+
123
+ #### Complete System Architecture Summary
124
+
125
+ ```
126
+ ====================================================================================================
127
+ Layer / Submodule Input Shape Output Shape Parameters
128
+ ====================================================================================================
129
+ Token Embedding Table (B, T) (B, T, 384) 65 x 384 = 24,960
130
+ Positional Embedding Table (T,) (T, 384) 256 x 384 = 98,304
131
+ ----------------------------------------------------------------------------------------------------
132
+ Block 1..6 (x6 Stacked):
133
+ β”œβ”€β”€ LayerNorm 1 (B, T, 384) (B, T, 384) 2 x 384 = 768
134
+ β”œβ”€β”€ Multi-Head Attention:
135
+ β”‚ β”œβ”€β”€ Key Linear (B, T, 384) (B, T, 384) 384 x 384 = 147,456
136
+ β”‚ β”œβ”€β”€ Query Linear (B, T, 384) (B, T, 384) 384 x 384 = 147,456
137
+ β”‚ β”œβ”€β”€ Value Linear (B, T, 384) (B, T, 384) 384 x 384 = 147,456
138
+ β”‚ └── Out Projection (B, T, 384) (B, T, 384) 384 x 384 + 384 = 147,840
139
+ β”œβ”€β”€ LayerNorm 2 (B, T, 384) (B, T, 384) 2 x 384 = 768
140
+ └── FeedForward Net:
141
+ β”œβ”€β”€ FC 1 (Expand) (B, T, 384) (B, T, 1536) 384 x 1536 + 1536 = 591,360
142
+ └── FC 2 (Contract) (B, T, 1536) (B, T, 384) 1536 x 384 + 384 = 590,208
143
+ ----------------------------------------------------------------------------------------------------
144
+ Final LayerNorm (B, T, 384) (B, T, 384) 2 x 384 = 768
145
+ Language Model Head (B, T, 384) (B, T, 65) 384 x 65 + 65 = 25,025
146
+ ====================================================================================================
147
+ Total Parameters: ~10,788,929 (~10.8 Million)
148
+ ====================================================================================================
149
+ ```