mikeee commited on
Commit
7e27981
1 Parent(s): b54c00e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -5,6 +5,7 @@ import os
5
  import time
6
  from dataclasses import asdict, dataclass
7
  from pathlib import Path
 
8
  from types import SimpleNamespace
9
 
10
  import gradio as gr
@@ -229,7 +230,7 @@ def generate(
229
  **asdict(generation_config),
230
  )
231
 
232
-
233
  _ = """full url: https://huggingface.co/TheBloke/mpt-30B-chat-GGML/blob/main/mpt-30b-chat.ggmlv0.q4_1.bin"""
234
 
235
  # https://huggingface.co/TheBloke/mpt-30B-chat-GGML
@@ -247,15 +248,13 @@ MODEL_FILENAME = "WizardCoder-15B-1.0.ggmlv3.q4_1.bin" # 11.9G
247
 
248
  # https://huggingface.co/TheBloke/WizardLM-13B-V1.0-Uncensored-GGML
249
  MODEL_FILENAME = "wizardlm-13b-v1.0-uncensored.ggmlv3.q4_1.bin" # 8.4G
 
250
 
251
- DESTINATION_FOLDER = "models"
252
-
253
- REPO_ID = "TheBloke/mpt-30B-chat-GGML"
254
- if "WizardCoder" in MODEL_FILENAME:
255
- REPO_ID = "TheBloke/WizardCoder-15B-1.0-GGML"
256
 
257
- if "uncensored" in MODEL_FILENAME.lower():
258
- REPO_ID = "TheBloke/WizardLM-13B-V1.0-Uncensored-GGML"
259
 
260
  logger.info(f"start dl, {REPO_ID=}, {MODEL_FILENAME=}, {DESTINATION_FOLDER=}")
261
  download_quant(DESTINATION_FOLDER, REPO_ID, MODEL_FILENAME)
@@ -365,7 +364,7 @@ with gr.Blocks(
365
  # """<center><a href="https://huggingface.co/spaces/mikeee/mpt-30b-chat?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate"></a> and spin a CPU UPGRADE to avoid the queue</center>"""
366
  # )
367
  gr.Markdown(
368
- f"""<h4><center>{MODEL_FILENAME}</center></h4>
369
  It takes about 100 seconds for the initial reply
370
  message to appear. Average streaming rate ~1 sec/chat. The bot only speaks English.
371
 
 
5
  import time
6
  from dataclasses import asdict, dataclass
7
  from pathlib import Path
8
+ from urllib.parse import urlparse
9
  from types import SimpleNamespace
10
 
11
  import gradio as gr
 
230
  **asdict(generation_config),
231
  )
232
 
233
+ _ = '''
234
  _ = """full url: https://huggingface.co/TheBloke/mpt-30B-chat-GGML/blob/main/mpt-30b-chat.ggmlv0.q4_1.bin"""
235
 
236
  # https://huggingface.co/TheBloke/mpt-30B-chat-GGML
 
248
 
249
  # https://huggingface.co/TheBloke/WizardLM-13B-V1.0-Uncensored-GGML
250
  MODEL_FILENAME = "wizardlm-13b-v1.0-uncensored.ggmlv3.q4_1.bin" # 8.4G
251
+ # '''
252
 
253
+ URL = "https://huggingface.co/TheBloke/Wizard-Vicuna-7B-Uncensored-GGML/raw/main/Wizard-Vicuna-7B-Uncensored.ggmlv3.q4_K_M.bin"
254
+ MODEL_FILENAME = Path(URL).name
255
+ REPO_ID = "/".join(urlparse(url).path.strip('/').split('/')[:2]) # TheBloke/Wizard-Vicuna-7B-Uncensored-GGML
 
 
256
 
257
+ DESTINATION_FOLDER = "models"
 
258
 
259
  logger.info(f"start dl, {REPO_ID=}, {MODEL_FILENAME=}, {DESTINATION_FOLDER=}")
260
  download_quant(DESTINATION_FOLDER, REPO_ID, MODEL_FILENAME)
 
364
  # """<center><a href="https://huggingface.co/spaces/mikeee/mpt-30b-chat?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate"></a> and spin a CPU UPGRADE to avoid the queue</center>"""
365
  # )
366
  gr.Markdown(
367
+ f"""<h4><center>{REPO_ID} {MODEL_FILENAME}</center></h4>
368
  It takes about 100 seconds for the initial reply
369
  message to appear. Average streaming rate ~1 sec/chat. The bot only speaks English.
370