jmercat commited on
Commit
475d026
1 Parent(s): 5313bd0

use autocast

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -63,18 +63,18 @@ def generate(
63
  thread = Thread(target=current_model.generate, kwargs=generate_kwargs)
64
  thread.start()
65
 
66
- # Write the prompt in blue
67
- output = "<span style='color: blue;'>" + prompt + "</span>"
68
- for new_text in streamer:
69
- if isinstance(new_text, torch.Tensor):
70
- new_text = current_tokenizer.decode(new_text)
71
- if streamer.stop_signal in new_text:
72
- output += new_text.split(streamer.stop_signal)[0]
73
- break
74
- output += new_text
75
- yield output
76
-
77
- thread.join()
78
  return output
79
 
80
  additional_inputs=[
 
63
  thread = Thread(target=current_model.generate, kwargs=generate_kwargs)
64
  thread.start()
65
 
66
+ # Write the prompt in blue
67
+ output = "<span style='color: blue;'>" + prompt + "</span>"
68
+ for new_text in streamer:
69
+ if isinstance(new_text, torch.Tensor):
70
+ new_text = current_tokenizer.decode(new_text)
71
+ if streamer.stop_signal in new_text:
72
+ output += new_text.split(streamer.stop_signal)[0]
73
+ break
74
+ output += new_text
75
+ yield output
76
+
77
+ thread.join()
78
  return output
79
 
80
  additional_inputs=[