Spaces:
Paused
Paused
testing
Browse files
app.py
CHANGED
@@ -50,25 +50,20 @@ def generate(
|
|
50 |
input_ids = input_ids[-MAX_INPUT_TOKEN_LENGTH:]
|
51 |
gr.Warning("Trimmed input from conversation as it was longer than {MAX_INPUT_TOKEN_LENGTH} tokens.")
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
outputs = []
|
69 |
-
for text in streamer:
|
70 |
-
outputs.append(text)
|
71 |
-
yield "".join(outputs)
|
72 |
|
73 |
|
74 |
chat_interface = gr.ChatInterface(
|
|
|
50 |
input_ids = input_ids[-MAX_INPUT_TOKEN_LENGTH:]
|
51 |
gr.Warning("Trimmed input from conversation as it was longer than {MAX_INPUT_TOKEN_LENGTH} tokens.")
|
52 |
|
53 |
+
input_ids = tokenizer(current_input, return_tensors="pt").to("cuda")
|
54 |
+
|
55 |
+
# Generate
|
56 |
+
output_ids = model.generate(input_ids=input_ids,
|
57 |
+
max_new_tokens=max_new_tokens,
|
58 |
+
do_sample=True,
|
59 |
+
top_p=top_p,
|
60 |
+
top_k=top_k,
|
61 |
+
temperature=temperature,
|
62 |
+
repetition_penalty=repetition_penalty)
|
63 |
+
|
64 |
+
# Stream output
|
65 |
+
for id in output_ids.tolist()[0]:
|
66 |
+
yield tokenizer.decode(id)
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
|
69 |
chat_interface = gr.ChatInterface(
|