Skip to content

Commit

Permalink
Fixes decoding in other languages such as chinese (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maknee authored Jul 24, 2023
1 parent acc15e6 commit 117347a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions minigpt4/minigpt4_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def minigpt4_end_chat_image(self, ctx: MiniGPT4Context, n_threads: int = 0, temp

token = CHAR_PTR()
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))
return ctypes.cast(token, ctypes.c_char_p).value.decode('utf-8')
return ctypes.cast(token, ctypes.c_char_p).value.decode()

def minigpt4_system_prompt(self, ctx: MiniGPT4Context, n_threads: int = 0):
"""
Expand Down Expand Up @@ -417,7 +417,7 @@ def minigpt4_end_chat(self, ctx: MiniGPT4Context, n_threads: int = 0, temp: floa

token = CHAR_PTR()
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))
return ctypes.cast(token, ctypes.c_char_p).value.decode('utf-8')
return ctypes.cast(token, ctypes.c_char_p).value.decode()

def minigpt4_reset_chat(self, ctx: MiniGPT4Context):
"""
Expand Down Expand Up @@ -498,7 +498,7 @@ def minigpt4_error_code_to_string(self, error_code: int) -> str:
str: Error string.
"""

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

def minigpt4_quantize_model(self, in_path: str, out_path: str, data_type: DataType):
"""
Expand Down

0 comments on commit 117347a

Please sign in to comment.