Pybunny commited on
Commit
9897c77
·
verified ·
1 Parent(s): 24a846b

Demote BYOM tab to CLI docs

Browse files
Files changed (1) hide show
  1. app.py +16 -42
app.py CHANGED
@@ -409,48 +409,22 @@ def build_ui() -> gr.Blocks:
409
 
410
  with gr.TabItem("Benchmark your model"):
411
  gr.Markdown(
412
- "Upload a `.py` file defining a `torch.nn.Module` "
413
- "subclass and its trained weights `.pt`. The Space "
414
- "downloads the dense House-2 benchmark split from "
415
- "[`Pybunny/nilmbench-ukdale`](https://huggingface.co/datasets/Pybunny/nilmbench-ukdale) "
416
- "on first run (cached afterwards), runs your model on the "
417
- "selected number of frames, and produces a full score "
418
- "sheet.\n\n"
419
- "**Model contract** (see "
420
- "[`examples/byom_template.py`](https://github.com/Saharmgh/NILMbench/blob/main/examples/byom_template.py)):\n"
421
- "* `forward(x)` takes `x` shape `(B, 2, 96000)` (V then I).\n"
422
- "* Returns non-negative `(B, K)` per-category power in "
423
- "watts. If your model emits shares in [0, 1] instead, "
424
- "select **shares** below and the runner will scale by the "
425
- "per-frame aggregate.\n"
426
- "* If the constructor accepts a keyword named "
427
- "`n_categories` (or `num_classes` / `K`), it is filled in "
428
- "automatically.\n"
429
- )
430
- with gr.Row():
431
- with gr.Column():
432
- model_py = gr.File(label="Model definition (.py)")
433
- weights = gr.File(label="Weights (.pt, optional)")
434
- class_name = gr.Textbox(label="Class name",
435
- value="Model")
436
- output_kind = gr.Radio(
437
- ["watts", "shares"],
438
- value="watts",
439
- label="Output kind (watts = per-category power; "
440
- "shares = renormalise + scale by aggregate)")
441
- max_frames = gr.Slider(50, 60000, value=500, step=50,
442
- label="Frames to score "
443
- "(free CPU: 500 ≈ 1–2 min)")
444
- batch_size = gr.Slider(1, 64, value=16, step=1,
445
- label="Batch size")
446
- run_btn = gr.Button("Run benchmark", variant="primary")
447
- with gr.Column():
448
- report_md = gr.Markdown()
449
- score_file = gr.File(label="Download score.json")
450
- run_btn.click(
451
- run_benchmark_upload,
452
- [model_py, weights, class_name, output_kind, max_frames, batch_size],
453
- [report_md, score_file],
454
  )
455
  return demo
456
 
 
409
 
410
  with gr.TabItem("Benchmark your model"):
411
  gr.Markdown(
412
+ "Full benchmark scoring is run via the CLI on your "
413
+ "machine (uses up to 5 GB of UK-DALE 16 kHz V/I data "
414
+ "and tens of minutes on CPU):\n\n"
415
+ "```bash\n"
416
+ "pip install git+https://github.com/Saharmgh/NILMbench\n"
417
+ "nilmbench benchmark \\\n"
418
+ " --module my_model:MyModel \\\n"
419
+ " --weights ./my_checkpoint.pt \\\n"
420
+ " --data hf:Pybunny/nilmbench-ukdale \\\n"
421
+ " --out ./report/\n"
422
+ "```\n\n"
423
+ "See "
424
+ "[examples/byom_template.py](https://github.com/Saharmgh/NILMbench/blob/main/examples/byom_template.py) "
425
+ "and "
426
+ "[docs/TESTING_GUIDE.md](https://github.com/Saharmgh/NILMbench/blob/main/docs/TESTING_GUIDE.md) "
427
+ "for the model contract and a step-by-step recipe."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
  )
429
  return demo
430