WinterGYC commited on
Commit
5ccbdef
1 Parent(s): 7de579c

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +3 -3
handler.py CHANGED
@@ -9,9 +9,9 @@ dtype = torch.bfloat16 if torch.cuda.get_device_capability()[0] == 8 else torch.
9
  class EndpointHandler:
10
  def __init__(self, path=""):
11
  # load the model
12
- self.tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-13B-Chat", use_fast=False, trust_remote_code=True)
13
- self.model = AutoModelForCausalLM.from_pretrained("baichuan-inc/Baichuan-13B-Chat", device_map="auto", torch_dtype=dtype, trust_remote_code=True)
14
- self.model.generation_config = GenerationConfig.from_pretrained("baichuan-inc/Baichuan-13B-Chat")
15
 
16
  def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
17
  inputs = data.pop("inputs", data)
 
9
  class EndpointHandler:
10
  def __init__(self, path=""):
11
  # load the model
12
+ self.model = AutoModelForCausalLM.from_pretrained(path, device_map="auto", torch_dtype=dtype, trust_remote_code=True)
13
+ self.model.generation_config = GenerationConfig.from_pretrained(path)
14
+ self.tokenizer = AutoTokenizer.from_pretrained(path, use_fast=False, trust_remote_code=True)
15
 
16
  def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
17
  inputs = data.pop("inputs", data)