Instructions to use derrickdso/samplegen-small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use derrickdso/samplegen-small with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-to-audio", model="derrickdso/samplegen-small")# Load model directly from transformers import AutoTokenizer, AutoModelForTextToWaveform tokenizer = AutoTokenizer.from_pretrained("derrickdso/samplegen-small") model = AutoModelForTextToWaveform.from_pretrained("derrickdso/samplegen-small") - Notebooks
- Google Colab
- Kaggle
Commit ·
1f7a2e3
1
Parent(s): c2f9b04
Update handler.py
Browse files- handler.py +2 -2
handler.py
CHANGED
|
@@ -5,8 +5,8 @@ import torch
|
|
| 5 |
class EndpointHandler:
|
| 6 |
def __init__(self, path=""):
|
| 7 |
# load model and processor from path
|
| 8 |
-
|
| 9 |
-
|
| 10 |
|
| 11 |
def __call__(self, data: Dict[str, Any]) -> Dict[str, str]:
|
| 12 |
"""
|
|
|
|
| 5 |
class EndpointHandler:
|
| 6 |
def __init__(self, path=""):
|
| 7 |
# load model and processor from path
|
| 8 |
+
self.processor = AutoProcessor.from_pretrained(path)
|
| 9 |
+
self.model = MusicgenForConditionalGeneration.from_pretrained(path, torch_dtype=torch.float16).to("cuda")
|
| 10 |
|
| 11 |
def __call__(self, data: Dict[str, Any]) -> Dict[str, str]:
|
| 12 |
"""
|