Load dolly-v2 model with remote code trusted and full text returned (so it's usable with langchain)
Browse files- handler.py +2 -1
handler.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
from typing import Dict, Any, List
|
2 |
|
3 |
from transformers import pipeline
|
@@ -8,7 +9,7 @@ class EndpointHandler:
|
|
8 |
self,
|
9 |
path: str,
|
10 |
) -> None:
|
11 |
-
self.pipeline = pipeline(model=path, trust_remote_code=True, return_full_text=True)
|
12 |
|
13 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
14 |
"""
|
|
|
1 |
+
import torch
|
2 |
from typing import Dict, Any, List
|
3 |
|
4 |
from transformers import pipeline
|
|
|
9 |
self,
|
10 |
path: str,
|
11 |
) -> None:
|
12 |
+
self.pipeline = pipeline(model=path, torch_dtype=torch.bfloat16, trust_remote_code=True, return_full_text=True)
|
13 |
|
14 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
15 |
"""
|