aixsatoshi
commited on
Commit
•
33e87c8
1
Parent(s):
16e5a54
Update app.py
Browse files
app.py
CHANGED
@@ -56,7 +56,7 @@ def stream_chat(message: str, history: list, temperature: float, max_new_tokens:
|
|
56 |
conversation.extend([{"role": "user", "content": prompt}, {"role": "assistant", "content": answer}])
|
57 |
conversation.append({"role": "user", "content": message})
|
58 |
|
59 |
-
print(f"Conversation is -\n{conversation}")
|
60 |
|
61 |
input_ids = tokenizer.apply_chat_template(conversation, tokenize=False, add_generation_prompt=True)
|
62 |
inputs = tokenizer(input_ids, return_tensors="pt").to(0)
|
@@ -72,7 +72,7 @@ def stream_chat(message: str, history: list, temperature: float, max_new_tokens:
|
|
72 |
max_new_tokens=max_new_tokens,
|
73 |
do_sample=True,
|
74 |
temperature=temperature,
|
75 |
-
eos_token_id = [151645, 151643],
|
76 |
)
|
77 |
|
78 |
thread = Thread(target=model.generate, kwargs=generate_kwargs)
|
@@ -109,7 +109,7 @@ with gr.Blocks(css=CSS) as demo:
|
|
109 |
minimum=128,
|
110 |
maximum=4096,
|
111 |
step=1,
|
112 |
-
value=
|
113 |
label="Max new tokens",
|
114 |
render=False,
|
115 |
),
|
|
|
56 |
conversation.extend([{"role": "user", "content": prompt}, {"role": "assistant", "content": answer}])
|
57 |
conversation.append({"role": "user", "content": message})
|
58 |
|
59 |
+
#print(f"Conversation is -\n{conversation}")
|
60 |
|
61 |
input_ids = tokenizer.apply_chat_template(conversation, tokenize=False, add_generation_prompt=True)
|
62 |
inputs = tokenizer(input_ids, return_tensors="pt").to(0)
|
|
|
72 |
max_new_tokens=max_new_tokens,
|
73 |
do_sample=True,
|
74 |
temperature=temperature,
|
75 |
+
#eos_token_id = [151645, 151643],
|
76 |
)
|
77 |
|
78 |
thread = Thread(target=model.generate, kwargs=generate_kwargs)
|
|
|
109 |
minimum=128,
|
110 |
maximum=4096,
|
111 |
step=1,
|
112 |
+
value=256,
|
113 |
label="Max new tokens",
|
114 |
render=False,
|
115 |
),
|