Change interface for nak_torch#29
Draft
dannys4 wants to merge 64 commits into
Draft
Conversation
Updated tensor creation to specify device and dtype.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant refactoring and modernization to the example scripts and algorithm API usage in the project. The main changes involve updating the usage of particle-based inference algorithms to use new class-based APIs, centralizing the execution logic through a new
nakfunction, and improving reproducibility and clarity in the examples. There are also minor improvements and cleanups in type usage and plotting.Refactor and API Modernization
Updated all example scripts (
examples/gaussian.py,examples/himmelblau.py) to use the new class-based APIs for algorithms such asMSIP,SVGD,GradALDI,GradFreeALDI,CBS, andEKS, replacing previous function-based calls. The newnakfunction is now used as a central entry point for running these algorithms, leading to more consistent and maintainable code. [1] [2] [3] [4]Now use explicit random number generators (
torch.Generator) for reproducibility, and initialization of particles and random seeds is more explicit and consistent. [1] [2]Type and Interface Cleanups
Several type hints and batch evaluation interfaces are improved, with more consistent use of batched log-density and gradient evaluators. [1] [2]
Minor type and import cleanups, such as using
DeviceLikefrom the project’s types module instead of redefining it inexamples/pyro_tools.py.Miscellaneous