Update README.md
Browse files
README.md
CHANGED
|
@@ -30,23 +30,18 @@ Notable differences from other available models include:
|
|
| 30 |
- **Repository:** https://github.com/jimbozhang/hf_transformers_custom_model_ced
|
| 31 |
- **Paper:** [CED: Consistent ensemble distillation for audio tagging](https://arxiv.org/abs/2308.11957)
|
| 32 |
- **Demo:** https://huggingface.co/spaces/mispeech/ced-base
|
| 33 |
-
|
| 34 |
-
## Install
|
| 35 |
-
```bash
|
| 36 |
-
pip install git+https://github.com/jimbozhang/hf_transformers_custom_model_ced.git
|
| 37 |
```
|
| 38 |
|
| 39 |
## Inference
|
| 40 |
```python
|
| 41 |
-
>>> from
|
| 42 |
-
>>> from ced_model.modeling_ced import CedForAudioClassification
|
| 43 |
|
| 44 |
>>> model_name = "mispeech/ced-mini"
|
| 45 |
-
>>> feature_extractor =
|
| 46 |
-
>>> model =
|
| 47 |
|
| 48 |
>>> import torchaudio
|
| 49 |
-
>>> audio, sampling_rate = torchaudio.load("
|
| 50 |
>>> assert sampling_rate == 16000
|
| 51 |
>>> inputs = feature_extractor(audio, sampling_rate=sampling_rate, return_tensors="pt")
|
| 52 |
|
|
|
|
| 30 |
- **Repository:** https://github.com/jimbozhang/hf_transformers_custom_model_ced
|
| 31 |
- **Paper:** [CED: Consistent ensemble distillation for audio tagging](https://arxiv.org/abs/2308.11957)
|
| 32 |
- **Demo:** https://huggingface.co/spaces/mispeech/ced-base
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
```
|
| 34 |
|
| 35 |
## Inference
|
| 36 |
```python
|
| 37 |
+
>>> from transformers import AutoModelForAudioClassification, AutoFeatureExtractor
|
|
|
|
| 38 |
|
| 39 |
>>> model_name = "mispeech/ced-mini"
|
| 40 |
+
>>> feature_extractor = AutoFeatureExtractor.from_pretrained(model_name, trust_remote_code=True)
|
| 41 |
+
>>> model = AutoModelForAudioClassification.from_pretrained(model_name, trust_remote_code=True)
|
| 42 |
|
| 43 |
>>> import torchaudio
|
| 44 |
+
>>> audio, sampling_rate = torchaudio.load("/path-to/JeD5V5aaaoI_931_932.wav")
|
| 45 |
>>> assert sampling_rate == 16000
|
| 46 |
>>> inputs = feature_extractor(audio, sampling_rate=sampling_rate, return_tensors="pt")
|
| 47 |
|