Spaces:
Sleeping
Sleeping
Samuel L Meyers
commited on
Commit
·
ac11446
1
Parent(s):
b9c2ca8
Fix string tokens, comment cruft
Browse files- code/app.py +6 -6
code/app.py
CHANGED
@@ -61,11 +61,11 @@ def talk(txt, jsn):
|
|
61 |
if not jsn:
|
62 |
jsn = txt
|
63 |
if not running:
|
64 |
-
if len(txt) >= 3 and txt[-1]["content"].endswith("</s>"):
|
65 |
-
|
66 |
-
|
67 |
-
txt = printfmt(stowtext(otxt, txt))
|
68 |
-
otxt = txt
|
69 |
result = lcpp_model.create_chat_completion(messages=txt,stream=True,stop=["[INST]", "<<SYS>>"])
|
70 |
running = True
|
71 |
for r in result:
|
@@ -74,7 +74,7 @@ def talk(txt, jsn):
|
|
74 |
txt2 = r["choices"][0]["delta"]["content"]
|
75 |
elif not "content" in r["choices"][0]["delta"] and not "role" in r["choices"][0]["delta"]:
|
76 |
running = False
|
77 |
-
txt = stowchunk(txt, "</s>")
|
78 |
yield txt
|
79 |
if txt2 is not None:
|
80 |
txt = stowchunk(txt, txt2)
|
|
|
61 |
if not jsn:
|
62 |
jsn = txt
|
63 |
if not running:
|
64 |
+
#if len(txt) >= 3 and txt[-1]["content"].endswith("</s>"):
|
65 |
+
# txt[-1]["content"].replace("</s>", "")
|
66 |
+
# return txt
|
67 |
+
#txt = printfmt(stowtext(otxt, txt))
|
68 |
+
#otxt = txt
|
69 |
result = lcpp_model.create_chat_completion(messages=txt,stream=True,stop=["[INST]", "<<SYS>>"])
|
70 |
running = True
|
71 |
for r in result:
|
|
|
74 |
txt2 = r["choices"][0]["delta"]["content"]
|
75 |
elif not "content" in r["choices"][0]["delta"] and not "role" in r["choices"][0]["delta"]:
|
76 |
running = False
|
77 |
+
#txt = stowchunk(txt, "</s>")
|
78 |
yield txt
|
79 |
if txt2 is not None:
|
80 |
txt = stowchunk(txt, txt2)
|