Run this model with HF Jobs
Run suno/bark 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/suno/bark. 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/suno/bark 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 suno/bark with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use suno/bark with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-to-speech", model="suno/bark")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForTextToWaveform processor = AutoProcessor.from_pretrained("suno/bark") model = AutoModelForTextToWaveform.from_pretrained("suno/bark", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add transformers usage
Browse filesBark will be added to Transformers pretty soon! It is now time to update the model cars to mention the HF implementation!
37 unmodified lines383940414243447 unmodified lines5253545556575859606137 unmodified linesThe following is additional information about the models released here.## Model Usage```pythonfrom bark import SAMPLE_RATE, generate_audio, preload_models7 unmodified linesHello, my name is Suno. And, uh — and I like pizza. [laughs]But I also have other interests such as playing tic tac toe."""audio_array = generate_audio(text_prompt)# play text in notebookAudio(audio_array, rate=SAMPLE_RATE)```[pizza.webm](https://user-images.githubusercontent.com/5068315/230490503-417e688d-5115-4eee-9550-b46a2b465ee3.webm)37 unmodified lines383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697987 unmodified lines10610710810911011111211311411537 unmodified linesThe following is additional information about the models released here.## 🤗 Transformers UsageYou can run Bark locally with the 🤗 Transformers library from version 4.31.0 onwards.1. First install the 🤗 [Transformers library](https://github.com/huggingface/transformers) from main:```pip install git+https://github.com/huggingface/transformers.git```2. Run the following Python code to generate speech samples:```pythonfrom transformers import AutoProcessor, AutoModelprocessor = AutoProcessor.from_pretrained("suno/bark-small")model = AutoModel.from_pretrained("suno/bark-small")inputs = processor(text=["Hello, my name is Suno. And, uh — and I like pizza. [laughs] But I also have other interests such as playing tic tac toe."],return_tensors="pt",)speech_values = model.generate_speech(**inputs, do_sample=True)```3. Listen to the speech samples either in an ipynb notebook:```pythonfrom IPython.display import Audiosampling_rate = model.config.sample_rateAudio(speech_values.cpu().numpy().squeeze(), rate=sampling_rate)```Or save them as a `.wav` file using a third-party library, e.g. `scipy`:```pythonimport scipysampling_rate = model.config.sample_ratescipy.io.wavfile.write("bark_out.wav", rate=sampling_rate, data=speech_values.cpu().numpy().squeeze())```For more details on using the Bark model for inference using the 🤗 Transformers library, refer to the [Bark docs](https://huggingface.co/docs/transformers/model_doc/bark).## Suno UsageYou can also run Bark locally through the original [Bark library]((https://github.com/suno-ai/bark):1. First install the [`bark` library](https://github.com/suno-ai/bark)3. Run the following Python code:```pythonfrom bark import SAMPLE_RATE, generate_audio, preload_models7 unmodified linesHello, my name is Suno. And, uh — and I like pizza. [laughs]But I also have other interests such as playing tic tac toe."""speech_array = generate_audio(text_prompt)# play text in notebookAudio(speech_array, rate=SAMPLE_RATE)```[pizza.webm](https://user-images.githubusercontent.com/5068315/230490503-417e688d-5115-4eee-9550-b46a2b465ee3.webm)
README.md+57-3