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

(closes #31) adds a base sampler protocol, reorganizes samplers and main #40

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

qdbp
Copy link
Contributor

@qdbp qdbp commented Oct 7, 2024

(closes #31)

This implements a (functional, so functions work!) protocol to define the EntropySampler interface. New sampler implementations should be able to plug right into it.

Specifically, we follow the jax idiom of passing state and, in addition to the obvious inputs, have the protocol be generic over two special arguments:

cfg representing immutable configuration (hyperparameters) to the sampler
state representing an encapsulation of the sampler state. This will be useful in more complex samplers (the baseline is currently stateless, so just None is used)

This also refactors main slightly, promoting the generate nested function to a generator class.

This should pave the way (though does not do so yet) for the main loop to be able to easily swap out conforming sampler implementations in a type safe way.

(also this fixes up some random mismatched type annotations -- we could probably do with a fully type checker bug bash at some point)

@qdbp qdbp force-pushed the gh-31-formalize-sampler-interface branch from b1e1b51 to 401d428 Compare October 8, 2024 03:53
@qdbp qdbp force-pushed the gh-31-formalize-sampler-interface branch from 401d428 to c601285 Compare October 8, 2024 03:56
@qdbp qdbp mentioned this pull request Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC] boring stuff: define a sampler interface
1 participant