Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Obtained with
|
2 |
+
|
3 |
+
```python
|
4 |
+
from transformers import WhisperForConditionalGeneration, WhisperConfig, WhisperProcessor, GenerationConfig
|
5 |
+
|
6 |
+
model_id = "openai/whisper-tiny"
|
7 |
+
orig_config = WhisperConfig.from_pretrained(model_id)
|
8 |
+
|
9 |
+
small_config = dict(
|
10 |
+
d_model=48,
|
11 |
+
encoder_layers=2,
|
12 |
+
decoder_layers=2,
|
13 |
+
encoder_attention_heads=3,
|
14 |
+
decoder_attention_heads=3,
|
15 |
+
encoder_ffn_dim=768,
|
16 |
+
decoder_ffn_dim=768,
|
17 |
+
)
|
18 |
+
small_config = WhisperConfig(**{**orig_config.to_dict(), **small_config})
|
19 |
+
|
20 |
+
|
21 |
+
save_dir = "tiny-random-whisper"
|
22 |
+
WhisperForConditionalGeneration(small_config).save_pretrained(save_dir)
|
23 |
+
WhisperProcessor.from_pretrained(model_id).save_pretrained(save_dir)
|
24 |
+
GenerationConfig.from_pretrained(model_id).save_pretrained(save_dir)
|
25 |
+
|
26 |
+
```
|