You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
forsampleintqdm(dataset, desc=f"Extracting and copying MP3 files for {lang}"):
25
+
audio_path=sample['audio']['path']
26
+
shutil.copy(audio_path, output_folder)
27
+
28
+
print("Extraction and copy complete.")
29
+
30
+
if__name__=="__main__":
31
+
parser=argparse.ArgumentParser(description="Extract and copy audio files from a dataset to a specified directory.")
32
+
parser.add_argument("--output_dir", type=str, default="/data/commonVoice", help="Base output directory for saving the files. Default is /data/commonVoice")
"To generate an overall results output summary, the audio_ground_truth_labels.csv file needs to be modified with the name of the audio file and expected audio label (i.e. en for English). By default, this is disabled but if desired, the *--ground_truth_compare* can be used. To run inference on custom data, you must specify a folder with WAV files and pass the path in as an argument. "
58
+
"To run inference on custom data, you must specify a folder with .wav files and pass the path in as an argument. You can do so by creating a folder named `data_custom` and then copy 1 or 2 .wav files from your test dataset into it. .mp3 files will NOT work."
59
59
]
60
60
},
61
61
{
@@ -65,7 +65,7 @@
65
65
"### Randomly select audio clips from audio files for prediction\n",
"This will apply ipex.optimize to the model(s) and TorchScript. You can also add the --bf16 option along with --ipex to run in the BF16 data type, supported on 4th Gen Intel® Xeon® Scalable processors and newer.\n",
108
+
"\n",
107
109
"Note that the *--verbose* option is required to view the latency measurements. "
108
110
]
109
111
},
@@ -121,7 +123,7 @@
121
123
"metadata": {},
122
124
"source": [
123
125
"## Quantization with Intel® Neural Compressor (INC)\n",
124
-
"To improve inference latency, Intel® Neural Compressor (INC) can be used to quantize the trained model from FP32 to INT8 by running quantize_model.py. The *-datapath* argument can be used to specify a custom evaluation dataset but by default it is set to */data/commonVoice/dev* which was generated from the data preprocessing scripts in the *Training* folder. "
126
+
"To improve inference latency, Intel® Neural Compressor (INC) can be used to quantize the trained model from FP32 to INT8 by running quantize_model.py. The *-datapath* argument can be used to specify a custom evaluation dataset but by default it is set to `$COMMON_VOICE_PATH/processed_data/dev` which was generated from the data preprocessing scripts in the `Training` folder. "
"After quantization, the model will be stored in lang_id_commonvoice_model_INT8 and neural_compressor.utils.pytorch.load will have to be used to load the quantized model for inference. If self.language_id is the original model and data_path is the path to the audio file:\n",
"After quantization, the model will be stored in *lang_id_commonvoice_model_INT8* and *neural_compressor.utils.pytorch.load* will have to be used to load the quantized model for inference. "
156
+
"The code above is integrated into inference_custom.py. You can now run inference on your data using this INT8 model:"
"### (Optional) Comparing Predictions with Ground Truth\n",
173
+
"\n",
174
+
"You can choose to modify audio_ground_truth_labels.csv to include the name of the audio file and expected audio label (like, en for English), then run inference_custom.py with the --ground_truth_compare option. By default, this is disabled."
0 commit comments