Spaces:
Running
Running
Commit
•
ced1ef0
1
Parent(s):
ad6275a
🔧 Always strip <|endoftext|> (#171)
Browse files
src/lib/components/chat/ChatMessage.svelte
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
.replaceAll("<", "<")
|
22 |
.trim();
|
23 |
|
24 |
-
for (const stop of model.parameters.stop ?? []) {
|
25 |
if (ret.endsWith(stop)) {
|
26 |
ret = ret.slice(0, -stop.length).trim();
|
27 |
}
|
|
|
21 |
.replaceAll("<", "<")
|
22 |
.trim();
|
23 |
|
24 |
+
for (const stop of [...(model.parameters.stop ?? []), "<|endoftext|>"]) {
|
25 |
if (ret.endsWith(stop)) {
|
26 |
ret = ret.slice(0, -stop.length).trim();
|
27 |
}
|
src/routes/conversation/[id]/+server.ts
CHANGED
@@ -112,7 +112,7 @@ export async function POST({ request, fetch, locals, params }) {
|
|
112 |
PUBLIC_SEP_TOKEN
|
113 |
).trim();
|
114 |
|
115 |
-
for (const stop of modelInfo?.parameters?.stop ?? []) {
|
116 |
if (generated_text.endsWith(stop)) {
|
117 |
generated_text = generated_text.slice(0, -stop.length).trim();
|
118 |
}
|
|
|
112 |
PUBLIC_SEP_TOKEN
|
113 |
).trim();
|
114 |
|
115 |
+
for (const stop of [...(modelInfo?.parameters?.stop ?? []), "<|endoftext|>"]) {
|
116 |
if (generated_text.endsWith(stop)) {
|
117 |
generated_text = generated_text.slice(0, -stop.length).trim();
|
118 |
}
|