orionweller commited on
Commit
b83312b
Β·
verified Β·
1 Parent(s): 87eba90

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +9 -38
README.md CHANGED
@@ -12,7 +12,7 @@ pipeline_tag: fill-mask
12
  [![Data](https://img.shields.io/badge/πŸ€—%20Training%20Data-2T%20Tokens-green)](https://huggingface.co/datasets/jhu-clsp)
13
  [![GitHub](https://img.shields.io/badge/GitHub-Code-black)](https://github.com/jhu-clsp/ettin-encoder-vs-decoder)
14
 
15
- > 🎯 **TL;DR**: State-of-the-art paired encoder and decoder models (17M-1B params) trained identically for fair comparison. First open replication of ModernBERT recipe.
16
 
17
  πŸ“„ [Paper (Coming Soon)](https://github.com/jhu-clsp/ettin-encoder-vs-decoder) | πŸš€ [GitHub Repository](https://github.com/jhu-clsp/ettin-encoder-vs-decoder)
18
 
@@ -202,30 +202,9 @@ This checkpoint availability enables detailed analysis of training dynamics, los
202
 
203
  ## Usage Examples
204
 
205
- ### Encoder: Text Classification & Embeddings
206
-
207
- ```python
208
- from transformers import AutoTokenizer, AutoModel
209
- import torch
210
-
211
- # Load model and tokenizer
212
- tokenizer = AutoTokenizer.from_pretrained("jhu-clsp/ettin-encoder-150m")
213
- model = AutoModel.from_pretrained("jhu-clsp/ettin-encoder-150m")
214
-
215
- def get_embeddings(text):
216
- inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
217
- with torch.no_grad():
218
- outputs = model(**inputs)
219
- # Use [CLS] token representation
220
- return outputs.last_hidden_state[:, 0, :]
221
-
222
- # Example usage
223
- text = "This movie is absolutely fantastic!"
224
- embeddings = get_embeddings(text)
225
- print(f"Embedding shape: {embeddings.shape}")
226
- ```
227
-
228
  ### Encoder: Masked Language Modeling
 
 
229
 
230
  ```python
231
  from transformers import AutoTokenizer, AutoModelForMaskedLM
@@ -254,8 +233,13 @@ predictions = predict_masked_token(masked_text)
254
  print(f"Predictions: {predictions}")
255
  ```
256
 
 
 
257
  ### Decoder: Text Generation
258
 
 
 
 
259
  ```python
260
  from transformers import AutoTokenizer, AutoModelForCausalLM
261
  import torch
@@ -289,21 +273,8 @@ generated = generate_text(prompt)
289
  print(generated)
290
  ```
291
 
292
- ### Decoder: Few-Shot Learning
293
 
294
- ```python
295
- # Example: Few-shot sentiment classification
296
- prompt = '''
297
- Examples:
298
- Text: "I love this movie!" Sentiment: Positive
299
- Text: "This is terrible." Sentiment: Negative
300
- Text: "It was okay." Sentiment: Neutral
301
-
302
- Text: "Absolutely amazing film!" Sentiment:'''
303
-
304
- result = generate_text(prompt, max_length=len(tokenizer.encode(prompt)) + 10)
305
- print(result)
306
- ```
307
 
308
  ## πŸ”¬ Research Applications
309
 
 
12
  [![Data](https://img.shields.io/badge/πŸ€—%20Training%20Data-2T%20Tokens-green)](https://huggingface.co/datasets/jhu-clsp)
13
  [![GitHub](https://img.shields.io/badge/GitHub-Code-black)](https://github.com/jhu-clsp/ettin-encoder-vs-decoder)
14
 
15
+ > 🎯 **TL;DR**: State-of-the-art paired encoder and decoder models (17M-1B params) trained identically for fair comparison. First open replication of ModernBERT recipe. Decoder version beats Llama 3.2.
16
 
17
  πŸ“„ [Paper (Coming Soon)](https://github.com/jhu-clsp/ettin-encoder-vs-decoder) | πŸš€ [GitHub Repository](https://github.com/jhu-clsp/ettin-encoder-vs-decoder)
18
 
 
202
 
203
  ## Usage Examples
204
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  ### Encoder: Masked Language Modeling
206
+ <details>
207
+ <summary>Click to expand <strong>encoder</strong> usage examples</summary>
208
 
209
  ```python
210
  from transformers import AutoTokenizer, AutoModelForMaskedLM
 
233
  print(f"Predictions: {predictions}")
234
  ```
235
 
236
+ </details>
237
+
238
  ### Decoder: Text Generation
239
 
240
+ <details>
241
+ <summary>Click to expand <strong>decoder text generation</strong></summary>
242
+
243
  ```python
244
  from transformers import AutoTokenizer, AutoModelForCausalLM
245
  import torch
 
273
  print(generated)
274
  ```
275
 
276
+ </details>
277
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
 
279
  ## πŸ”¬ Research Applications
280