Run this model with HF Jobs
Run mispeech/dasheng-base on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/mispeech/dasheng-base. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/mispeech/dasheng-base on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
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)# pip install -U transformers accelerate # 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
Download configuration_dasheng.py from mispeech/dasheng-base: direct link, hf CLI and curl.
- Browser
- Download file 2.8 kB
-
https://huggingface.co/mispeech/dasheng-base/resolve/main/configuration_dasheng.py
- Command line
-
hf download hf://mispeech/dasheng-base/configuration_dasheng.py
-
curl -L -o configuration_dasheng.py https://huggingface.co/mispeech/dasheng-base/resolve/main/configuration_dasheng.py
2.8 kB
| # coding=utf-8 | |
| # Copyright 2023-2024 Xiaomi Corporation and HuggingFace Inc. team. All rights reserved. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| """ Dasheng model configuration""" | |
| from transformers import PretrainedConfig | |
| DASHENG_PRETRAINED_CONFIG_ARCHIVE_MAP = { | |
| "mispeech/dasheng-base": "https://huggingface.co/mispeech/dasheng-base/resolve/main/config.json", | |
| "mispeech/dasheng-0.6B": "https://huggingface.co/mispeech/dasheng-0.6B/resolve/main/config.json", | |
| "mispeech/dasheng-1.2B": "https://huggingface.co/mispeech/dasheng-1.2B/resolve/main/config.json", | |
| } | |
| class DashengConfig(PretrainedConfig): | |
| model_type = "dasheng" | |
| def __init__( | |
| self, | |
| name: str = "dasheng-base", | |
| loss: str = "BCELoss", | |
| **kwargs, | |
| ): | |
| r""" | |
| Configuration class for the Dasheng model. | |
| Args: | |
| name (str, *optional*): | |
| Can be "dasheng-base", "dasheng-0.6B", or "dasheng-1.2B". Default to "dasheng-base". | |
| loss (str, *optional*): | |
| Name of the loss function to use. Can be any loss in `nn.modules.loss`. Default to "BCELoss". | |
| kwargs (dict, *optional*): | |
| Additional keyword arguments, see `dasheng_model.modeling_dasheng.DashengFeatureExtractor` and `dasheng_model.modeling_dasheng.AudioTransformerMAE_Encoder` for more details. | |
| """ | |
| super().__init__(**kwargs) | |
| encoder_kwargs = dict(target_length=1008, patch_size=[64, 4], patch_stride=[64, 4]) | |
| if name == "dasheng-1.2B": | |
| encoder_kwargs["embed_dim"] = 1536 | |
| encoder_kwargs["depth"] = 40 | |
| encoder_kwargs["num_heads"] = 24 | |
| elif name == "dasheng-0.6B": | |
| encoder_kwargs["embed_dim"] = 1280 | |
| encoder_kwargs["depth"] = 32 | |
| encoder_kwargs["num_heads"] = 16 | |
| elif name == "dasheng-base": | |
| encoder_kwargs["embed_dim"] = 768 | |
| encoder_kwargs["depth"] = 12 | |
| encoder_kwargs["num_heads"] = 12 | |
| else: | |
| raise ValueError(f"Unrecognized model name: {name}") | |
| self.name = name | |
| encoder_kwargs.update((k, kwargs[k]) for k in set(kwargs).intersection(encoder_kwargs)) | |
| self.encoder_kwargs = {**encoder_kwargs, **kwargs} | |
| self.loss = loss | |