Ashishkr commited on
Commit
3f6c140
1 Parent(s): ed744f1

Update model.py

Browse files
Files changed (1) hide show
  1. model.py +9 -3
model.py CHANGED
@@ -81,7 +81,7 @@ def get_input_token_length(message: str, chat_history: list[tuple[str, str]], sy
81
  def run(message: str,
82
  chat_history: list[tuple[str, str]],
83
  system_prompt: str,
84
- max_new_tokens: int = 256,
85
  temperature: float = 0.8,
86
  top_p: float = 0.95,
87
  top_k: int = 50) -> Iterator[str]:
@@ -107,5 +107,11 @@ def run(message: str,
107
 
108
  outputs = []
109
  for text in streamer:
110
- outputs.append(text)
111
- yield ''.join(outputs)
 
 
 
 
 
 
 
81
  def run(message: str,
82
  chat_history: list[tuple[str, str]],
83
  system_prompt: str,
84
+ max_new_tokens: int = 1024,
85
  temperature: float = 0.8,
86
  top_p: float = 0.95,
87
  top_k: int = 50) -> Iterator[str]:
 
107
 
108
  outputs = []
109
  for text in streamer:
110
+ if "instruction:" in text:
111
+ # Append only the part of text before "instruction:" and stop streaming
112
+ outputs.append(text.split("instruction:")[0])
113
+ break
114
+ else:
115
+ outputs.append(text)
116
+
117
+ yield ''.join(outputs)