Update README.md
Browse files
README.md
CHANGED
|
@@ -7,7 +7,34 @@ tags: []
|
|
| 7 |
|
| 8 |
<!-- Provide a quick summary of what the model is/does. -->
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
## Model Details
|
| 13 |
|
|
|
|
| 7 |
|
| 8 |
<!-- Provide a quick summary of what the model is/does. -->
|
| 9 |
|
| 10 |
+
## Code to create model
|
| 11 |
+
```py
|
| 12 |
+
import torch
|
| 13 |
+
from transformers import WhisperConfig, WhisperForConditionalGeneration, AutoProcessor
|
| 14 |
+
|
| 15 |
+
model_id = 'onnx-community/whisper-tiny.en'
|
| 16 |
+
config = WhisperConfig.from_pretrained(
|
| 17 |
+
model_id,
|
| 18 |
+
d_model=16,
|
| 19 |
+
decoder_attention_heads=2,
|
| 20 |
+
decoder_ffn_dim=64,
|
| 21 |
+
decoder_layerdrop=0.0,
|
| 22 |
+
decoder_layers=1,
|
| 23 |
+
encoder_attention_heads=2,
|
| 24 |
+
encoder_ffn_dim=64,
|
| 25 |
+
encoder_layers=1,
|
| 26 |
+
num_hidden_layers=1,
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
# Create model and randomize all weights
|
| 30 |
+
model = WhisperForConditionalGeneration(config)
|
| 31 |
+
|
| 32 |
+
torch.manual_seed(0) # Set for reproducibility
|
| 33 |
+
for name, param in model.named_parameters():
|
| 34 |
+
param.data = torch.randn_like(param)
|
| 35 |
+
|
| 36 |
+
processor = AutoProcessor.from_pretrained(model_id)
|
| 37 |
+
```
|
| 38 |
|
| 39 |
## Model Details
|
| 40 |
|