Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
# === Obtained with following code. ===
|
| 7 |
+
import os
|
| 8 |
+
import torch
|
| 9 |
+
torch.set_default_dtype(torch.bfloat16)
|
| 10 |
+
from transformers import AutoTokenizer, AutoConfig, Cohere2ForCausalLM, AutoModelForCausalLM
|
| 11 |
+
|
| 12 |
+
model_id = "CohereLabs/tiny-aya-base"
|
| 13 |
+
config = AutoConfig.from_pretrained(model_id)
|
| 14 |
+
|
| 15 |
+
config.num_hidden_layers=2
|
| 16 |
+
config.layer_types=[
|
| 17 |
+
"sliding_attention",
|
| 18 |
+
"full_attention",
|
| 19 |
+
]
|
| 20 |
+
config.num_attention_heads=4
|
| 21 |
+
config.hidden_size=4
|
| 22 |
+
config.intermediate_size=5
|
| 23 |
+
|
| 24 |
+
model = Cohere2ForCausalLM(config)
|
| 25 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 26 |
+
|
| 27 |
+
output_dir = "./tiny-random-aya-base/"
|
| 28 |
+
os.makedirs(output_dir, exist_ok=True)
|
| 29 |
+
model.save_pretrained(output_dir, safe_serialization=True)
|
| 30 |
+
tokenizer.save_pretrained(output_dir)
|
| 31 |
+
|