Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
@@ -1,12 +1,6 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
|
4 |
-
colorFrom: green
|
5 |
-
colorTo: blue
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.17.0
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: Axolotl_Launcher
|
3 |
+
app_file: main.py
|
|
|
|
|
4 |
sdk: gradio
|
5 |
sdk_version: 4.17.0
|
|
|
|
|
6 |
---
|
|
|
|
main.py
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
This module is used to launch Axolotl with user defined configurations.
|
3 |
+
"""
|
4 |
+
|
5 |
+
import gradio as gr
|
6 |
+
import yaml
|
7 |
+
|
8 |
+
|
9 |
+
def config(
|
10 |
+
base_model,
|
11 |
+
dataset,
|
12 |
+
dataset_type,
|
13 |
+
learn_rate,
|
14 |
+
gradient_accumulation_steps,
|
15 |
+
micro_batch_size,
|
16 |
+
seq_length,
|
17 |
+
num_epochs,
|
18 |
+
output_dir,
|
19 |
+
val_size,
|
20 |
+
):
|
21 |
+
"""
|
22 |
+
This function generates a configuration dictionary and saves it as a yaml file.
|
23 |
+
"""
|
24 |
+
config_dict = {
|
25 |
+
"base_model": base_model,
|
26 |
+
"datasets": [{"path": dataset, "type": dataset_type}],
|
27 |
+
"learning_rate": learn_rate,
|
28 |
+
"gradient_accumulation_steps": gradient_accumulation_steps,
|
29 |
+
"micro_batch_size": micro_batch_size,
|
30 |
+
"sequence_len": seq_length,
|
31 |
+
"num_epochs": num_epochs,
|
32 |
+
"output_dir": output_dir,
|
33 |
+
"val_set_size": val_size,
|
34 |
+
}
|
35 |
+
with open("config.yml", "w", encoding="utf-8") as file:
|
36 |
+
yaml.dump(config_dict, file)
|
37 |
+
print(config_dict)
|
38 |
+
return yaml.dump(config_dict)
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
with gr.Blocks(title="Axolotl Launcher") as demo:
|
43 |
+
gr.Markdown(
|
44 |
+
"""
|
45 |
+
# Axolotl Launcher
|
46 |
+
Fill out the required fields below to create a training run.
|
47 |
+
"""
|
48 |
+
)
|
49 |
+
base_model_name = gr.Textbox(
|
50 |
+
"TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T", label="Base model"
|
51 |
+
)
|
52 |
+
with gr.Row():
|
53 |
+
dataset_path = gr.Textbox("mhenrichsen/alpaca_2k_test", label="Dataset")
|
54 |
+
dataset_type_name = gr.Dropdown(
|
55 |
+
choices=["alpaca", "sharegpt"], label="Dataset type", value="alpaca"
|
56 |
+
)
|
57 |
+
with gr.Row():
|
58 |
+
learning_rate = gr.Number(0.000001, label="Learning rate")
|
59 |
+
gradient_accumulation_steps_count = gr.Number(
|
60 |
+
1, label="Gradient accumulation steps"
|
61 |
+
)
|
62 |
+
val_set_size_count = gr.Number(0, label="Validation size")
|
63 |
+
|
64 |
+
with gr.Row():
|
65 |
+
micro_batch_size_count = gr.Number(1, label="Micro batch size")
|
66 |
+
sequence_length = gr.Number(1024, label="Sequence length")
|
67 |
+
num_epochs_count = gr.Number(1, label="Epochs")
|
68 |
+
|
69 |
+
output_dir_path = gr.Textbox("./model-out", label="Output directory")
|
70 |
+
|
71 |
+
mode = gr.Radio(
|
72 |
+
choices=["Full finetune", "QLoRA", "LoRA"],
|
73 |
+
value="Full finetune",
|
74 |
+
label="Training mode",
|
75 |
+
info="FFT = 16 bit, Qlora = 4 bit, Lora = 8 bit",
|
76 |
+
)
|
77 |
+
|
78 |
+
create_config = gr.Button("Create config")
|
79 |
+
output = gr.TextArea(label="Generated config")
|
80 |
+
create_config.click(
|
81 |
+
config,
|
82 |
+
inputs=[
|
83 |
+
base_model_name,
|
84 |
+
dataset_path,
|
85 |
+
dataset_type_name,
|
86 |
+
learning_rate,
|
87 |
+
gradient_accumulation_steps_count,
|
88 |
+
micro_batch_size_count,
|
89 |
+
sequence_length,
|
90 |
+
num_epochs_count,
|
91 |
+
output_dir_path,
|
92 |
+
val_set_size_count,
|
93 |
+
],
|
94 |
+
outputs=output,
|
95 |
+
)
|
96 |
+
|
97 |
+
demo.launch(share=True)
|