Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nnbench.State object holding current benchmark information, inject into setup/teardown tasks #125

Closed
nicholasjng opened this issue Mar 21, 2024 · 0 comments · Fixed by #127
Assignees
Labels
enhancement New feature or request

Comments

@nicholasjng
Copy link
Collaborator

nicholasjng commented Mar 21, 2024

We want to experiment with a global memoization cache, which we want to explicitly clear in a teardown task after a family of benchmarks for a model (say NER on distilbert) has run.

This means that the setup and teardown tasks need to know which benchmark they are currently applied in.

For a single benchmark, say

@nnbench.benchmark
def echo(s: str) -> str:
    print(s)

the corresponding State should look something like this:

def tearDown(state, **params): # <- or maybe a mappingproxy of the params?
    print(state)

# name: "echo"
# family: "echo" <- this is for parametrized benchmarks, where the family name equals the function name.
# family_size: 1 <- how many members in the current benchmark family?
# family_index: 0 <- which number of the family is it?

More metadata suggestions welcome. After this, we can try evicting a memo from the cache on the condition family_index == family_size - 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants