3v324v23 Claude commited on
Commit
b810d56
·
1 Parent(s): b817c98

Unpack arch fields into fetch_arch / load_preset returns

Browse files

Returning the 12-field list as a single element gave Gradio N+1
outputs but only 2 returned values ("didn't return enough output
values"). Spread the list with * so each field maps to its own
component. Same fix for load_preset (12 arch fields + status).

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -73,23 +73,23 @@ def fetch_arch(repo_id: str, filename: str, hf_token: str):
73
  detected = None
74
  quant_update = gr.update(value=detected) if detected else gr.update()
75
  if not repo_id or not filename:
76
- return _empty_arch_fields(), "Pick a GGUF file first.", quant_update
77
  try:
78
  meta = parse_hf_range(
79
  repo_id.strip(), filename, token=hf_token or None
80
  )
81
  except Exception as e: # noqa: BLE001
82
- return _empty_arch_fields(), f"Error reading GGUF header: {e}", quant_update
83
  quant_note = f", quant {detected}" if detected else ""
84
  if not meta.n_layer:
85
  return (
86
- _arch_to_fields(meta),
87
  "Parsed header but architecture fields look empty; "
88
  "edit them manually below.",
89
  quant_update,
90
  )
91
  return (
92
- _arch_to_fields(meta),
93
  f"Fetched {meta.architecture or 'model'}: "
94
  f"{meta.n_layer} layers, {meta.n_embd} embd, "
95
  f"{meta.n_head}/{meta.n_head_kv} heads, ctx {meta.training_ctx}, "
@@ -137,8 +137,8 @@ def _fields_to_arch(fields) -> ModelArch:
137
 
138
  def load_preset(name: str):
139
  if name and name in PRESETS:
140
- return _arch_to_fields(PRESETS[name]), f"Loaded preset: {name}"
141
- return _empty_arch_fields(), ""
142
 
143
 
144
  def _parse_gpu_list(text: str) -> list[float]:
 
73
  detected = None
74
  quant_update = gr.update(value=detected) if detected else gr.update()
75
  if not repo_id or not filename:
76
+ return (*_empty_arch_fields(), "Pick a GGUF file first.", quant_update)
77
  try:
78
  meta = parse_hf_range(
79
  repo_id.strip(), filename, token=hf_token or None
80
  )
81
  except Exception as e: # noqa: BLE001
82
+ return (*_empty_arch_fields(), f"Error reading GGUF header: {e}", quant_update)
83
  quant_note = f", quant {detected}" if detected else ""
84
  if not meta.n_layer:
85
  return (
86
+ *_arch_to_fields(meta),
87
  "Parsed header but architecture fields look empty; "
88
  "edit them manually below.",
89
  quant_update,
90
  )
91
  return (
92
+ *_arch_to_fields(meta),
93
  f"Fetched {meta.architecture or 'model'}: "
94
  f"{meta.n_layer} layers, {meta.n_embd} embd, "
95
  f"{meta.n_head}/{meta.n_head_kv} heads, ctx {meta.training_ctx}, "
 
137
 
138
  def load_preset(name: str):
139
  if name and name in PRESETS:
140
+ return (*_arch_to_fields(PRESETS[name]), f"Loaded preset: {name}")
141
+ return (*_empty_arch_fields(), "")
142
 
143
 
144
  def _parse_gpu_list(text: str) -> list[float]: