Jingya HF staff commited on
Commit
d33f60f
1 Parent(s): cfbbb3f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +29 -3
README.md CHANGED
@@ -1,3 +1,29 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ ---
4
+ This is model is compiled explicitly for AWS Neuronx(inferentia 2 / trainium 1) with the following codes:
5
+
6
+ ```python
7
+ from datasets import load_dataset
8
+ from transformers import AutoProcessor
9
+
10
+ from optimum.neuron import NeuronModelForAudioClassification, pipeline
11
+
12
+
13
+ dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
14
+ dataset = dataset.sort("id")
15
+ sampling_rate = dataset.features["audio"].sampling_rate
16
+
17
+ model_id = "anton-l/wav2vec2-base-superb-sd"
18
+ feature_extractor = AutoFeatureExtractor.from_pretrained("anton-l/wav2vec2-base-superb-sd")
19
+ input_shapes = {"batch_size": 1, "audio_sequence_length": 100000}
20
+ compiler_args = {"auto_cast": "matmul", "auto_cast_type": "bf16"}
21
+ model = NeuronModelForAudioFrameClassification.from_pretrained(
22
+ model_id,
23
+ export=True,
24
+ disable_neuron_cache=True,
25
+ **input_shapes,
26
+ **compiler_args,
27
+ )
28
+ model.save_pretrained("wav2vec2_neuron")
29
+ ```