Instructions to use mispeech/dasheng-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mispeech/dasheng-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("audio-classification", model="mispeech/dasheng-base", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("mispeech/dasheng-base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -32,13 +32,7 @@ pip install git+https://github.com/jimbozhang/hf_transformers_custom_model_dashe
|
|
| 32 |
>>> feature_extractor = DashengFeatureExtractor.from_pretrained(model_name)
|
| 33 |
>>> model = DashengModel.from_pretrained(model_name, outputdim=None) # no linear output layer if `outputdim` is `None`
|
| 34 |
|
| 35 |
-
>>>
|
| 36 |
-
>>> audio, sampling_rate = torchaudio.load("resources/JeD5V5aaaoI_931_932.wav")
|
| 37 |
-
>>> assert sampling_rate == 16000
|
| 38 |
-
>>> audio.shape
|
| 39 |
-
torch.Size([1, 16000]) # mono audio of 1 second
|
| 40 |
-
|
| 41 |
-
>>> inputs = feature_extractor(audio, sampling_rate=sampling_rate, return_tensors="pt")
|
| 42 |
>>> inputs.input_values.shape
|
| 43 |
torch.Size([1, 64, 101]) # 64 mel-filterbanks, 101 frames
|
| 44 |
|
|
|
|
| 32 |
>>> feature_extractor = DashengFeatureExtractor.from_pretrained(model_name)
|
| 33 |
>>> model = DashengModel.from_pretrained(model_name, outputdim=None) # no linear output layer if `outputdim` is `None`
|
| 34 |
|
| 35 |
+
>>> inputs = feature_extractor(torch.randn(1, 16000), sampling_rate=sampling_rate, return_tensors="pt")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
>>> inputs.input_values.shape
|
| 37 |
torch.Size([1, 64, 101]) # 64 mel-filterbanks, 101 frames
|
| 38 |
|