Update README.md
Browse files
README.md
CHANGED
@@ -7,6 +7,32 @@ tags: []
|
|
7 |
|
8 |
<!-- Provide a quick summary of what the model is/does. -->
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
|
12 |
## Model Details
|
|
|
7 |
|
8 |
<!-- Provide a quick summary of what the model is/does. -->
|
9 |
|
10 |
+
## Code to create model
|
11 |
+
```py
|
12 |
+
from transformers import MoonshineConfig, MoonshineForConditionalGeneration, AutoProcessor
|
13 |
+
|
14 |
+
model_id = "UsefulSensors/moonshine-tiny"
|
15 |
+
config = MoonshineConfig.from_pretrained(
|
16 |
+
model_id,
|
17 |
+
decoder_num_attention_heads=2,
|
18 |
+
decoder_num_hidden_layers=1,
|
19 |
+
decoder_num_key_value_heads=2,
|
20 |
+
encoder_num_attention_heads=2,
|
21 |
+
encoder_num_hidden_layers=1,
|
22 |
+
encoder_num_key_value_heads=2,
|
23 |
+
hidden_size=64,
|
24 |
+
intermediate_size=128,
|
25 |
+
)
|
26 |
+
|
27 |
+
# Create model and randomize all weights
|
28 |
+
model = MoonshineForConditionalGeneration(config)
|
29 |
+
|
30 |
+
torch.manual_seed(0) # Set for reproducibility
|
31 |
+
for name, param in model.named_parameters():
|
32 |
+
param.data = torch.randn_like(param)
|
33 |
+
|
34 |
+
processor = AutoProcessor.from_pretrained(model_id)
|
35 |
+
```
|
36 |
|
37 |
|
38 |
## Model Details
|