Spaces:
Runtime error
Runtime error
rsquare
commited on
Commit
•
584cf29
1
Parent(s):
57300b9
Initial commit
Browse files- css/main.css +3 -2
- extensions/gallery/__pycache__/script.cpython-310.pyc +0 -0
- modules/__pycache__/LoRA.cpython-310.pyc +0 -0
- modules/__pycache__/block_requests.cpython-310.pyc +0 -0
- modules/__pycache__/callbacks.cpython-310.pyc +0 -0
- modules/__pycache__/chat.cpython-310.pyc +0 -0
- modules/__pycache__/evaluate.cpython-310.pyc +0 -0
- modules/__pycache__/extensions.cpython-310.pyc +0 -0
- modules/__pycache__/github.cpython-310.pyc +0 -0
- modules/__pycache__/html_generator.cpython-310.pyc +0 -0
- modules/__pycache__/llama_attn_hijack.cpython-310.pyc +0 -0
- modules/__pycache__/loaders.cpython-310.pyc +0 -0
- modules/__pycache__/logging_colors.cpython-310.pyc +0 -0
- modules/__pycache__/models.cpython-310.pyc +0 -0
- modules/__pycache__/models_settings.cpython-310.pyc +0 -0
- modules/__pycache__/presets.cpython-310.pyc +0 -0
- modules/__pycache__/sampler_hijack.cpython-310.pyc +0 -0
- modules/__pycache__/shared.cpython-310.pyc +0 -0
- modules/__pycache__/text_generation.cpython-310.pyc +0 -0
- modules/__pycache__/training.cpython-310.pyc +0 -0
- modules/__pycache__/ui.cpython-310.pyc +0 -0
- modules/__pycache__/utils.cpython-310.pyc +0 -0
- modules/training.py +52 -51
- server.py +2 -2
css/main.css
CHANGED
@@ -57,11 +57,12 @@ ol li p, ul li p {
|
|
57 |
}
|
58 |
|
59 |
/* #main, #parameters, #chat-settings, #lora, #training-tab, #model-tab, #session-tab { */
|
60 |
-
#main{
|
61 |
border: 0;
|
62 |
}
|
63 |
|
64 |
-
#chat-settings, #parameters, #chat-settings, #lora, #training-tab, #model-tab, #session-tab {
|
|
|
65 |
visibility: hidden;
|
66 |
}
|
67 |
|
|
|
57 |
}
|
58 |
|
59 |
/* #main, #parameters, #chat-settings, #lora, #training-tab, #model-tab, #session-tab { */
|
60 |
+
#main, #lora, #training-tab{
|
61 |
border: 0;
|
62 |
}
|
63 |
|
64 |
+
/* #chat-settings, #parameters, #chat-settings, #lora, #training-tab, #model-tab, #session-tab { */
|
65 |
+
#chat-settings, #parameters, #chat-settings, #model-tab, #session-tab {
|
66 |
visibility: hidden;
|
67 |
}
|
68 |
|
extensions/gallery/__pycache__/script.cpython-310.pyc
CHANGED
Binary files a/extensions/gallery/__pycache__/script.cpython-310.pyc and b/extensions/gallery/__pycache__/script.cpython-310.pyc differ
|
|
modules/__pycache__/LoRA.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/LoRA.cpython-310.pyc and b/modules/__pycache__/LoRA.cpython-310.pyc differ
|
|
modules/__pycache__/block_requests.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/block_requests.cpython-310.pyc and b/modules/__pycache__/block_requests.cpython-310.pyc differ
|
|
modules/__pycache__/callbacks.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/callbacks.cpython-310.pyc and b/modules/__pycache__/callbacks.cpython-310.pyc differ
|
|
modules/__pycache__/chat.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/chat.cpython-310.pyc and b/modules/__pycache__/chat.cpython-310.pyc differ
|
|
modules/__pycache__/evaluate.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/evaluate.cpython-310.pyc and b/modules/__pycache__/evaluate.cpython-310.pyc differ
|
|
modules/__pycache__/extensions.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/extensions.cpython-310.pyc and b/modules/__pycache__/extensions.cpython-310.pyc differ
|
|
modules/__pycache__/github.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/github.cpython-310.pyc and b/modules/__pycache__/github.cpython-310.pyc differ
|
|
modules/__pycache__/html_generator.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/html_generator.cpython-310.pyc and b/modules/__pycache__/html_generator.cpython-310.pyc differ
|
|
modules/__pycache__/llama_attn_hijack.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/llama_attn_hijack.cpython-310.pyc and b/modules/__pycache__/llama_attn_hijack.cpython-310.pyc differ
|
|
modules/__pycache__/loaders.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/loaders.cpython-310.pyc and b/modules/__pycache__/loaders.cpython-310.pyc differ
|
|
modules/__pycache__/logging_colors.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/logging_colors.cpython-310.pyc and b/modules/__pycache__/logging_colors.cpython-310.pyc differ
|
|
modules/__pycache__/models.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/models.cpython-310.pyc and b/modules/__pycache__/models.cpython-310.pyc differ
|
|
modules/__pycache__/models_settings.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/models_settings.cpython-310.pyc and b/modules/__pycache__/models_settings.cpython-310.pyc differ
|
|
modules/__pycache__/presets.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/presets.cpython-310.pyc and b/modules/__pycache__/presets.cpython-310.pyc differ
|
|
modules/__pycache__/sampler_hijack.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/sampler_hijack.cpython-310.pyc and b/modules/__pycache__/sampler_hijack.cpython-310.pyc differ
|
|
modules/__pycache__/shared.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/shared.cpython-310.pyc and b/modules/__pycache__/shared.cpython-310.pyc differ
|
|
modules/__pycache__/text_generation.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/text_generation.cpython-310.pyc and b/modules/__pycache__/text_generation.cpython-310.pyc differ
|
|
modules/__pycache__/training.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/training.cpython-310.pyc and b/modules/__pycache__/training.cpython-310.pyc differ
|
|
modules/__pycache__/ui.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/ui.cpython-310.pyc and b/modules/__pycache__/ui.cpython-310.pyc differ
|
|
modules/__pycache__/utils.cpython-310.pyc
CHANGED
Binary files a/modules/__pycache__/utils.cpython-310.pyc and b/modules/__pycache__/utils.cpython-310.pyc differ
|
|
modules/training.py
CHANGED
@@ -66,47 +66,48 @@ PARAMETERS = ["lora_name", "always_override", "save_steps", "micro_batch_size",
|
|
66 |
|
67 |
|
68 |
def create_train_interface():
|
69 |
-
|
70 |
-
with gr.Blocks(
|
71 |
-
|
72 |
-
gr.Markdown("Confused? [[Click here for a guide]](https://github.com/oobabooga/text-generation-webui/blob/main/docs/Training-LoRAs.md)"
|
73 |
-
|
74 |
-
|
75 |
-
with gr.Row(
|
|
|
76 |
lora_name = gr.Textbox(label='Name', info='The name of your new LoRA file')
|
77 |
always_override = gr.Checkbox(label='Override Existing Files', value=False, info='If the name given is the same as an existing file, checking this will replace that file. Leaving unchecked will load that file and continue from it (must use the same rank value as the original had).')
|
78 |
save_steps = gr.Number(label='Save every n steps', value=0, info='If above 0, a checkpoint of the LoRA will be saved every time this many steps pass.')
|
79 |
|
80 |
-
|
81 |
-
with gr.Row(visible=False):
|
82 |
copy_from = gr.Dropdown(label='Copy parameters from', value='None', choices=utils.get_available_loras())
|
83 |
ui.create_refresh_button(copy_from, lambda: None, lambda: {'choices': utils.get_available_loras()}, 'refresh-button')
|
84 |
|
85 |
-
|
86 |
-
with gr.Row(visible=False):
|
87 |
# TODO: Implement multi-device support.
|
88 |
micro_batch_size = gr.Slider(label='Micro Batch Size', value=4, minimum=1, maximum=128, step=1, info='Per-device batch size (NOTE: multiple devices not yet implemented). Increasing this will increase VRAM usage.')
|
89 |
batch_size = gr.Slider(label='Batch Size', value=128, minimum=0, maximum=1024, step=4, info='Global batch size. The two batch sizes together determine gradient accumulation (gradientAccum = batch / microBatch). Higher gradient accum values lead to better quality training.')
|
90 |
|
91 |
-
|
92 |
-
with gr.Row(visible=False):
|
93 |
epochs = gr.Number(label='Epochs', value=3, info='Number of times every entry in the dataset should be fed into training. So 1 means feed each item in once, 5 means feed it in five times, etc.')
|
94 |
learning_rate = gr.Textbox(label='Learning Rate', value='3e-4', info='Learning rate, in scientific notation. 3e-4 is a good starting base point. 1e-2 is extremely high, 1e-6 is extremely low.')
|
95 |
lr_scheduler_type = gr.Dropdown(label='LR Scheduler', value='linear', choices=['linear', 'constant', 'constant_with_warmup', 'cosine', 'cosine_with_restarts', 'polynomial', 'inverse_sqrt'], info='Learning rate scheduler - defines how the learning rate changes over time. "Constant" means never change, "linear" means to go in a straight line from the learning rate down to 0, cosine follows a curve, etc.')
|
96 |
|
97 |
# TODO: What is the actual maximum rank? Likely distinct per model. This might be better to somehow be on a log scale.
|
98 |
-
|
99 |
-
lora_rank = gr.Slider(label='LoRA Rank', value=32, minimum=0, maximum=1024, step=4, info='LoRA Rank, or dimension count. Higher values produce a larger file with better control over the model\'s content. Smaller values produce a smaller file with less overall control. Small values like 4 or 8 are great for stylistic guidance, higher values like 128 or 256 are good for teaching content upgrades, extremely high values (1024+) are difficult to train but may improve fine-detail learning for large datasets. Higher ranks also require higher VRAM.', visible=False)
|
100 |
-
|
101 |
-
lora_alpha = gr.Slider(label='LoRA Alpha', value=64, minimum=0, maximum=2048, step=4, info='LoRA Alpha. This divided by the rank becomes the scaling of the LoRA. Higher means stronger. A good standard value is twice your Rank.', visible=False)
|
102 |
-
|
103 |
-
|
104 |
-
cutoff_len = gr.Slider(label='Cutoff Length', minimum=0, maximum=2048, value=256, step=32, info='Cutoff length for text input. Essentially, how long of a line of text to feed in at a time. Higher values require drastically more VRAM.', visible=False)
|
105 |
-
|
106 |
-
|
107 |
-
with gr.Blocks(visible=False):
|
108 |
-
|
109 |
-
with gr.Row(visible=False):
|
110 |
dataset = gr.Dropdown(choices=utils.get_datasets('training/datasets', 'json'), value='None', label='Dataset', info='The dataset file to use for training.')
|
111 |
ui.create_refresh_button(dataset, lambda: None, lambda: {'choices': utils.get_datasets('training/datasets', 'json')}, 'refresh-button')
|
112 |
eval_dataset = gr.Dropdown(choices=utils.get_datasets('training/datasets', 'json'), value='None', label='Evaluation Dataset', info='The (optional) dataset file used to evaluate the model after training.')
|
@@ -117,22 +118,22 @@ def create_train_interface():
|
|
117 |
# eval_steps = gr.Number(label='Evaluate every n steps', value=100, info='If an evaluation dataset is given, test it every time this many steps pass.')
|
118 |
eval_steps = gr.Number(label='Evaluate every n steps', value=100, info='If an evaluation dataset is given, test it every time this many steps pass.', visible=False)
|
119 |
|
120 |
-
|
121 |
-
with gr.Blocks(visible=False):
|
122 |
-
|
123 |
-
with gr.Row(visible=False):
|
124 |
raw_text_file = gr.Dropdown(choices=utils.get_datasets('training/datasets', 'txt'), value='None', label='Text file', info='The raw text file to use for training.')
|
125 |
ui.create_refresh_button(raw_text_file, lambda: None, lambda: {'choices': utils.get_datasets('training/datasets', 'txt')}, 'refresh-button')
|
126 |
hard_cut_string = gr.Textbox(label='Hard Cut String', value='\\n\\n\\n', info='String that indicates a hard cut between text parts. Helps prevent unwanted overlap.')
|
127 |
min_chars = gr.Number(label='Ignore small blocks', value=0, info='Ignore Hard Cut blocks that have less or equal characters than this number')
|
128 |
|
129 |
-
|
130 |
-
with gr.Row(visible=False):
|
131 |
overlap_len = gr.Slider(label='Overlap Length', minimum=0, maximum=512, value=128, step=16, info='Overlap length - ie how many tokens from the prior chunk of text to include into the next chunk. (The chunks themselves will be of a size determined by Cutoff Length below). Setting overlap to exactly half the cutoff length may be ideal.')
|
132 |
newline_favor_len = gr.Slider(label='Prefer Newline Cut Length', minimum=0, maximum=512, value=128, step=16, info='Length (in characters, not tokens) of the maximum distance to shift an overlap cut by to ensure chunks cut at newlines. If too low, cuts may occur in the middle of lines.')
|
133 |
|
134 |
-
|
135 |
-
with gr.Accordion(label='Advanced Options', open=False, visible=False):
|
136 |
lora_dropout = gr.Slider(label='LoRA Dropout', minimum=0.0, maximum=1.0, step=0.025, value=0.05, info='Percentage probability for dropout of LoRA layers. This can help reduce overfitting. Most users should leave at default.')
|
137 |
warmup_steps = gr.Number(label='Warmup Steps', value=100, info='For this many steps at the start, the learning rate will be lower than normal. This helps the trainer prepare the model and precompute statistics to improve the quality of training after the start.')
|
138 |
optimizer = gr.Dropdown(label='Optimizer', value='adamw_torch', choices=['adamw_hf', 'adamw_torch', 'adamw_torch_fused', 'adamw_torch_xla', 'adamw_apex_fused', 'adafactor', 'adamw_bnb_8bit', 'adamw_anyprecision', 'sgd', 'adagrad'], info='Different optimizer implementation options, for advanced users. Effects of different options are not well documented yet.')
|
@@ -145,41 +146,41 @@ def create_train_interface():
|
|
145 |
with gr.Row():
|
146 |
report_to = gr.Radio(label="Save detailed logs with", value="None", choices=["None", "wandb", "tensorboard"], interactive=True)
|
147 |
|
148 |
-
|
149 |
-
with gr.Row(visible=False):
|
150 |
start_button = gr.Button("Start LoRA Training")
|
151 |
stop_button = gr.Button("Interrupt")
|
152 |
|
153 |
-
|
154 |
-
output = gr.Markdown(value="Ready", visible=False)
|
155 |
|
156 |
-
|
157 |
-
with gr.Blocks(visible=False):
|
158 |
-
|
159 |
-
with gr.Row(visible=False):
|
160 |
-
|
161 |
-
with gr.Column(visible=False):
|
162 |
models = gr.Dropdown(utils.get_available_models(), label='Models', multiselect=True)
|
163 |
evaluate_text_file = gr.Dropdown(choices=['wikitext', 'ptb', 'ptb_new'] + utils.get_datasets('training/datasets', 'txt')[1:], value='wikitext', label='Input dataset', info='The raw text file on which the model will be evaluated. The first options are automatically downloaded: wikitext, ptb, and ptb_new. The next options are your local text files under training/datasets.')
|
164 |
-
|
165 |
-
with gr.Row(visible=False):
|
166 |
stride_length = gr.Slider(label='Stride', minimum=1, maximum=2048, value=512, step=1, info='Used to make the evaluation faster at the cost of accuracy. 1 = slowest but most accurate. 512 is a common value.')
|
167 |
max_length = gr.Slider(label='max_length', minimum=0, maximum=8096, value=0, step=1, info='The context for each evaluation. If set to 0, the maximum context length for the model will be used.')
|
168 |
|
169 |
-
|
170 |
-
with gr.Row(visible=False):
|
171 |
start_current_evaluation = gr.Button("Evaluate loaded model")
|
172 |
start_evaluation = gr.Button("Evaluate selected models")
|
173 |
stop_evaluation = gr.Button("Interrupt")
|
174 |
|
175 |
-
|
176 |
-
with gr.Column(visible=False):
|
177 |
evaluation_log = gr.Markdown(value='')
|
178 |
|
179 |
# evaluation_table = gr.Dataframe(value=generate_markdown_table(), interactive=True)
|
180 |
evaluation_table = gr.Dataframe(value=generate_markdown_table(), interactive=True, visible=False)
|
181 |
-
|
182 |
-
with gr.Row(visible=False):
|
183 |
# save_comments = gr.Button('Save comments', elem_classes="small-button")
|
184 |
save_comments = gr.Button('Save comments', elem_classes="small-button", visible=False)
|
185 |
# refresh_table = gr.Button('Refresh the table', elem_classes="small-button")
|
|
|
66 |
|
67 |
|
68 |
def create_train_interface():
|
69 |
+
with gr.Tab('Train LoRA', elem_id='lora-train-tab'):
|
70 |
+
# with gr.Blocks():
|
71 |
+
# with gr.Blocks(visible=False):
|
72 |
+
gr.Markdown("Confused? [[Click here for a guide]](https://github.com/oobabooga/text-generation-webui/blob/main/docs/Training-LoRAs.md)")
|
73 |
+
# gr.Markdown("Confused? [[Click here for a guide]](https://github.com/oobabooga/text-generation-webui/blob/main/docs/Training-LoRAs.md)", visible=False)
|
74 |
+
|
75 |
+
with gr.Row():
|
76 |
+
# with gr.Row(visible=False):
|
77 |
lora_name = gr.Textbox(label='Name', info='The name of your new LoRA file')
|
78 |
always_override = gr.Checkbox(label='Override Existing Files', value=False, info='If the name given is the same as an existing file, checking this will replace that file. Leaving unchecked will load that file and continue from it (must use the same rank value as the original had).')
|
79 |
save_steps = gr.Number(label='Save every n steps', value=0, info='If above 0, a checkpoint of the LoRA will be saved every time this many steps pass.')
|
80 |
|
81 |
+
with gr.Row():
|
82 |
+
# with gr.Row(visible=False):
|
83 |
copy_from = gr.Dropdown(label='Copy parameters from', value='None', choices=utils.get_available_loras())
|
84 |
ui.create_refresh_button(copy_from, lambda: None, lambda: {'choices': utils.get_available_loras()}, 'refresh-button')
|
85 |
|
86 |
+
with gr.Row():
|
87 |
+
# with gr.Row(visible=False):
|
88 |
# TODO: Implement multi-device support.
|
89 |
micro_batch_size = gr.Slider(label='Micro Batch Size', value=4, minimum=1, maximum=128, step=1, info='Per-device batch size (NOTE: multiple devices not yet implemented). Increasing this will increase VRAM usage.')
|
90 |
batch_size = gr.Slider(label='Batch Size', value=128, minimum=0, maximum=1024, step=4, info='Global batch size. The two batch sizes together determine gradient accumulation (gradientAccum = batch / microBatch). Higher gradient accum values lead to better quality training.')
|
91 |
|
92 |
+
with gr.Row():
|
93 |
+
# with gr.Row(visible=False):
|
94 |
epochs = gr.Number(label='Epochs', value=3, info='Number of times every entry in the dataset should be fed into training. So 1 means feed each item in once, 5 means feed it in five times, etc.')
|
95 |
learning_rate = gr.Textbox(label='Learning Rate', value='3e-4', info='Learning rate, in scientific notation. 3e-4 is a good starting base point. 1e-2 is extremely high, 1e-6 is extremely low.')
|
96 |
lr_scheduler_type = gr.Dropdown(label='LR Scheduler', value='linear', choices=['linear', 'constant', 'constant_with_warmup', 'cosine', 'cosine_with_restarts', 'polynomial', 'inverse_sqrt'], info='Learning rate scheduler - defines how the learning rate changes over time. "Constant" means never change, "linear" means to go in a straight line from the learning rate down to 0, cosine follows a curve, etc.')
|
97 |
|
98 |
# TODO: What is the actual maximum rank? Likely distinct per model. This might be better to somehow be on a log scale.
|
99 |
+
lora_rank = gr.Slider(label='LoRA Rank', value=32, minimum=0, maximum=1024, step=4, info='LoRA Rank, or dimension count. Higher values produce a larger file with better control over the model\'s content. Smaller values produce a smaller file with less overall control. Small values like 4 or 8 are great for stylistic guidance, higher values like 128 or 256 are good for teaching content upgrades, extremely high values (1024+) are difficult to train but may improve fine-detail learning for large datasets. Higher ranks also require higher VRAM.')
|
100 |
+
# lora_rank = gr.Slider(label='LoRA Rank', value=32, minimum=0, maximum=1024, step=4, info='LoRA Rank, or dimension count. Higher values produce a larger file with better control over the model\'s content. Smaller values produce a smaller file with less overall control. Small values like 4 or 8 are great for stylistic guidance, higher values like 128 or 256 are good for teaching content upgrades, extremely high values (1024+) are difficult to train but may improve fine-detail learning for large datasets. Higher ranks also require higher VRAM.', visible=False)
|
101 |
+
lora_alpha = gr.Slider(label='LoRA Alpha', value=64, minimum=0, maximum=2048, step=4, info='LoRA Alpha. This divided by the rank becomes the scaling of the LoRA. Higher means stronger. A good standard value is twice your Rank.')
|
102 |
+
# lora_alpha = gr.Slider(label='LoRA Alpha', value=64, minimum=0, maximum=2048, step=4, info='LoRA Alpha. This divided by the rank becomes the scaling of the LoRA. Higher means stronger. A good standard value is twice your Rank.', visible=False)
|
103 |
+
|
104 |
+
cutoff_len = gr.Slider(label='Cutoff Length', minimum=0, maximum=2048, value=256, step=32, info='Cutoff length for text input. Essentially, how long of a line of text to feed in at a time. Higher values require drastically more VRAM.')
|
105 |
+
# cutoff_len = gr.Slider(label='Cutoff Length', minimum=0, maximum=2048, value=256, step=32, info='Cutoff length for text input. Essentially, how long of a line of text to feed in at a time. Higher values require drastically more VRAM.', visible=False)
|
106 |
+
|
107 |
+
with gr.Tab(label='Formatted Dataset'):
|
108 |
+
# with gr.Blocks(visible=False):
|
109 |
+
with gr.Row():
|
110 |
+
# with gr.Row(visible=False):
|
111 |
dataset = gr.Dropdown(choices=utils.get_datasets('training/datasets', 'json'), value='None', label='Dataset', info='The dataset file to use for training.')
|
112 |
ui.create_refresh_button(dataset, lambda: None, lambda: {'choices': utils.get_datasets('training/datasets', 'json')}, 'refresh-button')
|
113 |
eval_dataset = gr.Dropdown(choices=utils.get_datasets('training/datasets', 'json'), value='None', label='Evaluation Dataset', info='The (optional) dataset file used to evaluate the model after training.')
|
|
|
118 |
# eval_steps = gr.Number(label='Evaluate every n steps', value=100, info='If an evaluation dataset is given, test it every time this many steps pass.')
|
119 |
eval_steps = gr.Number(label='Evaluate every n steps', value=100, info='If an evaluation dataset is given, test it every time this many steps pass.', visible=False)
|
120 |
|
121 |
+
with gr.Tab(label="Raw text file"):
|
122 |
+
# with gr.Blocks(visible=False):
|
123 |
+
with gr.Row():
|
124 |
+
# with gr.Row(visible=False):
|
125 |
raw_text_file = gr.Dropdown(choices=utils.get_datasets('training/datasets', 'txt'), value='None', label='Text file', info='The raw text file to use for training.')
|
126 |
ui.create_refresh_button(raw_text_file, lambda: None, lambda: {'choices': utils.get_datasets('training/datasets', 'txt')}, 'refresh-button')
|
127 |
hard_cut_string = gr.Textbox(label='Hard Cut String', value='\\n\\n\\n', info='String that indicates a hard cut between text parts. Helps prevent unwanted overlap.')
|
128 |
min_chars = gr.Number(label='Ignore small blocks', value=0, info='Ignore Hard Cut blocks that have less or equal characters than this number')
|
129 |
|
130 |
+
with gr.Row():
|
131 |
+
# with gr.Row(visible=False):
|
132 |
overlap_len = gr.Slider(label='Overlap Length', minimum=0, maximum=512, value=128, step=16, info='Overlap length - ie how many tokens from the prior chunk of text to include into the next chunk. (The chunks themselves will be of a size determined by Cutoff Length below). Setting overlap to exactly half the cutoff length may be ideal.')
|
133 |
newline_favor_len = gr.Slider(label='Prefer Newline Cut Length', minimum=0, maximum=512, value=128, step=16, info='Length (in characters, not tokens) of the maximum distance to shift an overlap cut by to ensure chunks cut at newlines. If too low, cuts may occur in the middle of lines.')
|
134 |
|
135 |
+
with gr.Accordion(label='Advanced Options', open=False):
|
136 |
+
# with gr.Accordion(label='Advanced Options', open=False, visible=False):
|
137 |
lora_dropout = gr.Slider(label='LoRA Dropout', minimum=0.0, maximum=1.0, step=0.025, value=0.05, info='Percentage probability for dropout of LoRA layers. This can help reduce overfitting. Most users should leave at default.')
|
138 |
warmup_steps = gr.Number(label='Warmup Steps', value=100, info='For this many steps at the start, the learning rate will be lower than normal. This helps the trainer prepare the model and precompute statistics to improve the quality of training after the start.')
|
139 |
optimizer = gr.Dropdown(label='Optimizer', value='adamw_torch', choices=['adamw_hf', 'adamw_torch', 'adamw_torch_fused', 'adamw_torch_xla', 'adamw_apex_fused', 'adafactor', 'adamw_bnb_8bit', 'adamw_anyprecision', 'sgd', 'adagrad'], info='Different optimizer implementation options, for advanced users. Effects of different options are not well documented yet.')
|
|
|
146 |
with gr.Row():
|
147 |
report_to = gr.Radio(label="Save detailed logs with", value="None", choices=["None", "wandb", "tensorboard"], interactive=True)
|
148 |
|
149 |
+
with gr.Row():
|
150 |
+
# with gr.Row(visible=False):
|
151 |
start_button = gr.Button("Start LoRA Training")
|
152 |
stop_button = gr.Button("Interrupt")
|
153 |
|
154 |
+
output = gr.Markdown(value="Ready")
|
155 |
+
# output = gr.Markdown(value="Ready", visible=False)
|
156 |
|
157 |
+
with gr.Tab('Perplexity evaluation', elem_id='evaluate-tab'):
|
158 |
+
# with gr.Blocks(visible=False):
|
159 |
+
with gr.Row():
|
160 |
+
# with gr.Row(visible=False):
|
161 |
+
with gr.Column():
|
162 |
+
# with gr.Column(visible=False):
|
163 |
models = gr.Dropdown(utils.get_available_models(), label='Models', multiselect=True)
|
164 |
evaluate_text_file = gr.Dropdown(choices=['wikitext', 'ptb', 'ptb_new'] + utils.get_datasets('training/datasets', 'txt')[1:], value='wikitext', label='Input dataset', info='The raw text file on which the model will be evaluated. The first options are automatically downloaded: wikitext, ptb, and ptb_new. The next options are your local text files under training/datasets.')
|
165 |
+
with gr.Row():
|
166 |
+
# with gr.Row(visible=False):
|
167 |
stride_length = gr.Slider(label='Stride', minimum=1, maximum=2048, value=512, step=1, info='Used to make the evaluation faster at the cost of accuracy. 1 = slowest but most accurate. 512 is a common value.')
|
168 |
max_length = gr.Slider(label='max_length', minimum=0, maximum=8096, value=0, step=1, info='The context for each evaluation. If set to 0, the maximum context length for the model will be used.')
|
169 |
|
170 |
+
with gr.Row():
|
171 |
+
# with gr.Row(visible=False):
|
172 |
start_current_evaluation = gr.Button("Evaluate loaded model")
|
173 |
start_evaluation = gr.Button("Evaluate selected models")
|
174 |
stop_evaluation = gr.Button("Interrupt")
|
175 |
|
176 |
+
with gr.Column():
|
177 |
+
# with gr.Column(visible=False):
|
178 |
evaluation_log = gr.Markdown(value='')
|
179 |
|
180 |
# evaluation_table = gr.Dataframe(value=generate_markdown_table(), interactive=True)
|
181 |
evaluation_table = gr.Dataframe(value=generate_markdown_table(), interactive=True, visible=False)
|
182 |
+
with gr.Row():
|
183 |
+
# with gr.Row(visible=False):
|
184 |
# save_comments = gr.Button('Save comments', elem_classes="small-button")
|
185 |
save_comments = gr.Button('Save comments', elem_classes="small-button", visible=False)
|
186 |
# refresh_table = gr.Button('Refresh the table', elem_classes="small-button")
|
server.py
CHANGED
@@ -831,8 +831,8 @@ def create_interface():
|
|
831 |
create_model_menus()
|
832 |
|
833 |
# Training tab
|
834 |
-
|
835 |
-
with gr.Blocks(visible=False):
|
836 |
training.create_train_interface()
|
837 |
|
838 |
# Session tab
|
|
|
831 |
create_model_menus()
|
832 |
|
833 |
# Training tab
|
834 |
+
with gr.Tab("Training", elem_id="training-tab"):
|
835 |
+
# with gr.Blocks(visible=False):
|
836 |
training.create_train_interface()
|
837 |
|
838 |
# Session tab
|