Xenova HF Staff commited on
Commit
599f6de
·
verified ·
1 Parent(s): 2455227

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +25 -1
README.md CHANGED
@@ -7,7 +7,31 @@ tags: []
7
 
8
  <!-- Provide a quick summary of what the model is/does. -->
9
 
10
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  ## Model Details
13
 
 
7
 
8
  <!-- Provide a quick summary of what the model is/does. -->
9
 
10
+ ## Code to create the model
11
+ ```python
12
+ import torch
13
+ from transformers import Olmo2Config, Olmo2ForCausalLM, AutoTokenizer
14
+
15
+
16
+ model_id = 'allenai/OLMo-2-1124-13B-Instruct'
17
+ config = Olmo2Config.from_pretrained(
18
+ model_id,
19
+ hidden_size=32,
20
+ intermediate_size=64,
21
+ num_attention_heads=4,
22
+ num_hidden_layers=2,
23
+ num_key_value_heads=4,
24
+ )
25
+
26
+ # Create model and randomize all weights
27
+ model = Olmo2ForCausalLM(config)
28
+
29
+ torch.manual_seed(0) # Set for reproducibility
30
+ for name, param in model.named_parameters():
31
+ param.data = torch.randn_like(param)
32
+
33
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
34
+ ```
35
 
36
  ## Model Details
37