From 8579fe51dd09651ce7168d2191f9d741540881a5 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Tue, 28 Mar 2023 12:59:34 -0300 Subject: [PATCH 1/5] Fix new lines in the HTML tab --- modules/html_generator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/html_generator.py b/modules/html_generator.py index ff18c913..48d2e02e 100644 --- a/modules/html_generator.py +++ b/modules/html_generator.py @@ -34,7 +34,7 @@ def convert_to_markdown(string): string = string.replace('\\begin{blockquote}', '> ') string = string.replace('\\end{blockquote}', '') string = re.sub(r"(.)```", r"\1\n```", string) -# string = fix_newlines(string) + string = fix_newlines(string) return markdown.markdown(string, extensions=['fenced_code']) def generate_basic_html(string): From 91aa5b460ed1f330e35b02fd7f5368912ea6526c Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Tue, 28 Mar 2023 13:08:38 -0300 Subject: [PATCH 2/5] If both .pt and .safetensors are present, download only safetensors --- download-model.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/download-model.py b/download-model.py index 25386e5f..dce7e749 100644 --- a/download-model.py +++ b/download-model.py @@ -100,6 +100,7 @@ def get_download_links_from_huggingface(model, branch): links = [] classifications = [] has_pytorch = False + has_pt = False has_safetensors = False is_lora = False while True: @@ -115,7 +116,7 @@ def get_download_links_from_huggingface(model, branch): is_lora = True is_pytorch = re.match("(pytorch|adapter)_model.*\.bin", fname) - is_safetensors = re.match("model.*\.safetensors", fname) + is_safetensors = re.match(".*\.safetensors", fname) is_pt = re.match(".*\.pt", fname) is_tokenizer = re.match("tokenizer.*\.model", fname) is_text = re.match(".*\.(txt|json|py|md)", fname) or is_tokenizer @@ -134,6 +135,7 @@ def get_download_links_from_huggingface(model, branch): has_pytorch = True classifications.append('pytorch') elif is_pt: + has_pt = True classifications.append('pt') cursor = base64.b64encode(f'{{"file_name":"{dict[-1]["path"]}"}}'.encode()) + b':50' @@ -141,9 +143,9 @@ def get_download_links_from_huggingface(model, branch): cursor = cursor.replace(b'=', b'%3D') # If both pytorch and safetensors are available, download safetensors only - if has_pytorch and has_safetensors: + if (has_pytorch or has_pt) and has_safetensors: for i in range(len(classifications)-1, -1, -1): - if classifications[i] == 'pytorch': + if classifications[i] in ['pytorch', 'pt']: links.pop(i) return links, is_lora From 88ad86249d59b2984a99c7366e89728e8a6cc19e Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Tue, 28 Mar 2023 13:19:52 -0300 Subject: [PATCH 3/5] Remove unnecessary file --- training/formats/put-trainer-formats-here.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 training/formats/put-trainer-formats-here.txt diff --git a/training/formats/put-trainer-formats-here.txt b/training/formats/put-trainer-formats-here.txt deleted file mode 100644 index e69de29b..00000000 From cac577d99f3ebf864ec8d4701211ec94cf32c4fa Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Tue, 28 Mar 2023 13:25:58 -0300 Subject: [PATCH 4/5] Fix interface reloading --- server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.py b/server.py index 4d9ee5e8..6023451b 100644 --- a/server.py +++ b/server.py @@ -494,7 +494,7 @@ def create_interface(): shared.gradio['reset_interface'] = gr.Button("Apply and restart the interface", type="primary") shared.gradio['reset_interface'].click(set_interface_arguments, [shared.gradio[k] for k in ['interface_modes_menu', 'extensions_menu', 'cmd_arguments_menu']], None) - shared.gradio['reset_interface'].click(lambda : None, None, None, _js='() => {document.body.innerHTML=\'