Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,7 @@ from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStream
|
|
9 |
|
10 |
MAX_MAX_NEW_TOKENS = 2048
|
11 |
DEFAULT_MAX_NEW_TOKENS = 1024
|
|
|
12 |
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
13 |
|
14 |
DESCRIPTION = """\
|
@@ -39,6 +40,11 @@ def generate(
|
|
39 |
top_k: int = 50,
|
40 |
repetition_penalty: float = 1.2,
|
41 |
) -> Iterator[str]:
|
|
|
|
|
|
|
|
|
|
|
42 |
conversation = []
|
43 |
if system_prompt:
|
44 |
conversation.append({"role": "system", "content": system_prompt})
|
@@ -71,7 +77,7 @@ def generate(
|
|
71 |
outputs = []
|
72 |
for text in streamer:
|
73 |
outputs.append(text)
|
74 |
-
yield "".join(outputs)
|
75 |
|
76 |
|
77 |
chat_interface = gr.ChatInterface(
|
|
|
9 |
|
10 |
MAX_MAX_NEW_TOKENS = 2048
|
11 |
DEFAULT_MAX_NEW_TOKENS = 1024
|
12 |
+
total_count=0
|
13 |
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
14 |
|
15 |
DESCRIPTION = """\
|
|
|
40 |
top_k: int = 50,
|
41 |
repetition_penalty: float = 1.2,
|
42 |
) -> Iterator[str]:
|
43 |
+
global total_count
|
44 |
+
total_count += 1
|
45 |
+
print(total_count)
|
46 |
+
if total_count % 50 == 0 :
|
47 |
+
os.system("nvidia-smi")
|
48 |
conversation = []
|
49 |
if system_prompt:
|
50 |
conversation.append({"role": "system", "content": system_prompt})
|
|
|
77 |
outputs = []
|
78 |
for text in streamer:
|
79 |
outputs.append(text)
|
80 |
+
yield "".join(outputs).replace("<|EOT|>","")
|
81 |
|
82 |
|
83 |
chat_interface = gr.ChatInterface(
|