Run this model with HF Jobs
Run BasketTechologies/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/BasketTechologies/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/BasketTechologies/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 BasketTechologies/bark with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BasketTechologies/bark with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-to-speech", model="BasketTechologies/bark")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForTextToWaveform processor = AutoProcessor.from_pretrained("BasketTechologies/bark") model = AutoModelForTextToWaveform.from_pretrained("BasketTechologies/bark", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update handler.py
Browse files1234567894 unmodified lines1415161718192021from typing import Dict, List, Anyfrom transformers import pipelineclass EndpointHandler():def __init__(self, path=""):self.pipeline = pipeline("text-to-speech", "suno/bark")def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:"""4 unmodified linesA :obj:`list` | `dict`: will be serialized and returned"""# get inputsinputs = data.pop("inputs",data)# run normal predictionprediction = self.pipeline(inputs)return prediction123456789104 unmodified lines15161718192021222324252627from typing import Dict, List, Anyfrom transformers import AutoProcessor,BarkModelclass EndpointHandler():def __init__(self, path=""):self.model = BarkModel.from_pretrained("suno/bark-small")self.processor = AutoProcessor.from_pretrained("suno/bark")def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:"""4 unmodified linesA :obj:`list` | `dict`: will be serialized and returned"""# get inputstext_prompt = data.pop("inputs",data)inputs = processor(text_prompt)# run normal predictionspeech_output = model.generate(**inputs.to(device))return speech_output
handler.py+12-6