Spaces:
Runtime error
Runtime error
added Pinecone text retrieval, CLIP text-to-image retrieval, and CLIP image-to-image retrieval
Browse filesThis view is limited to 50 files because it contains too many changes. Β
See raw diff
- README.md +6 -7
- app.py +350 -0
- input_features/slides_001_tensor.pt +3 -0
- input_features/slides_002_tensor.pt +3 -0
- input_features/slides_003_tensor.pt +3 -0
- input_features/slides_004_tensor.pt +3 -0
- input_features/slides_005_tensor.pt +3 -0
- input_features/slides_006_tensor.pt +3 -0
- input_features/slides_007_tensor.pt +3 -0
- input_features/slides_008_tensor.pt +3 -0
- input_features/slides_009_tensor.pt +3 -0
- input_features/slides_010_tensor.pt +3 -0
- input_features/slides_01b_tensor.pt +3 -0
- input_features/slides_01c_tensor.pt +3 -0
- input_features/slides_01d_tensor.pt +3 -0
- input_features/slides_020_tensor.pt +3 -0
- input_features/slides_021_tensor.pt +3 -0
- input_features/slides_022_tensor.pt +3 -0
- input_features/slides_023_tensor.pt +3 -0
- input_features/slides_024_tensor.pt +3 -0
- input_features/slides_025_tensor.pt +3 -0
- input_features/slides_026_tensor.pt +3 -0
- input_features/slides_027_tensor.pt +3 -0
- input_features/slides_028_tensor.pt +3 -0
- input_features/slides_040_tensor.pt +3 -0
- input_features/slides_041_tensor.pt +3 -0
- input_features/slides_042_tensor.pt +3 -0
- input_features/slides_043_tensor.pt +3 -0
- input_features/slides_044_tensor.pt +3 -0
- input_features/slides_045_tensor.pt +3 -0
- input_features/slides_046_tensor.pt +3 -0
- input_features/slides_047_tensor.pt +3 -0
- input_features/slides_048_tensor.pt +3 -0
- input_features/slides_049_tensor.pt +3 -0
- input_features/slides_050_tensor.pt +3 -0
- input_features/slides_051_tensor.pt +3 -0
- input_features/slides_052_tensor.pt +3 -0
- input_features/slides_053_tensor.pt +3 -0
- input_features/slides_054_tensor.pt +3 -0
- input_features/slides_055_tensor.pt +3 -0
- input_features/slides_056_tensor.pt +3 -0
- input_features/slides_057_tensor.pt +3 -0
- input_features/slides_058_tensor.pt +3 -0
- input_features/slides_059_tensor.pt +3 -0
- input_features/slides_060_tensor.pt +3 -0
- input_features/slides_080_tensor.pt +3 -0
- input_features/slides_081_tensor.pt +3 -0
- input_features/slides_082_tensor.pt +3 -0
- input_features/slides_083_tensor.pt +3 -0
- input_features/slides_084_tensor.pt +3 -0
README.md
CHANGED
|
@@ -1,13 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 3.
|
| 8 |
app_file: app.py
|
| 9 |
-
pinned:
|
| 10 |
-
license: mit
|
| 11 |
---
|
| 12 |
|
| 13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: AI Teaching Assistant
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: gray
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 3.20.1
|
| 8 |
app_file: app.py
|
| 9 |
+
pinned: true
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
|
| 3 |
+
import gradio as gr
|
| 4 |
+
import retrieval
|
| 5 |
+
import ray
|
| 6 |
+
from dotenv import load_dotenv
|
| 7 |
+
from text_generation import Client, InferenceAPIClient
|
| 8 |
+
|
| 9 |
+
# load API keys from globally-availabe .env file
|
| 10 |
+
SECRETS_FILEPATH = "/mnt/project/chatbotai/huggingface_cache/internal_api_keys.env"
|
| 11 |
+
load_dotenv(dotenv_path=SECRETS_FILEPATH, override=True)
|
| 12 |
+
|
| 13 |
+
NUM_ANSWERS_GENERATED = 3
|
| 14 |
+
|
| 15 |
+
openchat_preprompt = (
|
| 16 |
+
"\n<human>: Hi!\n<bot>: My name is Bot, model version is 0.15, part of an open-source kit for "
|
| 17 |
+
"fine-tuning new bots! I was created by Together, LAION, and Ontocord.ai and the open-source "
|
| 18 |
+
"community. I am not human, not evil and not alive, and thus have no thoughts and feelings, "
|
| 19 |
+
"but I am programmed to be helpful, polite, honest, and friendly. I'm really smart at answering electrical engineering questions.\n")
|
| 20 |
+
|
| 21 |
+
# LOAD MODELS
|
| 22 |
+
ta = retrieval.Retrieval()
|
| 23 |
+
|
| 24 |
+
context1 = None
|
| 25 |
+
context2 = None
|
| 26 |
+
context3 = None
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def clip_img_search(img):
|
| 30 |
+
if img is None:
|
| 31 |
+
return []
|
| 32 |
+
else:
|
| 33 |
+
return ta.reverse_img_search(img)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def get_client(model: str):
|
| 37 |
+
if model == "Rallio67/joi2_20Be_instruct_alpha":
|
| 38 |
+
return Client(os.getenv("JOI_API_URL"))
|
| 39 |
+
if model == "togethercomputer/GPT-NeoXT-Chat-Base-20B":
|
| 40 |
+
return Client(os.getenv("OPENCHAT_API_URL"))
|
| 41 |
+
return InferenceAPIClient(model, token=os.getenv("HF_TOKEN", None))
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def get_usernames(model: str):
|
| 45 |
+
"""
|
| 46 |
+
Returns:
|
| 47 |
+
(str, str, str, str): pre-prompt, username, bot name, separator
|
| 48 |
+
"""
|
| 49 |
+
if model == "OpenAssistant/oasst-sft-1-pythia-12b":
|
| 50 |
+
return "", "<|prompter|>", "<|assistant|>", "<|endoftext|>"
|
| 51 |
+
if model == "Rallio67/joi2_20Be_instruct_alpha":
|
| 52 |
+
return "", "User: ", "Joi: ", "\n\n"
|
| 53 |
+
if model == "togethercomputer/GPT-NeoXT-Chat-Base-20B":
|
| 54 |
+
return openchat_preprompt, "<human>: ", "<bot>: ", "\n"
|
| 55 |
+
return "", "User: ", "Assistant: ", "\n"
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def predict(
|
| 59 |
+
model: str,
|
| 60 |
+
inputs: str,
|
| 61 |
+
typical_p: float,
|
| 62 |
+
top_p: float,
|
| 63 |
+
temperature: float,
|
| 64 |
+
top_k: int,
|
| 65 |
+
repetition_penalty: float,
|
| 66 |
+
watermark: bool,
|
| 67 |
+
chatbot,
|
| 68 |
+
history,
|
| 69 |
+
):
|
| 70 |
+
client = get_client(model)
|
| 71 |
+
preprompt, user_name, assistant_name, sep = get_usernames(model)
|
| 72 |
+
|
| 73 |
+
history.append(inputs)
|
| 74 |
+
|
| 75 |
+
past = []
|
| 76 |
+
for data in chatbot:
|
| 77 |
+
user_data, model_data = data
|
| 78 |
+
|
| 79 |
+
if not user_data.startswith(user_name):
|
| 80 |
+
user_data = user_name + user_data
|
| 81 |
+
if not model_data.startswith(sep + assistant_name):
|
| 82 |
+
model_data = sep + assistant_name + model_data
|
| 83 |
+
|
| 84 |
+
past.append(user_data + model_data.rstrip() + sep)
|
| 85 |
+
|
| 86 |
+
if not inputs.startswith(user_name):
|
| 87 |
+
inputs = user_name + inputs
|
| 88 |
+
|
| 89 |
+
total_inputs = preprompt + "".join(past) + inputs + sep + assistant_name.rstrip()
|
| 90 |
+
|
| 91 |
+
partial_words = ""
|
| 92 |
+
|
| 93 |
+
if model == "OpenAssistant/oasst-sft-1-pythia-12b":
|
| 94 |
+
iterator = client.generate_stream(
|
| 95 |
+
total_inputs,
|
| 96 |
+
typical_p=typical_p,
|
| 97 |
+
truncate=1000,
|
| 98 |
+
watermark=watermark,
|
| 99 |
+
max_new_tokens=500,
|
| 100 |
+
)
|
| 101 |
+
else:
|
| 102 |
+
iterator = client.generate_stream(
|
| 103 |
+
total_inputs,
|
| 104 |
+
top_p=top_p if top_p < 1.0 else None,
|
| 105 |
+
top_k=top_k,
|
| 106 |
+
truncate=1000,
|
| 107 |
+
repetition_penalty=repetition_penalty,
|
| 108 |
+
watermark=watermark,
|
| 109 |
+
temperature=temperature,
|
| 110 |
+
max_new_tokens=500,
|
| 111 |
+
stop_sequences=[user_name.rstrip(), assistant_name.rstrip()],
|
| 112 |
+
)
|
| 113 |
+
|
| 114 |
+
for i, response in enumerate(iterator):
|
| 115 |
+
if response.token.special:
|
| 116 |
+
continue
|
| 117 |
+
|
| 118 |
+
partial_words = partial_words + response.token.text
|
| 119 |
+
if partial_words.endswith(user_name.rstrip()):
|
| 120 |
+
partial_words = partial_words.rstrip(user_name.rstrip())
|
| 121 |
+
if partial_words.endswith(assistant_name.rstrip()):
|
| 122 |
+
partial_words = partial_words.rstrip(assistant_name.rstrip())
|
| 123 |
+
|
| 124 |
+
if i == 0:
|
| 125 |
+
history.append(" " + partial_words)
|
| 126 |
+
elif response.token.text not in user_name:
|
| 127 |
+
history[-1] = partial_words
|
| 128 |
+
|
| 129 |
+
chat = [(history[i].strip(), history[i + 1].strip()) for i in range(0, len(history) - 1, 2)]
|
| 130 |
+
yield chat, history, None, None, None, []
|
| 131 |
+
|
| 132 |
+
# Pinecone context retrieval
|
| 133 |
+
top_context_list = ta.retrieve_contexts_from_pinecone(user_question=inputs, topk=NUM_ANSWERS_GENERATED)
|
| 134 |
+
yield chat, history, top_context_list[0], top_context_list[1], top_context_list[2], []
|
| 135 |
+
|
| 136 |
+
# run CLIP
|
| 137 |
+
images_list = ta.clip_text_to_image(inputs)
|
| 138 |
+
|
| 139 |
+
yield chat, history, top_context_list[0], top_context_list[1], top_context_list[2], images_list
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
def reset_textbox():
|
| 143 |
+
return gr.update(value="")
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
def radio_on_change(
|
| 147 |
+
value: str,
|
| 148 |
+
disclaimer,
|
| 149 |
+
typical_p,
|
| 150 |
+
top_p,
|
| 151 |
+
top_k,
|
| 152 |
+
temperature,
|
| 153 |
+
repetition_penalty,
|
| 154 |
+
watermark,
|
| 155 |
+
):
|
| 156 |
+
if value == "OpenAssistant/oasst-sft-1-pythia-12b":
|
| 157 |
+
typical_p = typical_p.update(value=0.2, visible=True)
|
| 158 |
+
top_p = top_p.update(visible=False)
|
| 159 |
+
top_k = top_k.update(visible=False)
|
| 160 |
+
temperature = temperature.update(visible=False)
|
| 161 |
+
disclaimer = disclaimer.update(visible=False)
|
| 162 |
+
repetition_penalty = repetition_penalty.update(visible=False)
|
| 163 |
+
watermark = watermark.update(False)
|
| 164 |
+
elif value == "togethercomputer/GPT-NeoXT-Chat-Base-20B":
|
| 165 |
+
typical_p = typical_p.update(visible=False)
|
| 166 |
+
top_p = top_p.update(value=0.25, visible=True)
|
| 167 |
+
top_k = top_k.update(value=50, visible=True)
|
| 168 |
+
temperature = temperature.update(value=0.6, visible=True)
|
| 169 |
+
repetition_penalty = repetition_penalty.update(value=1.01, visible=True)
|
| 170 |
+
watermark = watermark.update(False)
|
| 171 |
+
disclaimer = disclaimer.update(visible=True)
|
| 172 |
+
else:
|
| 173 |
+
typical_p = typical_p.update(visible=False)
|
| 174 |
+
top_p = top_p.update(value=0.95, visible=True)
|
| 175 |
+
top_k = top_k.update(value=4, visible=True)
|
| 176 |
+
temperature = temperature.update(value=0.5, visible=True)
|
| 177 |
+
repetition_penalty = repetition_penalty.update(value=1.03, visible=True)
|
| 178 |
+
watermark = watermark.update(True)
|
| 179 |
+
disclaimer = disclaimer.update(visible=False)
|
| 180 |
+
return (
|
| 181 |
+
disclaimer,
|
| 182 |
+
typical_p,
|
| 183 |
+
top_p,
|
| 184 |
+
top_k,
|
| 185 |
+
temperature,
|
| 186 |
+
repetition_penalty,
|
| 187 |
+
watermark,
|
| 188 |
+
)
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
title = """<h1 align="center">π₯Teaching Assistant Chatbot"""
|
| 192 |
+
description = """
|
| 193 |
+
"""
|
| 194 |
+
|
| 195 |
+
openchat_disclaimer = """
|
| 196 |
+
<div align="center">Checkout the official <a href=https://huggingface.co/spaces/togethercomputer/OpenChatKit>OpenChatKit feedback app</a> for the full experience.</div>
|
| 197 |
+
"""
|
| 198 |
+
|
| 199 |
+
with gr.Blocks(css="""#col_container {margin-left: auto; margin-right: auto;}
|
| 200 |
+
#chatbot {height: 520px; overflow: auto;}""") as demo:
|
| 201 |
+
gr.HTML(title)
|
| 202 |
+
with gr.Row():
|
| 203 |
+
with gr.Accordion("Model choices", open=False, visible=True):
|
| 204 |
+
model = gr.Radio(
|
| 205 |
+
value="OpenAssistant/oasst-sft-1-pythia-12b",
|
| 206 |
+
choices=[
|
| 207 |
+
"OpenAssistant/oasst-sft-1-pythia-12b",
|
| 208 |
+
# "togethercomputer/GPT-NeoXT-Chat-Base-20B",
|
| 209 |
+
"Rallio67/joi2_20Be_instruct_alpha",
|
| 210 |
+
"google/flan-t5-xxl",
|
| 211 |
+
"google/flan-ul2",
|
| 212 |
+
"bigscience/bloom",
|
| 213 |
+
"bigscience/bloomz",
|
| 214 |
+
"EleutherAI/gpt-neox-20b",
|
| 215 |
+
],
|
| 216 |
+
label="",
|
| 217 |
+
interactive=True,
|
| 218 |
+
)
|
| 219 |
+
# with gr.Row():
|
| 220 |
+
# with gr.Column():
|
| 221 |
+
# use_gpt3_checkbox = gr.Checkbox(label="Include GPT-3 (paid)?")
|
| 222 |
+
# with gr.Column():
|
| 223 |
+
# use_equation_checkbox = gr.Checkbox(label="Prioritize equations?")
|
| 224 |
+
state = gr.State([])
|
| 225 |
+
|
| 226 |
+
with gr.Row():
|
| 227 |
+
with gr.Column():
|
| 228 |
+
chatbot = gr.Chatbot(elem_id="chatbot")
|
| 229 |
+
inputs = gr.Textbox(placeholder="Ask an Electrical Engineering question!", label="Send a message...")
|
| 230 |
+
examples = gr.Examples(
|
| 231 |
+
examples=[
|
| 232 |
+
"What is a Finite State Machine?",
|
| 233 |
+
"How do you design a functional a Two-Bit Gray Code Counter?",
|
| 234 |
+
"How can we compare an 8-bit 2's complement number to the value -1 using AND, OR, and NOT?",
|
| 235 |
+
"What does the uninterrupted counting cycle label mean?",
|
| 236 |
+
],
|
| 237 |
+
inputs=[inputs],
|
| 238 |
+
outputs=[],
|
| 239 |
+
)
|
| 240 |
+
gr.Markdown("## Relevant Textbook Passages & Lecture Transcripts")
|
| 241 |
+
with gr.Row():
|
| 242 |
+
with gr.Column():
|
| 243 |
+
context1 = gr.Textbox(label="Context 1")
|
| 244 |
+
with gr.Column():
|
| 245 |
+
context2 = gr.Textbox(label="Context 2")
|
| 246 |
+
with gr.Column():
|
| 247 |
+
context3 = gr.Textbox(label="Context 3")
|
| 248 |
+
|
| 249 |
+
gr.Markdown("## Relevant Lecture Slides")
|
| 250 |
+
with gr.Row():
|
| 251 |
+
with gr.Column(scale=2.6):
|
| 252 |
+
lec_gallery = gr.Gallery(label="Lecture images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
|
| 253 |
+
with gr.Column(scale=1):
|
| 254 |
+
inp_image = gr.Image(type="pil", label="Reverse Image Search (optional)", shape=(224, 398))
|
| 255 |
+
|
| 256 |
+
inp_image.change(fn=clip_img_search, inputs=inp_image, outputs=lec_gallery, scroll_to_output=True)
|
| 257 |
+
disclaimer = gr.Markdown(openchat_disclaimer, visible=False)
|
| 258 |
+
# state = gr.State([])
|
| 259 |
+
|
| 260 |
+
with gr.Row():
|
| 261 |
+
with gr.Accordion("Parameters", open=False, visible=True):
|
| 262 |
+
typical_p = gr.Slider(
|
| 263 |
+
minimum=-0,
|
| 264 |
+
maximum=1.0,
|
| 265 |
+
value=0.2,
|
| 266 |
+
step=0.05,
|
| 267 |
+
interactive=True,
|
| 268 |
+
label="Typical P mass",
|
| 269 |
+
)
|
| 270 |
+
top_p = gr.Slider(
|
| 271 |
+
minimum=-0,
|
| 272 |
+
maximum=1.0,
|
| 273 |
+
value=0.25,
|
| 274 |
+
step=0.05,
|
| 275 |
+
interactive=True,
|
| 276 |
+
label="Top-p (nucleus sampling)",
|
| 277 |
+
visible=False,
|
| 278 |
+
)
|
| 279 |
+
temperature = gr.Slider(
|
| 280 |
+
minimum=-0,
|
| 281 |
+
maximum=5.0,
|
| 282 |
+
value=0.6,
|
| 283 |
+
step=0.1,
|
| 284 |
+
interactive=True,
|
| 285 |
+
label="Temperature",
|
| 286 |
+
visible=False,
|
| 287 |
+
)
|
| 288 |
+
top_k = gr.Slider(
|
| 289 |
+
minimum=1,
|
| 290 |
+
maximum=50,
|
| 291 |
+
value=50,
|
| 292 |
+
step=1,
|
| 293 |
+
interactive=True,
|
| 294 |
+
label="Top-k",
|
| 295 |
+
visible=False,
|
| 296 |
+
)
|
| 297 |
+
repetition_penalty = gr.Slider(
|
| 298 |
+
minimum=0.1,
|
| 299 |
+
maximum=3.0,
|
| 300 |
+
value=1.03,
|
| 301 |
+
step=0.01,
|
| 302 |
+
interactive=True,
|
| 303 |
+
label="Repetition Penalty",
|
| 304 |
+
visible=False,
|
| 305 |
+
)
|
| 306 |
+
watermark = gr.Checkbox(value=False, label="Text watermarking")
|
| 307 |
+
|
| 308 |
+
model.change(
|
| 309 |
+
lambda value: radio_on_change(
|
| 310 |
+
value,
|
| 311 |
+
disclaimer,
|
| 312 |
+
typical_p,
|
| 313 |
+
top_p,
|
| 314 |
+
top_k,
|
| 315 |
+
temperature,
|
| 316 |
+
repetition_penalty,
|
| 317 |
+
watermark,
|
| 318 |
+
),
|
| 319 |
+
inputs=model,
|
| 320 |
+
outputs=[
|
| 321 |
+
disclaimer,
|
| 322 |
+
typical_p,
|
| 323 |
+
top_p,
|
| 324 |
+
top_k,
|
| 325 |
+
temperature,
|
| 326 |
+
repetition_penalty,
|
| 327 |
+
watermark,
|
| 328 |
+
],
|
| 329 |
+
)
|
| 330 |
+
|
| 331 |
+
inputs.submit(
|
| 332 |
+
predict,
|
| 333 |
+
[
|
| 334 |
+
model,
|
| 335 |
+
inputs,
|
| 336 |
+
typical_p,
|
| 337 |
+
top_p,
|
| 338 |
+
temperature,
|
| 339 |
+
top_k,
|
| 340 |
+
repetition_penalty,
|
| 341 |
+
watermark,
|
| 342 |
+
chatbot,
|
| 343 |
+
state,
|
| 344 |
+
],
|
| 345 |
+
[chatbot, state, context1, context2, context3, lec_gallery],
|
| 346 |
+
)
|
| 347 |
+
inputs.submit(reset_textbox, [], [inputs])
|
| 348 |
+
|
| 349 |
+
gr.Markdown(description)
|
| 350 |
+
demo.queue(concurrency_count=16).launch(share=True, debug=True)
|
input_features/slides_001_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1a3aa55a1cd91831596252fb206ffea7df4d7b08e181858b442b74ee95c276d9
|
| 3 |
+
size 23305
|
input_features/slides_002_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2993e914f5ee5c7daee5a3e55facb1ba3b57bf6349ecc7f9de1b4f2b0bf29684
|
| 3 |
+
size 14089
|
input_features/slides_003_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d87a18c7da15e3b8990242239c097b786d5ac3a130e3c5c07d50b0babc17c9c0
|
| 3 |
+
size 19209
|
input_features/slides_004_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1137ba5bf6f1b2328b8304008f195dc8eda6eea2de66f818406b5450ff7d8888
|
| 3 |
+
size 15113
|
input_features/slides_005_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0574e76854377fac11bbc1dcf1fc88e422308ff580b0722b5b0d5297ba58aa49
|
| 3 |
+
size 16137
|
input_features/slides_006_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2849be3f77becf0fe4a45547d963340e3e52bd176efb1d28100b3039972d3164
|
| 3 |
+
size 23305
|
input_features/slides_007_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7d4e8e951d5d987e6913ae1db37ff021a87b57ada956e420905deb9c4702e590
|
| 3 |
+
size 18185
|
input_features/slides_008_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:641e9f98b2c2c34b353c9f8f733500010865d0496ce0414cff09bdee2389f7fe
|
| 3 |
+
size 19209
|
input_features/slides_009_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3c9e330f77b7cf69efea702b62b4fd6b1ec3a1748ab78ebb173d1e313014b417
|
| 3 |
+
size 26377
|
input_features/slides_010_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e0587066479e4a29a9eb0df4b31b0013686b08fd871b697ab1c61de74618dba7
|
| 3 |
+
size 13065
|
input_features/slides_01b_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8d6300ebe4832e1c4974f3b2959caad86c2accc8edbc3a21ecfd824b5c7e15fc
|
| 3 |
+
size 6921
|
input_features/slides_01c_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d46ac2ec63042e11e7f93566ecd1daed805e75a1dc2a3336c09d499a959274ca
|
| 3 |
+
size 14089
|
input_features/slides_01d_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:70487640c037098a13953f869b1769ae86aba8b5bddf33cda85d6207c554eadf
|
| 3 |
+
size 14089
|
input_features/slides_020_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b2c50ae29f749524583c678ad094e4088ae246602f272b978a7f5f1ece9ece6b
|
| 3 |
+
size 29449
|
input_features/slides_021_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:864b4b59c5e63911260af2275ad72c4802a772eaf6a9192c76a15580db8a9acc
|
| 3 |
+
size 26377
|
input_features/slides_022_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ebf693cf7162dd3fbfc8cd28c3c2bc7f3c6633df2e7a042b242b018f20cba3c0
|
| 3 |
+
size 20233
|
input_features/slides_023_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8939b7444a5f635610285b5005432652a85deaf6edea82a5ab4a4ddea56e83bb
|
| 3 |
+
size 17161
|
input_features/slides_024_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fa2a5c8bf84e0933c81d2b4bba9ad0dbdc66682a1fb98582ebda471dbeeee57d
|
| 3 |
+
size 27401
|
input_features/slides_025_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b8e0391a56c624115b8521b164f4631f14857aeb07f71e0d15cd19a6417943ea
|
| 3 |
+
size 9993
|
input_features/slides_026_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:be2104909f8033567ab756ededf141b4796661ab006d4822873b0a70c2e2fde8
|
| 3 |
+
size 16137
|
input_features/slides_027_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9d1fc6aa5d76f583e34bcf61bc1d3972b77b3d1c0c004f7731a2b75e2191ee62
|
| 3 |
+
size 7945
|
input_features/slides_028_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6f78840edff83403e20969b9129b7e56795c5e0bee52412b12ba37531e967943
|
| 3 |
+
size 8969
|
input_features/slides_040_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:57ab7f456e60de77191995d53bae358a5f6c9a19782d1375610b7bc3cf76f6fc
|
| 3 |
+
size 34569
|
input_features/slides_041_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7e77ab06cb819d307932284eb2ee7e509824ca58fe89b10d1cbe5c2e3f2cf06e
|
| 3 |
+
size 15113
|
input_features/slides_042_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:78e8a63d16e24c5ec2662b730cf2ee97b714f7c703e861e409d7d1bea3c62ca0
|
| 3 |
+
size 17161
|
input_features/slides_043_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b76a6e1d3856f9879eee10573c74f2bc9e6bcc3db2fffab42620c944ab67f348
|
| 3 |
+
size 34569
|
input_features/slides_044_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fd881a289530393a383d8aac2ad70bd4b66c7359008865d24a2fd41b92ad29d9
|
| 3 |
+
size 20233
|
input_features/slides_045_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b2070713a57797f252c9e950c4b45c3e25ef370bc4174dde625290288deca9f6
|
| 3 |
+
size 15113
|
input_features/slides_046_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0a1d3a30eab6cb220c0657391384af1bc7576dec61891d1b0ad0b697a1664d90
|
| 3 |
+
size 22281
|
input_features/slides_047_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b0d288fce6d631be4f4e4c472acd6720f652e5ac86b2bb4c73221238068d748e
|
| 3 |
+
size 11017
|
input_features/slides_048_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6400b3b33e4e55caefbe5fe3024412252f533ba79a0a6f94859e48252ebbe359
|
| 3 |
+
size 17161
|
input_features/slides_049_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:73bb186ffe701645f14bfa62eaf20248a21e780b81ab1fbf444d4e3bc1a89ca6
|
| 3 |
+
size 18185
|
input_features/slides_050_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ed7d3991f4a63094acf18bb37345d1a138482d37651b7a9269add1da8b466f17
|
| 3 |
+
size 12041
|
input_features/slides_051_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f5854964ffea39ad2cc1ee489d5c9de3a3b6e7e186a902ab2de261ee8ff5ed89
|
| 3 |
+
size 17161
|
input_features/slides_052_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9c4b7abe24ca1b2d51868e8c44cd36a590b6841c6ff5977601a1fd84898c8d5a
|
| 3 |
+
size 22281
|
input_features/slides_053_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0e0e3f4a25aaf51a1a0106a45f39ae5bb9fc2a2b5cdc3db21059ab1ee3d0774e
|
| 3 |
+
size 9993
|
input_features/slides_054_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d228ca66f356c9b7add38c82bccb85436db6e828e24bff1a2239b2160f2aef27
|
| 3 |
+
size 18185
|
input_features/slides_055_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6478cd7a2ce228538e47e64c9f5cc8fd7f6e2098f0ed8f76856bf0a5521976c0
|
| 3 |
+
size 16137
|
input_features/slides_056_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f7eb0525bb56634e90a4fe8e7fd68020f01c2e9444ad5102651c08741de3ceab
|
| 3 |
+
size 14089
|
input_features/slides_057_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:236c5bb014645053d50951b182ff40859ac0eaddc629ec7f06b68cb34db1653d
|
| 3 |
+
size 19209
|
input_features/slides_058_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:28620a41c331012a480fdc75e7d8959a2536fe7d23bd7a07e83786043e563398
|
| 3 |
+
size 8969
|
input_features/slides_059_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b72ae0e8833e992fe5851389733a8f6944585a5de4d6713fa3e9c0467d000d01
|
| 3 |
+
size 19209
|
input_features/slides_060_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ee95f4cf8a09016d7236bb99c29ede5f4057223b3063b6e0db14f0b4dea234a6
|
| 3 |
+
size 13065
|
input_features/slides_080_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:20dd637c00aeb74c57c2acd697d8a5c71dc7e3437e0482151374588935a9f978
|
| 3 |
+
size 8969
|
input_features/slides_081_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8ba526af2b70e9730ec2de5332b2016a568053e5dc7405a300bce0ca6c89d2f2
|
| 3 |
+
size 24329
|
input_features/slides_082_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7670802d60315c6d6dee8cffc7b77536c460da5553f324efbb1b460b60e8eb15
|
| 3 |
+
size 15113
|
input_features/slides_083_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:15edfd80b83a522f90a5a366613f2c13036f5dc369a1550e6b0fc6516818f6d2
|
| 3 |
+
size 31497
|
input_features/slides_084_tensor.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c6c28519e0a5ca27b424644470d79a26334f67a26afc579ff339d50ac4f3e47c
|
| 3 |
+
size 22281
|