Spaces:
Paused
Paused
CreitinGameplays
commited on
Commit
•
9cb4a5a
1
Parent(s):
059fce6
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,7 @@ from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStream
|
|
9 |
|
10 |
MAX_MAX_NEW_TOKENS = 4096
|
11 |
DEFAULT_MAX_NEW_TOKENS = 1024
|
12 |
-
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "
|
13 |
|
14 |
DESCRIPTION = """\
|
15 |
# ConvAI 9b v2 Chat
|
@@ -50,7 +50,7 @@ def generate(
|
|
50 |
gr.Warning(f"Trimmed input from conversation as it was longer than {MAX_INPUT_TOKEN_LENGTH} tokens.")
|
51 |
input_ids = input_ids.to(model.device)
|
52 |
|
53 |
-
streamer = TextIteratorStreamer(tokenizer, timeout=
|
54 |
generate_kwargs = dict(
|
55 |
{"input_ids": input_ids},
|
56 |
streamer=streamer,
|
|
|
9 |
|
10 |
MAX_MAX_NEW_TOKENS = 4096
|
11 |
DEFAULT_MAX_NEW_TOKENS = 1024
|
12 |
+
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
13 |
|
14 |
DESCRIPTION = """\
|
15 |
# ConvAI 9b v2 Chat
|
|
|
50 |
gr.Warning(f"Trimmed input from conversation as it was longer than {MAX_INPUT_TOKEN_LENGTH} tokens.")
|
51 |
input_ids = input_ids.to(model.device)
|
52 |
|
53 |
+
streamer = TextIteratorStreamer(tokenizer, timeout=1.0, skip_prompt=True, skip_special_tokens=True)
|
54 |
generate_kwargs = dict(
|
55 |
{"input_ids": input_ids},
|
56 |
streamer=streamer,
|