helenai commited on
Commit
54d1502
1 Parent(s): 6b26b3a

commit files to HF hub

Browse files
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, converted
11
- to OpenVINO. An example of how to do inference on this model:
12
 
 
13
  ```python
14
- from transformers import AutoFeatureExtractor
15
- from optimum.intel.openvino import OVModelForAudioFrameClassification
16
- from datasets import load_dataset
17
- import torch
18
 
19
- dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
20
- dataset = dataset.sort("id")
21
- sampling_rate = dataset.features["audio"].sampling_rate
22
-
23
- feature_extractor = AutoFeatureExtractor.from_pretrained("helenai/anton-l-wav2vec2-base-superb-sd-ov")
24
- model = OVModelForAudioFrameClassification.from_pretrained("helenai/anton-l-wav2vec2-base-superb-sd-ov")
25
- inputs = feature_extractor(dataset[0]["audio"]["array"], return_tensors="np", sampling_rate=sampling_rate)
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.28.1",
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:561fc066c6afba3c5fa987b2a022ba1a4721856e2a179569cb454a63a528b0f6
3
- size 377493804
 
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
+ }