Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -876,8 +876,9 @@ with gr.Blocks(title="HuggingFace SFT Trainer Studio", theme="gradio/soft", css=
|
|
| 876 |
uploads = gr.Files(label="Subir datasets locales (csv/json/jsonl/txt)", file_count="multiple", type="binary")
|
| 877 |
|
| 878 |
with gr.Accordion("⚙️ Parámetros Avanzados", open=False):
|
| 879 |
-
with gr.Tabs():
|
| 880 |
-
|
|
|
|
| 881 |
scratch_group = gr.Group(visible=False)
|
| 882 |
with scratch_group:
|
| 883 |
auto_config_scratch = gr.Checkbox(
|
|
@@ -917,7 +918,7 @@ with gr.Blocks(title="HuggingFace SFT Trainer Studio", theme="gradio/soft", css=
|
|
| 917 |
with gr.Row():
|
| 918 |
scratch_tie_word_embeddings = gr.Checkbox(label="tie_word_embeddings", value=False)
|
| 919 |
|
| 920 |
-
with gr.TabItem("Opciones Generales (Trainer)"):
|
| 921 |
general_group = gr.Group(visible=True)
|
| 922 |
with general_group:
|
| 923 |
with gr.Row():
|
|
@@ -941,7 +942,7 @@ with gr.Blocks(title="HuggingFace SFT Trainer Studio", theme="gradio/soft", css=
|
|
| 941 |
quantization = gr.Textbox(label="quantization", value="int4", placeholder="none, int8 o int4", info="Ignorado si 'Entrenar desde Cero' está activo.")
|
| 942 |
scheduler = gr.Textbox(label="scheduler", value="cosine", placeholder="linear, cosine o constant")
|
| 943 |
|
| 944 |
-
with gr.TabItem("Hiperparámetros Numéricos"):
|
| 945 |
numeric_group = gr.Group(visible=True)
|
| 946 |
with numeric_group:
|
| 947 |
with gr.Row():
|
|
@@ -960,7 +961,7 @@ with gr.Blocks(title="HuggingFace SFT Trainer Studio", theme="gradio/soft", css=
|
|
| 960 |
warmup_ratio = gr.Number(value=0.05, label="warmup_ratio")
|
| 961 |
weight_decay = gr.Number(value=0.01, label="weight_decay")
|
| 962 |
|
| 963 |
-
with gr.TabItem("PEFT / LoRA"):
|
| 964 |
peft_group = gr.Group(visible=True)
|
| 965 |
with peft_group:
|
| 966 |
gr.Markdown("#### PEFT / LoRA (Ignorado si 'Entrenar desde Cero' está activo o `peft` está deshabilitado)")
|
|
@@ -970,7 +971,7 @@ with gr.Blocks(title="HuggingFace SFT Trainer Studio", theme="gradio/soft", css=
|
|
| 970 |
lora_dropout = gr.Number(value=0.05, label="lora_dropout")
|
| 971 |
target_modules = gr.Textbox(value="q_proj,k_proj,v_proj,o_proj", placeholder="Ej: all-linear o q_proj,v_proj", label="target_modules (Separados por coma)")
|
| 972 |
|
| 973 |
-
with gr.TabItem("Configuración del Modelo (Carga)"):
|
| 974 |
load_config_group = gr.Group(visible=True)
|
| 975 |
with load_config_group:
|
| 976 |
gr.Markdown("#### Configuración del Modelo (Carga - Ignorado si 'Entrenar desde Cero' está activo)")
|
|
@@ -980,7 +981,7 @@ with gr.Blocks(title="HuggingFace SFT Trainer Studio", theme="gradio/soft", css=
|
|
| 980 |
with gr.Row():
|
| 981 |
new_special_tokens_input = gr.Textbox(label="Nuevos tokens especiales (coma-separado)", placeholder="<|im_start|>, <|im_end|>, <|system|>", info="Añadir tokens al vocabulario. Redimensiona embeddings.")
|
| 982 |
|
| 983 |
-
with gr.TabItem("Formato de Datos (Razonamiento)"):
|
| 984 |
cot_group = gr.Group(visible=True)
|
| 985 |
with cot_group:
|
| 986 |
with gr.Row():
|
|
@@ -992,14 +993,14 @@ with gr.Blocks(title="HuggingFace SFT Trainer Studio", theme="gradio/soft", css=
|
|
| 992 |
with gr.Row():
|
| 993 |
response_col_input = gr.Textbox(label="Columna de Respuesta", value="response", info="Nombre de la columna con la respuesta final.")
|
| 994 |
|
| 995 |
-
with gr.TabItem("Normalización de Texto (Datos)"):
|
| 996 |
normalization_group = gr.Group(visible=True)
|
| 997 |
with normalization_group:
|
| 998 |
with gr.Row():
|
| 999 |
apply_lowercase_input = gr.Checkbox(label="Aplicar minúsculas", value=False, info="Convierte todo el texto a minúsculas antes de tokenizar.")
|
| 1000 |
remove_punctuation_input = gr.Checkbox(label="Eliminar puntuación", value=False, info="Elimina signos de puntuación del texto antes de tokenizar.")
|
| 1001 |
|
| 1002 |
-
with gr.TabItem("Logging (Weights & Biases)"):
|
| 1003 |
wandb_group = gr.Group(visible=True)
|
| 1004 |
with wandb_group:
|
| 1005 |
with gr.Row():
|
|
@@ -1010,12 +1011,15 @@ with gr.Blocks(title="HuggingFace SFT Trainer Studio", theme="gradio/soft", css=
|
|
| 1010 |
def toggle_scratch_config(scratch_checked):
|
| 1011 |
scratch_visible = scratch_checked
|
| 1012 |
finetune_visible = not scratch_checked
|
| 1013 |
-
|
|
|
|
| 1014 |
model_base_input: gr.Textbox(visible=finetune_visible),
|
| 1015 |
scratch_group: gr.Group(visible=scratch_visible),
|
| 1016 |
peft_group: gr.Group(visible=finetune_visible),
|
| 1017 |
load_config_group: gr.Group(visible=finetune_visible),
|
| 1018 |
}
|
|
|
|
|
|
|
| 1019 |
|
| 1020 |
train_from_scratch.change(
|
| 1021 |
fn=toggle_scratch_config,
|
|
|
|
| 876 |
uploads = gr.Files(label="Subir datasets locales (csv/json/jsonl/txt)", file_count="multiple", type="binary")
|
| 877 |
|
| 878 |
with gr.Accordion("⚙️ Parámetros Avanzados", open=False):
|
| 879 |
+
with gr.Tabs() as tabs_advanced:
|
| 880 |
+
|
| 881 |
+
with gr.TabItem("Arquitectura (Desde Cero)", id="tab_scratch"):
|
| 882 |
scratch_group = gr.Group(visible=False)
|
| 883 |
with scratch_group:
|
| 884 |
auto_config_scratch = gr.Checkbox(
|
|
|
|
| 918 |
with gr.Row():
|
| 919 |
scratch_tie_word_embeddings = gr.Checkbox(label="tie_word_embeddings", value=False)
|
| 920 |
|
| 921 |
+
with gr.TabItem("Opciones Generales (Trainer)", id="tab_general"):
|
| 922 |
general_group = gr.Group(visible=True)
|
| 923 |
with general_group:
|
| 924 |
with gr.Row():
|
|
|
|
| 942 |
quantization = gr.Textbox(label="quantization", value="int4", placeholder="none, int8 o int4", info="Ignorado si 'Entrenar desde Cero' está activo.")
|
| 943 |
scheduler = gr.Textbox(label="scheduler", value="cosine", placeholder="linear, cosine o constant")
|
| 944 |
|
| 945 |
+
with gr.TabItem("Hiperparámetros Numéricos", id="tab_numeric"):
|
| 946 |
numeric_group = gr.Group(visible=True)
|
| 947 |
with numeric_group:
|
| 948 |
with gr.Row():
|
|
|
|
| 961 |
warmup_ratio = gr.Number(value=0.05, label="warmup_ratio")
|
| 962 |
weight_decay = gr.Number(value=0.01, label="weight_decay")
|
| 963 |
|
| 964 |
+
with gr.TabItem("PEFT / LoRA", id="tab_peft"):
|
| 965 |
peft_group = gr.Group(visible=True)
|
| 966 |
with peft_group:
|
| 967 |
gr.Markdown("#### PEFT / LoRA (Ignorado si 'Entrenar desde Cero' está activo o `peft` está deshabilitado)")
|
|
|
|
| 971 |
lora_dropout = gr.Number(value=0.05, label="lora_dropout")
|
| 972 |
target_modules = gr.Textbox(value="q_proj,k_proj,v_proj,o_proj", placeholder="Ej: all-linear o q_proj,v_proj", label="target_modules (Separados por coma)")
|
| 973 |
|
| 974 |
+
with gr.TabItem("Configuración del Modelo (Carga)", id="tab_load"):
|
| 975 |
load_config_group = gr.Group(visible=True)
|
| 976 |
with load_config_group:
|
| 977 |
gr.Markdown("#### Configuración del Modelo (Carga - Ignorado si 'Entrenar desde Cero' está activo)")
|
|
|
|
| 981 |
with gr.Row():
|
| 982 |
new_special_tokens_input = gr.Textbox(label="Nuevos tokens especiales (coma-separado)", placeholder="<|im_start|>, <|im_end|>, <|system|>", info="Añadir tokens al vocabulario. Redimensiona embeddings.")
|
| 983 |
|
| 984 |
+
with gr.TabItem("Formato de Datos (Razonamiento)", id="tab_cot"):
|
| 985 |
cot_group = gr.Group(visible=True)
|
| 986 |
with cot_group:
|
| 987 |
with gr.Row():
|
|
|
|
| 993 |
with gr.Row():
|
| 994 |
response_col_input = gr.Textbox(label="Columna de Respuesta", value="response", info="Nombre de la columna con la respuesta final.")
|
| 995 |
|
| 996 |
+
with gr.TabItem("Normalización de Texto (Datos)", id="tab_norm"):
|
| 997 |
normalization_group = gr.Group(visible=True)
|
| 998 |
with normalization_group:
|
| 999 |
with gr.Row():
|
| 1000 |
apply_lowercase_input = gr.Checkbox(label="Aplicar minúsculas", value=False, info="Convierte todo el texto a minúsculas antes de tokenizar.")
|
| 1001 |
remove_punctuation_input = gr.Checkbox(label="Eliminar puntuación", value=False, info="Elimina signos de puntuación del texto antes de tokenizar.")
|
| 1002 |
|
| 1003 |
+
with gr.TabItem("Logging (Weights & Biases)", id="tab_wandb"):
|
| 1004 |
wandb_group = gr.Group(visible=True)
|
| 1005 |
with wandb_group:
|
| 1006 |
with gr.Row():
|
|
|
|
| 1011 |
def toggle_scratch_config(scratch_checked):
|
| 1012 |
scratch_visible = scratch_checked
|
| 1013 |
finetune_visible = not scratch_checked
|
| 1014 |
+
|
| 1015 |
+
updates = {
|
| 1016 |
model_base_input: gr.Textbox(visible=finetune_visible),
|
| 1017 |
scratch_group: gr.Group(visible=scratch_visible),
|
| 1018 |
peft_group: gr.Group(visible=finetune_visible),
|
| 1019 |
load_config_group: gr.Group(visible=finetune_visible),
|
| 1020 |
}
|
| 1021 |
+
|
| 1022 |
+
return updates
|
| 1023 |
|
| 1024 |
train_from_scratch.change(
|
| 1025 |
fn=toggle_scratch_config,
|