Skip to content

Commit 117347a

Browse files
authored
Fixes decoding in other languages such as chinese (#6)
1 parent acc15e6 commit 117347a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

minigpt4/minigpt4_library.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def minigpt4_end_chat_image(self, ctx: MiniGPT4Context, n_threads: int = 0, temp
363363

364364
token = CHAR_PTR()
365365
self.panic_if_error(self.library.minigpt4_end_chat_image(ctx.ptr, ctypes.pointer(token), n_threads, temp, top_k, top_p, tfs_z, typical_p, repeat_last_n, repeat_penalty, alpha_presence, alpha_frequency, mirostat, mirostat_tau, mirostat_eta, penalize_nl))
366-
return ctypes.cast(token, ctypes.c_char_p).value.decode('utf-8')
366+
return ctypes.cast(token, ctypes.c_char_p).value.decode()
367367

368368
def minigpt4_system_prompt(self, ctx: MiniGPT4Context, n_threads: int = 0):
369369
"""
@@ -417,7 +417,7 @@ def minigpt4_end_chat(self, ctx: MiniGPT4Context, n_threads: int = 0, temp: floa
417417

418418
token = CHAR_PTR()
419419
self.panic_if_error(self.library.minigpt4_end_chat(ctx.ptr, ctypes.pointer(token), n_threads, temp, top_k, top_p, tfs_z, typical_p, repeat_last_n, repeat_penalty, alpha_presence, alpha_frequency, mirostat, mirostat_tau, mirostat_eta, penalize_nl))
420-
return ctypes.cast(token, ctypes.c_char_p).value.decode('utf-8')
420+
return ctypes.cast(token, ctypes.c_char_p).value.decode()
421421

422422
def minigpt4_reset_chat(self, ctx: MiniGPT4Context):
423423
"""
@@ -498,7 +498,7 @@ def minigpt4_error_code_to_string(self, error_code: int) -> str:
498498
str: Error string.
499499
"""
500500

501-
return self.library.minigpt4_error_code_to_string(error_code).decode('utf-8')
501+
return self.library.minigpt4_error_code_to_string(error_code).decode()
502502

503503
def minigpt4_quantize_model(self, in_path: str, out_path: str, data_type: DataType):
504504
"""

0 commit comments

Comments
 (0)