alozowski HF staff commited on
Commit
711437e
1 Parent(s): 86f67bc

fix-base-model-submission (#901)

Browse files

- Base model only for Delta or Adapter (0d97e085e758bc706a0efb15bd9609800e33265b)

Files changed (1) hide show
  1. app.py +21 -2
app.py CHANGED
@@ -259,10 +259,10 @@ with main_block:
259
  choices=[i.value.name for i in WeightType],
260
  label="Weights type",
261
  multiselect=False,
262
- value="Original",
263
  interactive=True,
264
  )
265
- base_model_name_textbox = gr.Textbox(label="Base model (for delta or adapter weights)")
266
 
267
  with gr.Column():
268
  with gr.Accordion(
@@ -316,6 +316,25 @@ with main_block:
316
  outputs=chat_template_toggle,
317
  )
318
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
319
  submit_button.click(
320
  add_new_eval,
321
  [
 
259
  choices=[i.value.name for i in WeightType],
260
  label="Weights type",
261
  multiselect=False,
262
+ value=WeightType.Original.value.name,
263
  interactive=True,
264
  )
265
+ base_model_name_textbox = gr.Textbox(label="Base model (for delta or adapter weights)", interactive=False)
266
 
267
  with gr.Column():
268
  with gr.Accordion(
 
316
  outputs=chat_template_toggle,
317
  )
318
 
319
+ # The base_model_name_textbox interactivity and value reset function
320
+ def update_base_model_name_textbox(weight_type_value):
321
+ # Convert the dropdown value back to the corresponding WeightType Enum
322
+ weight_type_enum = WeightType[weight_type_value]
323
+
324
+ # Determine if the textbox should be interactive
325
+ interactive = weight_type_enum in [WeightType.Adapter, WeightType.Delta]
326
+
327
+ # Reset the value if weight type is "Original"
328
+ reset_value = "" if not interactive else None
329
+
330
+ return gr.update(interactive=interactive, value=reset_value)
331
+
332
+ weight_type.change(
333
+ fn=update_base_model_name_textbox,
334
+ inputs=[weight_type],
335
+ outputs=[base_model_name_textbox],
336
+ )
337
+
338
  submit_button.click(
339
  add_new_eval,
340
  [