Xenova HF staff commited on
Commit
088ba85
·
verified ·
1 Parent(s): ac8ef0e

Update README.md

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