Amirhossein75 commited on
Commit
41287af
·
1 Parent(s): 5161553

add correct usage in huggingface

Browse files
Files changed (2) hide show
  1. README.md +2 -5
  2. vocab.json +1 -0
README.md CHANGED
@@ -89,20 +89,16 @@ This project fine‑tunes a Wav2Vec2 audio classifier (e.g., `facebook/wav2vec2-
89
 
90
  Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. Evaluate on target devices/microphones; add noise augmentation and tune detection thresholds for deployment context.
91
 
92
- ## How to use it in HuggingFace
93
  ```bash
94
  from transformers import AutoFeatureExtractor, AutoModelForAudioClassification, pipeline
95
 
96
  model_id = "Amirhossein75/Keyword-Spotting"
97
- ```
98
  # Option A — simple:
99
- ```bash
100
  clf = pipeline("audio-classification", model=model_id)
101
  print(clf("path/to/1sec_16kHz.wav"))
102
- ```
103
 
104
  # Option B — manual pre/post:
105
- ```bash
106
  fe = AutoFeatureExtractor.from_pretrained(model_id)
107
  model = AutoModelForAudioClassification.from_pretrained(model_id)
108
 
@@ -115,6 +111,7 @@ pred_id = int(logits.argmax(-1))
115
  print(model.config.id2label[pred_id])
116
 
117
  ```
 
118
 
119
  ## How to Get Started with the Model
120
 
 
89
 
90
  Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. Evaluate on target devices/microphones; add noise augmentation and tune detection thresholds for deployment context.
91
 
92
+ ## Usage in HuggingFace (Recommended)
93
  ```bash
94
  from transformers import AutoFeatureExtractor, AutoModelForAudioClassification, pipeline
95
 
96
  model_id = "Amirhossein75/Keyword-Spotting"
 
97
  # Option A — simple:
 
98
  clf = pipeline("audio-classification", model=model_id)
99
  print(clf("path/to/1sec_16kHz.wav"))
 
100
 
101
  # Option B — manual pre/post:
 
102
  fe = AutoFeatureExtractor.from_pretrained(model_id)
103
  model = AutoModelForAudioClassification.from_pretrained(model_id)
104
 
 
111
  print(model.config.id2label[pred_id])
112
 
113
  ```
114
+ **Note** : it is better not to use the `AutoProcessor`
115
 
116
  ## How to Get Started with the Model
117
 
vocab.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"<pad>": 0, "<s>": 1, "</s>": 2, "<unk>": 3, "|": 4, "E": 5, "T": 6, "A": 7, "O": 8, "N": 9, "I": 10, "H": 11, "S": 12, "R": 13, "D": 14, "L": 15, "U": 16, "M": 17, "W": 18, "C": 19, "F": 20, "G": 21, "Y": 22, "P": 23, "B": 24, "V": 25, "K": 26, "'": 27, "X": 28, "J": 29, "Q": 30, "Z": 31}