Load the reference Model, get_inputs, get_init_inputs from workspace.
()
| 113 | |
| 114 | |
| 115 | def load_reference(): |
| 116 | """Load the reference Model, get_inputs, get_init_inputs from workspace.""" |
| 117 | ref_path = KB_ACTIVE_DIR / "reference.py" |
| 118 | if not ref_path.exists(): |
| 119 | print("ERROR: No active KernelBench problem.") |
| 120 | print(" Run: uv run kernelbench/bridge.py setup --level 1 --problem 1") |
| 121 | sys.exit(1) |
| 122 | mod = _load_module_from_path(ref_path, "_kb_reference") |
| 123 | Model = getattr(mod, "Model", None) |
| 124 | get_inputs = getattr(mod, "get_inputs", None) |
| 125 | get_init_inputs = getattr(mod, "get_init_inputs", None) |
| 126 | if Model is None or get_inputs is None: |
| 127 | print("ERROR: reference.py must define Model, get_inputs(), get_init_inputs().") |
| 128 | sys.exit(1) |
| 129 | if get_init_inputs is None: |
| 130 | get_init_inputs = lambda: [] |
| 131 | return Model, get_inputs, get_init_inputs |
| 132 | |
| 133 | |
| 134 | def load_kernel(): |
no test coverage detected