Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -108,42 +108,47 @@ def submit_weights(model, repository, model_out_name, token):
|
|
108 |
def main():
|
109 |
with gr.Blocks() as demo:
|
110 |
|
111 |
-
|
112 |
with gr.Tabs():
|
113 |
with gr.TabItem("About"):
|
|
|
114 |
gr.Markdown(get_files.load_markdown_file("README.md"))
|
115 |
-
|
116 |
-
with gr.TabItem("
|
117 |
-
|
118 |
-
gr.Markdown("# SLM Instruction Tuning with Unsloth")
|
119 |
-
|
120 |
-
##### Initial Model Inputs #####
|
121 |
-
gr.Markdown("### Model Inputs")
|
122 |
-
|
123 |
# Select Model
|
124 |
modelnames = conf['model']['choices']
|
125 |
model_name = gr.Dropdown(label="Supported Models",
|
126 |
choices=modelnames,
|
127 |
value=modelnames[0])
|
128 |
-
#
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
dataset_choice = gr.Radio(label="Choose Dataset",
|
133 |
choices=["Hugging Face Hub Dataset", "Upload Your Own"],
|
134 |
value="Hugging Face Hub Dataset")
|
135 |
-
|
136 |
dataset_predefined = gr.Textbox(label="Hugging Face Hub Training Dataset",
|
137 |
value='yahma/alpaca-cleaned',
|
138 |
visible=True)
|
139 |
-
|
140 |
dataset_predefined_load = gr.Button("Upload Dataset (.csv, .jsonl, or .txt)")
|
141 |
|
142 |
dataset_uploaded_load = gr.UploadButton(label="Upload Dataset (.csv, .jsonl, or .txt)",
|
143 |
file_types=[".csv",".jsonl", ".txt"],
|
144 |
visible=False)
|
|
|
145 |
data_snippet = gr.Markdown()
|
146 |
-
|
|
|
147 |
dataset_choice.change(update_visibility.textbox_vis,
|
148 |
dataset_choice,
|
149 |
dataset_predefined)
|
@@ -153,8 +158,10 @@ def main():
|
|
153 |
dataset_choice.change(update_visibility.textbox_button_vis,
|
154 |
dataset_choice,
|
155 |
dataset_predefined_load)
|
156 |
-
|
157 |
-
|
|
|
|
|
158 |
dataset_predefined_load.click(fn=get_files.predefined_dataset,
|
159 |
inputs=dataset_predefined,
|
160 |
outputs=data_snippet)
|
@@ -162,13 +169,12 @@ def main():
|
|
162 |
dataset_uploaded_load.click(fn=get_files.uploaded_dataset,
|
163 |
inputs=dataset_uploaded_load,
|
164 |
outputs=data_snippet)
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
##### Model Parameter Inputs #####
|
171 |
-
gr.Markdown("
|
|
|
172 |
# Parameters
|
173 |
data_field = gr.Textbox(label="Dataset Training Field Name",
|
174 |
value=conf['model']['general']["dataset_text_field"])
|
@@ -179,11 +185,7 @@ def main():
|
|
179 |
num_epochs = gr.Textbox(label="Training Epochs",
|
180 |
value=conf['model']['general']["num_train_epochs"])
|
181 |
max_steps = gr.Textbox(label="Maximum steps",
|
182 |
-
value=conf['model']['general']["max_steps"])
|
183 |
-
repository = gr.Textbox(label="Repository Name",
|
184 |
-
value=conf['model']['general']["repository"])
|
185 |
-
model_out_name = gr.Textbox(label="Model Output Name",
|
186 |
-
value=conf['model']['general']["model_name"])
|
187 |
|
188 |
# Hyperparameters (allow selection, but hide in accordion.)
|
189 |
with gr.Accordion("Advanced Tuning", open=False):
|
|
|
108 |
def main():
|
109 |
with gr.Blocks() as demo:
|
110 |
|
|
|
111 |
with gr.Tabs():
|
112 |
with gr.TabItem("About"):
|
113 |
+
# About page!!
|
114 |
gr.Markdown(get_files.load_markdown_file("README.md"))
|
115 |
+
|
116 |
+
with gr.TabItem("Basic Setup"):
|
117 |
+
gr.Markdown("# Select Model and Input details")
|
|
|
|
|
|
|
|
|
|
|
118 |
# Select Model
|
119 |
modelnames = conf['model']['choices']
|
120 |
model_name = gr.Dropdown(label="Supported Models",
|
121 |
choices=modelnames,
|
122 |
value=modelnames[0])
|
123 |
+
# Select Generic Model parameters
|
124 |
+
repository = gr.Textbox(label="Repository Name",
|
125 |
+
value=conf['model']['general']["repository"])
|
126 |
+
model_out_name = gr.Textbox(label="Model Output Name",
|
127 |
+
value=conf['model']['general']["model_name"])
|
128 |
+
hf_token = gr.Textbox(label="Huggingface Token",
|
129 |
+
type='password',
|
130 |
+
value='')
|
131 |
+
|
132 |
+
|
133 |
+
with gr.TabItem("Upload Data"):
|
134 |
+
# Toggle dataset load types
|
135 |
+
gr.Markdown("# Dataset Selection and Upload")
|
136 |
+
|
137 |
dataset_choice = gr.Radio(label="Choose Dataset",
|
138 |
choices=["Hugging Face Hub Dataset", "Upload Your Own"],
|
139 |
value="Hugging Face Hub Dataset")
|
|
|
140 |
dataset_predefined = gr.Textbox(label="Hugging Face Hub Training Dataset",
|
141 |
value='yahma/alpaca-cleaned',
|
142 |
visible=True)
|
|
|
143 |
dataset_predefined_load = gr.Button("Upload Dataset (.csv, .jsonl, or .txt)")
|
144 |
|
145 |
dataset_uploaded_load = gr.UploadButton(label="Upload Dataset (.csv, .jsonl, or .txt)",
|
146 |
file_types=[".csv",".jsonl", ".txt"],
|
147 |
visible=False)
|
148 |
+
# Safety output to show if upload succeeded.
|
149 |
data_snippet = gr.Markdown()
|
150 |
+
|
151 |
+
# Visibility toggler
|
152 |
dataset_choice.change(update_visibility.textbox_vis,
|
153 |
dataset_choice,
|
154 |
dataset_predefined)
|
|
|
158 |
dataset_choice.change(update_visibility.textbox_button_vis,
|
159 |
dataset_choice,
|
160 |
dataset_predefined_load)
|
161 |
+
# Prompt template
|
162 |
+
inject_prompt = gr.Textbox(label="Prompt Template",
|
163 |
+
value=prompt_template())
|
164 |
+
# Dataset buttons
|
165 |
dataset_predefined_load.click(fn=get_files.predefined_dataset,
|
166 |
inputs=dataset_predefined,
|
167 |
outputs=data_snippet)
|
|
|
169 |
dataset_uploaded_load.click(fn=get_files.uploaded_dataset,
|
170 |
inputs=dataset_uploaded_load,
|
171 |
outputs=data_snippet)
|
172 |
+
|
173 |
+
|
174 |
+
with gr.TabItem("Train Model"):
|
|
|
|
|
175 |
##### Model Parameter Inputs #####
|
176 |
+
gr.Markdown("# Model Parameter Selection")
|
177 |
+
|
178 |
# Parameters
|
179 |
data_field = gr.Textbox(label="Dataset Training Field Name",
|
180 |
value=conf['model']['general']["dataset_text_field"])
|
|
|
185 |
num_epochs = gr.Textbox(label="Training Epochs",
|
186 |
value=conf['model']['general']["num_train_epochs"])
|
187 |
max_steps = gr.Textbox(label="Maximum steps",
|
188 |
+
value=conf['model']['general']["max_steps"])
|
|
|
|
|
|
|
|
|
189 |
|
190 |
# Hyperparameters (allow selection, but hide in accordion.)
|
191 |
with gr.Accordion("Advanced Tuning", open=False):
|