Add initial handler
Browse files- handler.py +1 -1
handler.py
CHANGED
@@ -5,7 +5,7 @@ import torch
|
|
5 |
class EndpointHandler:
|
6 |
def __init__(self, path=""):
|
7 |
self.processor = AutoProcessor.from_pretrained(path)
|
8 |
-
self.model = MusicgenForConditionalGeneration.from_pretrained(path)
|
9 |
|
10 |
def __call__(self, data: Dict[str, Any]) -> Dict[str, str]:
|
11 |
text_input = data.pop("inputs", data)
|
|
|
5 |
class EndpointHandler:
|
6 |
def __init__(self, path=""):
|
7 |
self.processor = AutoProcessor.from_pretrained(path)
|
8 |
+
self.model = MusicgenForConditionalGeneration.from_pretrained(path, torch_dtype=torch.float16).to("cuda")
|
9 |
|
10 |
def __call__(self, data: Dict[str, Any]) -> Dict[str, str]:
|
11 |
text_input = data.pop("inputs", data)
|