OMGJ commited on
Commit
4a37b60
1 Parent(s): 9d98413

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -5,7 +5,7 @@ from threading import Thread
5
 
6
  tokenizer = AutoTokenizer.from_pretrained("togethercomputer/RedPajama-INCITE-Chat-3B-v1")
7
  model = AutoModelForCausalLM.from_pretrained("togethercomputer/RedPajama-INCITE-Chat-3B-v1", torch_dtype=torch.float16)
8
- model = model.to('cuda:0')
9
 
10
  class StopOnTokens(StoppingCriteria):
11
  def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor, **kwargs) -> bool:
@@ -23,7 +23,7 @@ def predict(message, history):
23
  messages = "".join(["".join(["\n<human>:"+item[0], "\n<bot>:"+item[1]]) #curr_system_message +
24
  for item in history_transformer_format])
25
 
26
- model_inputs = tokenizer([messages], return_tensors="pt").to("cuda")
27
  streamer = TextIteratorStreamer(tokenizer, timeout=10., skip_prompt=True, skip_special_tokens=True)
28
  generate_kwargs = dict(
29
  model_inputs,
 
5
 
6
  tokenizer = AutoTokenizer.from_pretrained("togethercomputer/RedPajama-INCITE-Chat-3B-v1")
7
  model = AutoModelForCausalLM.from_pretrained("togethercomputer/RedPajama-INCITE-Chat-3B-v1", torch_dtype=torch.float16)
8
+ #model = model.to('cuda:0')
9
 
10
  class StopOnTokens(StoppingCriteria):
11
  def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor, **kwargs) -> bool:
 
23
  messages = "".join(["".join(["\n<human>:"+item[0], "\n<bot>:"+item[1]]) #curr_system_message +
24
  for item in history_transformer_format])
25
 
26
+ model_inputs = tokenizer([messages], return_tensors="pt")
27
  streamer = TextIteratorStreamer(tokenizer, timeout=10., skip_prompt=True, skip_special_tokens=True)
28
  generate_kwargs = dict(
29
  model_inputs,