dhruvvaidh
commited on
Update handler.py
Browse files- handler.py +2 -1
handler.py
CHANGED
@@ -8,8 +8,9 @@ api = HfApi(token=os.getenv("HUGGINGFACE_HUB_TOKEN"))
|
|
8 |
|
9 |
class EndpointHandler():
|
10 |
def __init__(self, path=""):
|
|
|
11 |
self.device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
12 |
-
self.model = LlamaForCausalLM.from_pretrained(path).to(self.device)
|
13 |
self.tokenizer = AutoTokenizer.from_pretrained(path)
|
14 |
|
15 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
|
|
8 |
|
9 |
class EndpointHandler():
|
10 |
def __init__(self, path=""):
|
11 |
+
self.token = os.getenv("HUGGINGFACE_HUB_TOKEN")
|
12 |
self.device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
13 |
+
self.model = LlamaForCausalLM.from_pretrained(path,token=self.token).to(self.device)
|
14 |
self.tokenizer = AutoTokenizer.from_pretrained(path)
|
15 |
|
16 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|