richardr1126 commited on
Commit
340d82e
Β·
1 Parent(s): cda468b
Files changed (1) hide show
  1. app-ngrok.py +13 -14
app-ngrok.py CHANGED
@@ -8,6 +8,12 @@ import platform
8
 
9
  print(f"Running on {platform.system()}")
10
 
 
 
 
 
 
 
11
  def format(text):
12
  # Split the text by "|", and get the last element in the list which should be the final query
13
  try:
@@ -87,6 +93,12 @@ with gr.Blocks(theme='gradio/soft') as demo:
87
  run_button = gr.Button("Generate SQL", variant="primary")
88
  run_button.click(fn=generate, inputs=[input_text, db_info, temperature, top_p, top_k, repetition_penalty], outputs=output_box, api_name="txt2sql")
89
 
 
 
 
 
 
 
90
  with gr.Accordion("Examples", open=True):
91
  examples = gr.Examples([
92
  ["What is the average, minimum, and maximum age of all singers from France?", "| stadium : stadium_id , location , name , capacity , highest , lowest , average | singer : singer_id , name , country , song_name , song_release_year , age , is_male | concert : concert_id , concert_name , theme , stadium_id , year | singer_in_concert : concert_id , singer_id | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |"],
@@ -94,21 +106,8 @@ with gr.Blocks(theme='gradio/soft') as demo:
94
  ["What are the number of concerts that occurred in the stadium with the largest capacity ?", "| stadium : stadium_id , location , name , capacity , highest , lowest , average | singer : singer_id , name , country , song_name , song_release_year , age , is_male | concert : concert_id , concert_name , theme , stadium_id , year | singer_in_concert : concert_id , singer_id | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |"],
95
  ["How many male singers performed in concerts in the year 2023?", "| stadium : stadium_id , location , name , capacity , highest , lowest , average | singer : singer_id , name , country , song_name , song_release_year , age , is_male | concert : concert_id , concert_name , theme , stadium_id , year | singer_in_concert : concert_id , singer_id | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |"],
96
  ["List the names of all singers who performed in a concert with the theme 'Rock'", "| stadium : stadium_id , location , name , capacity , highest , lowest , average | singer : singer_id , name , country , song_name , song_release_year , age , is_male | concert : concert_id , concert_name , theme , stadium_id , year | singer_in_concert : concert_id , singer_id | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |"]
97
- ], inputs=[input_text, db_info, temperature, top_p, top_k, repetition_penalty], fn=generate, cache_examples=False if platform.system() == "Windows" or platform.system() == "Darwin" else True, outputs=output_box)
98
 
99
- quantized_model = "richardr1126/spider-skeleton-wizard-coder-ggml"
100
- merged_model = "richardr1126/spider-skeleton-wizard-coder-merged"
101
- initial_model = "WizardLM/WizardCoder-15B-V1.0"
102
- lora_model = "richardr1126/spider-skeleton-wizard-coder-qlora"
103
- dataset = "richardr1126/spider-skeleton-context-instruct"
104
-
105
- footer = gr.HTML(f"""
106
- <p>πŸ› οΈ If you want you can <strong>duplicate this Space</strong>, then change the HF_MODEL_REPO spaces env varaible to use any GGML model.</p>
107
- <p>🌐 Leveraging the <a href='https://huggingface.co/{quantized_model}'><strong>4-bit GGML version</strong></a> of <a href='https://huggingface.co/{merged_model}'><strong>{merged_model}</strong></a> model.</p>
108
- <p>πŸ”— How it's made: <a href='https://huggingface.co/{initial_model}'><strong>{initial_model}</strong></a> was finetuned to create <a href='https://huggingface.co/{lora_model}'><strong>{lora_model}</strong></a>, then merged together to create <a href='https://huggingface.co/{merged_model}'><strong>{merged_model}</strong></a>.</p>
109
- <p>πŸ“‰ Fine-tuning was performed using QLoRA techniques on the <a href='https://huggingface.co/datasets/{dataset}'><strong>{dataset}</strong></a> dataset. You can view training metrics on the <a href='https://huggingface.co/{lora_model}'><strong>QLoRa adapter HF Repo</strong></a>.</p>
110
-
111
- """)
112
 
