Update app.py
Browse files
app.py
CHANGED
|
@@ -27,10 +27,16 @@ huggingface_token = os.environ["huggingface_token"]
|
|
| 27 |
model = WhisperModel.from_pretrained("mskov/whisper_miso", use_auth_token=huggingface_token)
|
| 28 |
feature_extractor = AutoFeatureExtractor.from_pretrained("mskov/whisper_miso", use_auth_token=huggingface_token)
|
| 29 |
|
| 30 |
-
model_config = WhisperConfig.from_pretrained("mskov/whisper_miso", use_auth_token=huggingface_token)
|
| 31 |
-
model = WhisperModel(config=model_config)
|
| 32 |
-
model.load_state_dict(torch.load("mskov/whisper_miso/pytorch_model.bin", use_auth_token=huggingface_token))
|
| 33 |
-
model.eval()
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
model = WhisperModel.from_pretrained("mskov/whisper_miso", use_auth_token=huggingface_token)
|
| 28 |
feature_extractor = AutoFeatureExtractor.from_pretrained("mskov/whisper_miso", use_auth_token=huggingface_token)
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
+
ds = load_dataset("mskov/miso_test", split="test").cast_column("audio", Audio(sampling_rate=16000))
|
| 32 |
+
|
| 33 |
+
print(ds, "and at 0 ", ds[0])
|
| 34 |
+
|
| 35 |
+
inputs = feature_extractor(ds[0]["audio"]["array"], return_tensors="pt")
|
| 36 |
+
print("check check")
|
| 37 |
+
print(inputs)
|
| 38 |
+
input_features = inputs.input_features
|
| 39 |
+
decoder_input_ids = torch.tensor([[1, 1]]) * model.config.decoder_start_token_id
|
| 40 |
+
last_hidden_state = model(input_features, decoder_input_ids=decoder_input_ids).last_hidden_state
|
| 41 |
+
list(last_hidden_state.shape)
|
| 42 |
+
print(list(last_hidden_state.shape))
|