Xenova HF Staff commited on
Commit
dec1f9b
·
verified ·
1 Parent(s): 8db7a83

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +35 -0
README.md CHANGED
@@ -11,6 +11,41 @@ tags: []
11
 
12
  ## Model Details
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  ### Model Description
15
 
16
  <!-- Provide a longer summary of what this model is. -->
 
11
 
12
  ## Model Details
13
 
14
+ Tiny `Gemma2ForCausalLM` with randomly-initialized weights for testing. Code to generate:
15
+ ```py
16
+ import torch
17
+ from transformers import Gemma2ForCausalLM, Gemma2Config, AutoTokenizer
18
+
19
+ # Set seed for reproducibility
20
+ torch.manual_seed(0)
21
+
22
+ # Initializing a Gemma2 gemma2-9b style configuration
23
+ configuration = Gemma2Config(
24
+ head_dim=16,
25
+ hidden_size=32,
26
+ initializer_range=0.02,
27
+ intermediate_size=64,
28
+ max_position_embeddings=8192,
29
+ model_type="gemma2",
30
+ num_attention_heads=2,
31
+ num_hidden_layers=1,
32
+ num_key_value_heads=2,
33
+ vocab_size=256000,
34
+ attn_implementation='eager',
35
+ )
36
+
37
+ # Initializing a model from the gemma2-9b style configuration
38
+ model = Gemma2ForCausalLM(configuration)
39
+
40
+ # Re-use gemma2 tokenizer
41
+ tokenizer = AutoTokenizer.from_pretrained("Xenova/gemma2-tokenizer")
42
+
43
+ # Upload to the HF Hub
44
+ model_id = 'hf-internal-testing/tiny-random-Gemma2ForCausalLM'
45
+ model.push_to_hub(model_id)
46
+ tokenizer.push_to_hub(model_id)
47
+ ```
48
+
49
  ### Model Description
50
 
51
  <!-- Provide a longer summary of what this model is. -->