Spaces:
Runtime error
Runtime error
ffreemt
commited on
Commit
·
53313ac
1
Parent(s):
12d076e
Update concurrency_count
Browse files
app.py
CHANGED
|
@@ -221,7 +221,6 @@ def predict(prompt, bot):
|
|
| 221 |
print("--", end=" ", flush=True)
|
| 222 |
|
| 223 |
response = ""
|
| 224 |
-
buff.update(value="diggin...")
|
| 225 |
|
| 226 |
flag = 1
|
| 227 |
for word in generator:
|
|
@@ -275,12 +274,10 @@ def predict_api(prompt):
|
|
| 275 |
)
|
| 276 |
|
| 277 |
response = ""
|
| 278 |
-
buff.update(value="diggin...")
|
| 279 |
for word in generator:
|
| 280 |
print(word, end="", flush=True)
|
| 281 |
response += word
|
| 282 |
ns.response = response
|
| 283 |
-
buff.update(value=response)
|
| 284 |
print("")
|
| 285 |
logger.debug(f"{response=}")
|
| 286 |
except Exception as exc:
|
|
@@ -372,7 +369,9 @@ with gr.Blocks(
|
|
| 372 |
label="Chat Message Box",
|
| 373 |
placeholder="Ask me anything (press Enter or click Submit to send)",
|
| 374 |
show_label=False,
|
| 375 |
-
|
|
|
|
|
|
|
| 376 |
with gr.Column(scale=1, min_width=50):
|
| 377 |
with gr.Row():
|
| 378 |
submit = gr.Button("Submit", elem_classes="xsmall")
|
|
@@ -381,11 +380,12 @@ with gr.Blocks(
|
|
| 381 |
with gr.Row(visible=False):
|
| 382 |
with gr.Accordion("Advanced Options:", open=False):
|
| 383 |
with gr.Row():
|
| 384 |
-
with gr.Column(scale=2
|
| 385 |
system = gr.Textbox(
|
| 386 |
label="System Prompt",
|
| 387 |
value=prompt_template,
|
| 388 |
show_label=False,
|
|
|
|
| 389 |
# ).style(container=False)
|
| 390 |
)
|
| 391 |
with gr.Column():
|
|
@@ -475,8 +475,14 @@ with gr.Blocks(
|
|
| 475 |
# CPU cpu_count=2 16G, model 7G
|
| 476 |
# CPU UPGRADE cpu_count=8 32G, model 7G
|
| 477 |
|
| 478 |
-
|
| 479 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 480 |
logger.info(f"{concurrency_count=}")
|
| 481 |
|
| 482 |
block.queue(concurrency_count=concurrency_count, max_size=5).launch(debug=True)
|
|
|
|
| 221 |
print("--", end=" ", flush=True)
|
| 222 |
|
| 223 |
response = ""
|
|
|
|
| 224 |
|
| 225 |
flag = 1
|
| 226 |
for word in generator:
|
|
|
|
| 274 |
)
|
| 275 |
|
| 276 |
response = ""
|
|
|
|
| 277 |
for word in generator:
|
| 278 |
print(word, end="", flush=True)
|
| 279 |
response += word
|
| 280 |
ns.response = response
|
|
|
|
| 281 |
print("")
|
| 282 |
logger.debug(f"{response=}")
|
| 283 |
except Exception as exc:
|
|
|
|
| 369 |
label="Chat Message Box",
|
| 370 |
placeholder="Ask me anything (press Enter or click Submit to send)",
|
| 371 |
show_label=False,
|
| 372 |
+
container=False,
|
| 373 |
+
# ).style(container=False)
|
| 374 |
+
)
|
| 375 |
with gr.Column(scale=1, min_width=50):
|
| 376 |
with gr.Row():
|
| 377 |
submit = gr.Button("Submit", elem_classes="xsmall")
|
|
|
|
| 380 |
with gr.Row(visible=False):
|
| 381 |
with gr.Accordion("Advanced Options:", open=False):
|
| 382 |
with gr.Row():
|
| 383 |
+
with gr.Column(scale=2):
|
| 384 |
system = gr.Textbox(
|
| 385 |
label="System Prompt",
|
| 386 |
value=prompt_template,
|
| 387 |
show_label=False,
|
| 388 |
+
container=False,
|
| 389 |
# ).style(container=False)
|
| 390 |
)
|
| 391 |
with gr.Column():
|
|
|
|
| 475 |
# CPU cpu_count=2 16G, model 7G
|
| 476 |
# CPU UPGRADE cpu_count=8 32G, model 7G
|
| 477 |
|
| 478 |
+
# does not work
|
| 479 |
+
# _ = int(psutil.virtual_memory().total / 10**9 // file_size - 1)
|
| 480 |
+
# concurrency_count = max(_, 1)
|
| 481 |
+
|
| 482 |
+
if psutil.cpu_count(logical=False) > 8:
|
| 483 |
+
concurrency_count = max(int(32 / file_size) - 1, 1)
|
| 484 |
+
else:
|
| 485 |
+
concurrency_count = max(int(16 / file_size) - 1, 1)
|
| 486 |
logger.info(f"{concurrency_count=}")
|
| 487 |
|
| 488 |
block.queue(concurrency_count=concurrency_count, max_size=5).launch(debug=True)
|