-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Thunks as an alternative to artifacts (#120)
* Add transform submodule, parameter compression transform This is the better way of compressing parameters compared to directly in the benchmark runner, which steals responsibility of the transform that we just introduced. Refactors `nnbench.io.transform->nnbench.transforms`, the latter being its own submodule. This is useful to have when adding new builtin transforms, so that they do not have to go into a single file. * Add `typecheck` flag to benchmark runner to disable typechecks Adds two conditional branches to disable typechecks in the _check() method. This is nice to have when prototyping new features and inputs to benchmarks might not exactly be of the requested types. * Remove artifact facility, add Thunk generic Also stop the practice of binding partial parametrizations directly to benchmarks. This has the effect that we can manipulate benchmark function parameters if need be (for example by lazy-loading thunk parameters). Changes the interface construction slightly to inject the partial parametrization as defaults over the `inspect.Parameter` default values. * Skip typecheck immediately, add thunk support Slightly changes parameter construction and adds a dethunking step right before the benchmark loop. This means that the thunk values are accessed at the latest possible time, which is just before benchmark execution. Moves the context construction ahead of the empty collection check, so that we give back a constructed context even in the case of no found benchmarks. Adds two C++-style thunk helpers, `is_thunk` for deciding if a value is a thunk, and `is_thunk_type` to decide if a value type is a thunk type annotation. The whole thunk facility is designed to work both with the `nnbench.types.Thunk` type as well as with general anonymous functions. * Change thunk -> memo, add type check bypass for memos In the current setup, properly typed memos and callables pass the type checker. Factors out the types into their own submodule, to be refactored later into their biggest constituents. * Migrate artifact benchmarking code to memo syntax Showcases memo subclassing, parametrization, and trivializes the run() command again. As a downside, only per-class benchmarks and aggregates can be run in a single run, not side-by-side (that would require `params` injection). * Migrate tests to new params assumptions Partial parametrizations are not bound eagerly to the benchmark functions anymore, which makes it simpler to inject memos and de-memoize variables just in time for execution. What is left is validation that a subsequent benchmark of models with intermittent garbage collection actually reaps each model after the benchmark is done.
- Loading branch information
1 parent
d09cd3c
commit 65fc45b
Showing
11 changed files
with
303 additions
and
346 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.