Spaces:
Runtime error
Runtime error
Merge branch 'main' into dev-2
Browse files- llama_lora/ui/finetune_ui.py +12 -9
llama_lora/ui/finetune_ui.py
CHANGED
|
@@ -125,9 +125,6 @@ def get_data_from_input(load_dataset_from, dataset_text, dataset_text_format,
|
|
| 125 |
return data
|
| 126 |
|
| 127 |
|
| 128 |
-
max_preview_count = 30
|
| 129 |
-
|
| 130 |
-
|
| 131 |
def refresh_preview(
|
| 132 |
template,
|
| 133 |
load_dataset_from,
|
|
@@ -137,7 +134,7 @@ def refresh_preview(
|
|
| 137 |
dataset_plain_text_input_variables_separator,
|
| 138 |
dataset_plain_text_input_and_output_separator,
|
| 139 |
dataset_plain_text_data_separator,
|
| 140 |
-
|
| 141 |
):
|
| 142 |
try:
|
| 143 |
prompter = Prompter(template)
|
|
@@ -157,6 +154,8 @@ def refresh_preview(
|
|
| 157 |
train_data = prompter.get_train_data_from_dataset(
|
| 158 |
data, max_preview_count)
|
| 159 |
|
|
|
|
|
|
|
| 160 |
data_count = len(data)
|
| 161 |
|
| 162 |
headers = ['Prompt', 'Completion']
|
|
@@ -199,7 +198,7 @@ def refresh_dataset_items_count(
|
|
| 199 |
dataset_plain_text_input_variables_separator,
|
| 200 |
dataset_plain_text_input_and_output_separator,
|
| 201 |
dataset_plain_text_data_separator,
|
| 202 |
-
|
| 203 |
):
|
| 204 |
try:
|
| 205 |
prompter = Prompter(template)
|
|
@@ -609,9 +608,13 @@ def finetune_ui():
|
|
| 609 |
"Set the dataset in the \"Prepare\" tab, then preview it here.",
|
| 610 |
elem_id="finetune_dataset_preview_info_message"
|
| 611 |
)
|
| 612 |
-
|
| 613 |
-
label="
|
| 614 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 615 |
)
|
| 616 |
finetune_dataset_preview = gr.Dataframe(
|
| 617 |
wrap=True, elem_id="finetune_dataset_preview")
|
|
@@ -636,7 +639,7 @@ def finetune_ui():
|
|
| 636 |
dataset_plain_text_data_separator,
|
| 637 |
]
|
| 638 |
dataset_preview_inputs = dataset_inputs + \
|
| 639 |
-
[
|
| 640 |
for i in dataset_preview_inputs:
|
| 641 |
things_that_might_timeout.append(
|
| 642 |
i.change(
|
|
|
|
| 125 |
return data
|
| 126 |
|
| 127 |
|
|
|
|
|
|
|
|
|
|
| 128 |
def refresh_preview(
|
| 129 |
template,
|
| 130 |
load_dataset_from,
|
|
|
|
| 134 |
dataset_plain_text_input_variables_separator,
|
| 135 |
dataset_plain_text_input_and_output_separator,
|
| 136 |
dataset_plain_text_data_separator,
|
| 137 |
+
max_preview_count,
|
| 138 |
):
|
| 139 |
try:
|
| 140 |
prompter = Prompter(template)
|
|
|
|
| 154 |
train_data = prompter.get_train_data_from_dataset(
|
| 155 |
data, max_preview_count)
|
| 156 |
|
| 157 |
+
train_data = train_data[:max_preview_count]
|
| 158 |
+
|
| 159 |
data_count = len(data)
|
| 160 |
|
| 161 |
headers = ['Prompt', 'Completion']
|
|
|
|
| 198 |
dataset_plain_text_input_variables_separator,
|
| 199 |
dataset_plain_text_input_and_output_separator,
|
| 200 |
dataset_plain_text_data_separator,
|
| 201 |
+
max_preview_count,
|
| 202 |
):
|
| 203 |
try:
|
| 204 |
prompter = Prompter(template)
|
|
|
|
| 608 |
"Set the dataset in the \"Prepare\" tab, then preview it here.",
|
| 609 |
elem_id="finetune_dataset_preview_info_message"
|
| 610 |
)
|
| 611 |
+
finetune_dataset_preview_count = gr.Number(
|
| 612 |
+
label="Preview items count",
|
| 613 |
+
value=10,
|
| 614 |
+
# minimum=1,
|
| 615 |
+
# maximum=100,
|
| 616 |
+
precision=0,
|
| 617 |
+
elem_id="finetune_dataset_preview_count"
|
| 618 |
)
|
| 619 |
finetune_dataset_preview = gr.Dataframe(
|
| 620 |
wrap=True, elem_id="finetune_dataset_preview")
|
|
|
|
| 639 |
dataset_plain_text_data_separator,
|
| 640 |
]
|
| 641 |
dataset_preview_inputs = dataset_inputs + \
|
| 642 |
+
[finetune_dataset_preview_count]
|
| 643 |
for i in dataset_preview_inputs:
|
| 644 |
things_that_might_timeout.append(
|
| 645 |
i.change(
|