rlanner-echocap commited on
Commit
e6bbd2f
·
1 Parent(s): 742a64f

Update handler.py

Browse files

Removing bfloat16 until we have access to suitable GPU

Files changed (1) hide show
  1. handler.py +3 -2
handler.py CHANGED
@@ -4,14 +4,15 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
4
  # testing changes
5
 
6
  # get dtype
7
- dtype = torch.bfloat16 if torch.cuda.get_device_capability()[0] == 8 else torch.float16
8
 
9
 
10
  class EndpointHandler:
11
  def __init__(self, path=""):
12
  # load the model
13
  tokenizer = AutoTokenizer.from_pretrained(path)
14
- model = AutoModelForCausalLM.from_pretrained(path, device_map="auto", torch_dtype=dtype, trust_remote_code=True)
 
15
  # create inference pipeline
16
  self.pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer, device='cuda:0')
17
 
 
4
  # testing changes
5
 
6
  # get dtype
7
+ # dtype = torch.bfloat16 if torch.cuda.get_device_capability()[0] == 8 else torch.float16
8
 
9
 
10
  class EndpointHandler:
11
  def __init__(self, path=""):
12
  # load the model
13
  tokenizer = AutoTokenizer.from_pretrained(path)
14
+ # model = AutoModelForCausalLM.from_pretrained(path, device_map="auto", torch_dtype=dtype, trust_remote_code=True)
15
+ model = AutoModelForCausalLM.from_pretrained(path, device_map="auto", trust_remote_code=True)
16
  # create inference pipeline
17
  self.pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer, device='cuda:0')
18