We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e636214 commit dabd89dCopy full SHA for dabd89d
llama_cpp/llama.py
@@ -360,14 +360,24 @@ def _create_completion(
360
break
361
text = all_text[: len(all_text) - longest]
362
returned_characters += len(text[start:])
363
+ _text = ''
364
+ try:
365
+ _text = text[start:].decode("utf-8")
366
+ except UnicodeDecodeError:
367
+ for i in range(1,4):
368
369
+ _text = text[start:-i].decode("utf-8")
370
+ break
371
372
+ continue
373
yield {
374
"id": completion_id,
375
"object": "text_completion",
376
"created": created,
377
"model": self.model_path,
378
"choices": [
379
{
- "text": text[start:].decode("utf-8"),
380
+ "text": _text,
381
"index": 0,
382
"logprobs": None,
383
"finish_reason": None,
0 commit comments