Spaces:
Runtime error
Runtime error
ffreemt
commited on
Commit
·
de341fb
1
Parent(s):
5b7cce7
Update prelude
Browse files
app.py
CHANGED
|
@@ -219,6 +219,7 @@ def bot(history):
|
|
| 219 |
with about_time() as atime: # type: ignore
|
| 220 |
flag = 1
|
| 221 |
prefix = ""
|
|
|
|
| 222 |
then = time.time()
|
| 223 |
|
| 224 |
logger.debug("about to generate")
|
|
@@ -227,7 +228,8 @@ def bot(history):
|
|
| 227 |
for elm in generate(user_message, config=config):
|
| 228 |
if flag == 1:
|
| 229 |
logger.debug("in the loop")
|
| 230 |
-
|
|
|
|
| 231 |
flag = 0
|
| 232 |
print(prefix, end="", flush=True)
|
| 233 |
logger.debug(f"{prefix=}")
|
|
@@ -240,7 +242,8 @@ def bot(history):
|
|
| 240 |
|
| 241 |
_ = (
|
| 242 |
f"(time elapsed: {atime.duration_human}, " # type: ignore
|
| 243 |
-
f"{
|
|
|
|
| 244 |
)
|
| 245 |
|
| 246 |
history[-1][1] = "".join(response) + f"\n{_}"
|
|
|
|
| 219 |
with about_time() as atime: # type: ignore
|
| 220 |
flag = 1
|
| 221 |
prefix = ""
|
| 222 |
+
prelude = 0.0
|
| 223 |
then = time.time()
|
| 224 |
|
| 225 |
logger.debug("about to generate")
|
|
|
|
| 228 |
for elm in generate(user_message, config=config):
|
| 229 |
if flag == 1:
|
| 230 |
logger.debug("in the loop")
|
| 231 |
+
prelude = time.time() - then
|
| 232 |
+
prefix = f"({prelude:.2f}s) "
|
| 233 |
flag = 0
|
| 234 |
print(prefix, end="", flush=True)
|
| 235 |
logger.debug(f"{prefix=}")
|
|
|
|
| 242 |
|
| 243 |
_ = (
|
| 244 |
f"(time elapsed: {atime.duration_human}, " # type: ignore
|
| 245 |
+
f"{prelude/len(user_message):.2f}s/char"
|
| 246 |
+
f"{(atime.duration - prelude)/len(''.join(response)):.2f}s/char)" # type: ignore
|
| 247 |
)
|
| 248 |
|
| 249 |
history[-1][1] = "".join(response) + f"\n{_}"
|