Melissa Roemmele commited on
Commit
f948afb
·
1 Parent(s): cd1659c

Updated handler.py

Browse files
Files changed (1) hide show
  1. handler.py +3 -3
handler.py CHANGED
@@ -7,11 +7,11 @@ class EndpointHandler:
7
  def __init__(self, path=""):
8
  # load model and tokenizer from path
9
  self.tokenizer = AutoTokenizer.from_pretrained(path)
 
10
  self.model = AutoModelForCausalLM.from_pretrained(path,
11
- device_map="auto",
12
  torch_dtype=torch.float16,
13
- trust_remote_code=True)
14
- self.device = "cuda" if torch.cuda.is_available() else "cpu"
15
 
16
  def __call__(self, data: Dict[str, Any]) -> Dict[str, str]:
17
  # process input
 
7
  def __init__(self, path=""):
8
  # load model and tokenizer from path
9
  self.tokenizer = AutoTokenizer.from_pretrained(path)
10
+ self.device = "cuda" if torch.cuda.is_available() else "cpu"
11
  self.model = AutoModelForCausalLM.from_pretrained(path,
12
+ # device_map="auto",
13
  torch_dtype=torch.float16,
14
+ trust_remote_code=True).to(self.device)
 
15
 
16
  def __call__(self, data: Dict[str, Any]) -> Dict[str, str]:
17
  # process input