jscore2023 commited on
Commit
9a52399
1 Parent(s): ce63ab7

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +9 -1
handler.py CHANGED
@@ -9,8 +9,16 @@ class EndpointHandler:
9
  # load model and tokenizer from path
10
  self.tokenizer = AutoTokenizer.from_pretrained(path)
11
  self.model = AutoModelForCausalLM.from_pretrained(
12
- path, device_map="auto", torch_dtype=torch.float16, trust_remote_code=True
 
 
 
 
13
  )
 
 
 
 
14
  self.device = "cuda" if torch.cuda.is_available() else "cpu"
15
 
16
  def __call__(self, data: Dict[str, Any]) -> Dict[str, str]:
 
9
  # load model and tokenizer from path
10
  self.tokenizer = AutoTokenizer.from_pretrained(path)
11
  self.model = AutoModelForCausalLM.from_pretrained(
12
+ path,
13
+ return_dict=True,
14
+ quantization_config=bnb_config,
15
+ device_map="auto",
16
+ trust_remote_code=True
17
  )
18
+
19
+ # self.model = AutoModelForCausalLM.from_pretrained(
20
+ # path, device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True
21
+ # )
22
  self.device = "cuda" if torch.cuda.is_available() else "cpu"
23
 
24
  def __call__(self, data: Dict[str, Any]) -> Dict[str, str]: