Update app.py
Browse files
app.py
CHANGED
@@ -7,14 +7,15 @@ tokenizer = AutoTokenizer.from_pretrained("Sigurdur/icechat")
|
|
7 |
|
8 |
|
9 |
def streaming_respond(question, history):
|
10 |
-
input_ids = tokenizer.encode("### Question
|
11 |
streamer = TextIteratorStreamer(
|
12 |
tokenizer, timeout=10.0, skip_prompt=True, skip_special_tokens=True
|
13 |
)
|
14 |
generate_kwargs = dict(
|
15 |
{"input_ids": input_ids},
|
16 |
streamer=streamer,
|
17 |
-
max_new_tokens=
|
|
|
18 |
num_beams=1,
|
19 |
)
|
20 |
t = Thread(target=model.generate, kwargs=generate_kwargs)
|
|
|
7 |
|
8 |
|
9 |
def streaming_respond(question, history):
|
10 |
+
input_ids = tokenizer.encode(f"### Question:\n{question}\n\n### Answer:\n", return_tensors="pt")
|
11 |
streamer = TextIteratorStreamer(
|
12 |
tokenizer, timeout=10.0, skip_prompt=True, skip_special_tokens=True
|
13 |
)
|
14 |
generate_kwargs = dict(
|
15 |
{"input_ids": input_ids},
|
16 |
streamer=streamer,
|
17 |
+
max_new_tokens=100,
|
18 |
+
temperature=0.7,
|
19 |
num_beams=1,
|
20 |
)
|
21 |
t = Thread(target=model.generate, kwargs=generate_kwargs)
|