From 41a8eb4eebf02cd5e7d75786229843748579c0b0 Mon Sep 17 00:00:00 2001 From: "FartyPants (FP HAM)" Date: Mon, 2 Sep 2024 22:00:15 -0400 Subject: [PATCH 1/3] Training pro update script.py (#6359) --- extensions/Training_PRO/script.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/Training_PRO/script.py b/extensions/Training_PRO/script.py index 8f296462..5365154c 100644 --- a/extensions/Training_PRO/script.py +++ b/extensions/Training_PRO/script.py @@ -241,7 +241,7 @@ def ui(): stride_length = gr.Slider(label='Stride', minimum=1, maximum=2048, value=512, step=1, info='Used to make the evaluation faster at the cost of accuracy. 1 = slowest but most accurate. 512 is a common value.') with gr.Column(): - max_length = gr.Slider(label='max_length', minimum=0, maximum=shared.settings['truncation_length_max'], value=0, step=1, info='The context for each evaluation. If set to 0, the maximum context length for the model will be used.') + max_length = gr.Number(label='max_length', precision=0, step=256, value=0, info='The context for each evaluation. If set to 0, the maximum context length for the model will be used.') with gr.Row(): start_current_evaluation = gr.Button("Evaluate loaded model") From 4c74c7a1167defef1f9ea217507990974c8fde3d Mon Sep 17 00:00:00 2001 From: GralchemOz <68577430+GralchemOz@users.noreply.github.com> Date: Tue, 3 Sep 2024 10:00:59 +0800 Subject: [PATCH 2/3] Fix UnicodeDecodeError for BPE-based Models (especially GLM-4) (#6357) --- modules/text_generation.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/text_generation.py b/modules/text_generation.py index 75e5ef36..e7a2b43f 100644 --- a/modules/text_generation.py +++ b/modules/text_generation.py @@ -274,7 +274,12 @@ def get_reply_from_output_ids(output_ids, state=None, starting_from=0): if (hasattr(shared.tokenizer, 'convert_ids_to_tokens') and len(output_ids) > starting_from) and not reply.startswith(' '): first_token = shared.tokenizer.convert_ids_to_tokens(int(output_ids[starting_from])) if isinstance(first_token, (bytes,)): - first_token = first_token.decode('utf8') + #try to decode the bytes to a string + try: + first_token = first_token.decode('utf8') + #if it fails, which means it's not a string in this turn, just ignore it + except UnicodeDecodeError: + first_token = '' if first_token.startswith('▁'): reply = ' ' + reply From 9a150c3368fb61cfd77f3286590625467fdc5413 Mon Sep 17 00:00:00 2001 From: Stefan Merettig Date: Tue, 3 Sep 2024 04:03:15 +0200 Subject: [PATCH 3/3] API: Relax multimodal format, fixes HuggingFace Chat UI (#6353) --- extensions/openai/completions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/openai/completions.py b/extensions/openai/completions.py index 646dee2d..362620fa 100644 --- a/extensions/openai/completions.py +++ b/extensions/openai/completions.py @@ -154,8 +154,9 @@ def convert_history(history): elif item['type'] == 'text' and isinstance(item['text'], str): content = item['text'] - if image_url and content: + if image_url: new_history.append({"image_url": image_url, "role": "user"}) + if content: new_history.append({"content": content, "role": "user"}) else: new_history.append(entry)