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

Refactoring/influence #394

Merged
merged 18 commits into from
Aug 23, 2023
Merged

Refactoring/influence #394

merged 18 commits into from
Aug 23, 2023

Conversation

schroedk
Copy link
Collaborator

@schroedk schroedk commented Aug 7, 2023

Description

This PR introduces a cleanup on how we can handle different frameworks. I would like to start from this, to add the jax framework and an additional method (Nyström approximation #343). This is not breaking the user interface again, as it is only modifying internal mechanisms of the package.

Changes

  • make the top level modules independent of torch, not just by name
  • introduce an inversion method registry to easily add new methods

Checklist

  • Wrote Unit tests (if necessary)
  • Updated Documentation (if necessary)
  • Updated Changelog
  • [ ] If notebooks were added/changed, added boilerplate cells are tagged with "nbsphinx":"hidden"

* simplify grad method, do not return tuple, simplify input signature
* simplify split_grad to call self.grad
* change default argument of self.grad
* extract split_grad method to simplify class
* introduce a dynamic registry for inversion methods
* make top level modules independent of the torch implementation
Copy link
Collaborator

@Xuzzo Xuzzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice new design! Thanks a lot. I just have one comment on the concatenation of grads.

src/pydvl/influence/general.py Outdated Show resolved Hide resolved
@schroedk schroedk marked this pull request as ready for review August 17, 2023 12:15
@schroedk schroedk changed the title Draft: Refactoring/influence Refactoring/influence Aug 17, 2023
Copy link
Collaborator

@mdbenito mdbenito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a somewhat superficial review since we already discussed most design choices. Left some ball-busting nit-picking comments, but I think this is great step forward.

CHANGELOG.md Outdated Show resolved Hide resolved
src/pydvl/influence/inversion.py Outdated Show resolved Hide resolved
src/pydvl/influence/inversion.py Outdated Show resolved Hide resolved
src/pydvl/influence/torch/torch_differentiable.py Outdated Show resolved Hide resolved
src/pydvl/influence/torch/torch_differentiable.py Outdated Show resolved Hide resolved
src/pydvl/influence/inversion.py Outdated Show resolved Hide resolved
src/pydvl/influence/inversion.py Outdated Show resolved Hide resolved
src/pydvl/influence/torch/functional.py Outdated Show resolved Hide resolved
src/pydvl/influence/torch/functional.py Show resolved Hide resolved
src/pydvl/influence/torch/torch_differentiable.py Outdated Show resolved Hide resolved
@mdbenito mdbenito added this to the Complete IF milestone Aug 20, 2023
@schroedk schroedk marked this pull request as draft August 21, 2023 17:31
* add missing methods to interface, remove obsolete ones, make cat preallocate tensor
* add DataLoaderUtilities concept
* remove DataLoaderUtilities
* try to call len on dataloader for pre-allocating result tensor, fallback to ordinary cat
@schroedk schroedk marked this pull request as ready for review August 23, 2023 15:05
@schroedk schroedk merged commit f1ef755 into develop Aug 23, 2023
12 checks passed
@mdbenito mdbenito deleted the refactoring/influence branch September 1, 2023 10:21
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.

None yet

3 participants