113
  readme_content = requests.get(f"https://huggingface.co/{merged_model}/raw/main/README.md").text
114
  readme_content = re.sub('---.*?---', '', readme_content, flags=re.DOTALL) #Remove YAML front matter
 
8
 
9
  print(f"Running on {platform.system()}")
10
 
11
+ quantized_model = "richardr1126/spider-skeleton-wizard-coder-ggml"
12
+ merged_model = "richardr1126/spider-skeleton-wizard-coder-merged"
13
+ initial_model = "WizardLM/WizardCoder-15B-V1.0"
14
+ lora_model = "richardr1126/spider-skeleton-wizard-coder-qlora"
15
+ dataset = "richardr1126/spider-skeleton-context-instruct"
16
+
17
  def format(text):
18
  # Split the text by "|", and get the last element in the list which should be the final query
19
  try:
 
93
  run_button = gr.Button("Generate SQL", variant="primary")
94
  run_button.click(fn=generate, inputs=[input_text, db_info, temperature, top_p, top_k, repetition_penalty], outputs=output_box, api_name="txt2sql")
95
 
96
+ info = gr.HTML(f"""
97
+ <p>🌐 Leveraging the <a href='https://huggingface.co/{quantized_model}'><strong>4-bit GGML version</strong></a> of <a href='https://huggingface.co/{merged_model}'><strong>{merged_model}</strong></a> model.</p>
98
+ <p>πŸ”— How it's made: <a href='https://huggingface.co/{initial_model}'><strong>{initial_model}</strong></a> was finetuned to create <a href='https://huggingface.co/{lora_model}'><strong>{lora_model}</strong></a>, then merged together to create <a href='https://huggingface.co/{merged_model}'><strong>{merged_model}</strong></a>.</p>
99
+ <p>πŸ“‰ Fine-tuning was performed using QLoRA techniques on the <a href='https://huggingface.co/datasets/{dataset}'><strong>{dataset}</strong></a> dataset. You can view training metrics on the <a href='https://huggingface.co/{lora_model}'><strong>QLoRa adapter HF Repo</strong></a>.</p>
100
+ """)
101
+
102
  with gr.Accordion("Examples", open=True):
103
  examples = gr.Examples([
104
  ["What is the average, minimum, and maximum age of all singers from France?", "| stadium : stadium_id , location , name , capacity , highest , lowest , average | singer : singer_id , name , country , song_name , song_release_year , age , is_male | concert : concert_id , concert_name , theme , stadium_id , year | singer_in_concert : concert_id , singer_id | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |"],
 
106
  ["What are the number of concerts that occurred in the stadium with the largest capacity ?", "| stadium : stadium_id , location , name , capacity , highest , lowest , average | singer : singer_id , name , country , song_name , song_release_year , age , is_male | concert : concert_id , concert_name , theme , stadium_id , year | singer_in_concert : concert_id , singer_id | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |"],
107
  ["How many male singers performed in concerts in the year 2023?", "| stadium : stadium_id , location , name , capacity , highest , lowest , average | singer : singer_id , name , country , song_name , song_release_year , age , is_male | concert : concert_id , concert_name , theme , stadium_id , year | singer_in_concert : concert_id , singer_id | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |"],
108
  ["List the names of all singers who performed in a concert with the theme 'Rock'", "| stadium : stadium_id , location , name , capacity , highest , lowest , average | singer : singer_id , name , country , song_name , song_release_year , age , is_male | concert : concert_id , concert_name , theme , stadium_id , year | singer_in_concert : concert_id , singer_id | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |"]
109
+ ], inputs=[input_text, db_info, 0.0, top_p, top_k, repetition_penalty], fn=generate, cache_examples=False if platform.system() == "Windows" or platform.system() == "Darwin" else True, outputs=output_box)
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
 
112
  readme_content = requests.get(f"https://huggingface.co/{merged_model}/raw/main/README.md").text
113
  readme_content = re.sub('---.*?---', '', readme_content, flags=re.DOTALL) #Remove YAML front matter