commit files to HF hub
Browse files- README.md +12 -18
- config.json +2 -1
- inference.py +10 -0
- openvino_model.bin +2 -2
- openvino_model.xml +0 -0
- preprocessor_config.json +9 -0
README.md
CHANGED
@@ -7,25 +7,19 @@ tags:
|
|
7 |
|
8 |
# anton-l/wav2vec2-base-superb-sd
|
9 |
|
10 |
-
This is the [anton-l/wav2vec2-base-superb-sd](https://huggingface.co/anton-l/wav2vec2-base-superb-sd) model,
|
11 |
-
to OpenVINO. An example of how to do inference on this model:
|
12 |
|
|
|
13 |
```python
|
14 |
-
from
|
15 |
-
from
|
16 |
-
from datasets import load_dataset
|
17 |
-
import torch
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
logits = model(**inputs).logits
|
27 |
-
|
28 |
-
probabilities = torch.sigmoid(torch.as_tensor(logits)[0])
|
29 |
-
labels = (probabilities > 0.5).long()
|
30 |
-
print(labels[0].tolist())
|
31 |
```
|
|
|
|
7 |
|
8 |
# anton-l/wav2vec2-base-superb-sd
|
9 |
|
10 |
+
This is the [anton-l/wav2vec2-base-superb-sd](https://huggingface.co/anton-l/wav2vec2-base-superb-sd) model converted to [OpenVINO](https://openvino.ai), for accelerated inference.
|
|
|
11 |
|
12 |
+
An example of how to do inference on this model:
|
13 |
```python
|
14 |
+
from optimum.intel import OVModelForAudioFrameClassification
|
15 |
+
from transformers import AutoFeatureExtractor, pipeline
|
|
|
|
|
16 |
|
17 |
+
# model_id should be set to either a local directory or a model available on the HuggingFace hub.
|
18 |
+
model_id = "helenai/anton-l-wav2vec2-base-superb-sd-ov"
|
19 |
+
feature_extractor = AutoFeatureExtractor.from_pretrained(model_id, trust_remote_code=True)
|
20 |
+
model = OVModelForAudioFrameClassification.from_pretrained(model_id)
|
21 |
+
pipe = pipeline("None", model=model, feature_extractor=feature_extractor)
|
22 |
+
result = pipe("hello world")
|
23 |
+
print(result)
|
|
|
|
|
|
|
|
|
|
|
24 |
```
|
25 |
+
|
config.json
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
{
|
2 |
"_name_or_path": "anton-l/wav2vec2-base-superb-sd",
|
3 |
"activation_dropout": 0.0,
|
|
|
4 |
"adapter_kernel_size": 3,
|
5 |
"adapter_stride": 2,
|
6 |
"add_adapter": false,
|
@@ -118,7 +119,7 @@
|
|
118 |
1
|
119 |
],
|
120 |
"torch_dtype": "float32",
|
121 |
-
"transformers_version": "4.
|
122 |
"use_weighted_layer_sum": true,
|
123 |
"vocab_size": 32,
|
124 |
"xvector_output_dim": 512
|
|
|
1 |
{
|
2 |
"_name_or_path": "anton-l/wav2vec2-base-superb-sd",
|
3 |
"activation_dropout": 0.0,
|
4 |
+
"adapter_attn_dim": null,
|
5 |
"adapter_kernel_size": 3,
|
6 |
"adapter_stride": 2,
|
7 |
"add_adapter": false,
|
|
|
119 |
1
|
120 |
],
|
121 |
"torch_dtype": "float32",
|
122 |
+
"transformers_version": "4.39.0",
|
123 |
"use_weighted_layer_sum": true,
|
124 |
"vocab_size": 32,
|
125 |
"xvector_output_dim": 512
|
inference.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from optimum.intel import OVModelForAudioFrameClassification
|
2 |
+
from transformers import AutoFeatureExtractor, pipeline
|
3 |
+
|
4 |
+
# model_id should be set to either a local directory or a model available on the HuggingFace hub.
|
5 |
+
model_id = "helenai/anton-l-wav2vec2-base-superb-sd-ov"
|
6 |
+
feature_extractor = AutoFeatureExtractor.from_pretrained(model_id, trust_remote_code=True)
|
7 |
+
model = OVModelForAudioFrameClassification.from_pretrained(model_id)
|
8 |
+
pipe = pipeline("None", model=model, feature_extractor=feature_extractor)
|
9 |
+
result = pipe("hello world")
|
10 |
+
print(result)
|
openvino_model.bin
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:231a8c2e48c0feddd0480116cb79181c5880537c411edfd3b3ee1110ab703f30
|
3 |
+
size 188744922
|
openvino_model.xml
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
preprocessor_config.json
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"do_normalize": false,
|
3 |
+
"feature_extractor_type": "Wav2Vec2FeatureExtractor",
|
4 |
+
"feature_size": 1,
|
5 |
+
"padding_side": "right",
|
6 |
+
"padding_value": 0.0,
|
7 |
+
"return_attention_mask": true,
|
8 |
+
"sampling_rate": 16000
|
9 |
+
}
|