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

Make FactoredMatrix compatible with tensor-like arguments #599

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

JasonGross
Copy link
Contributor

Description

I'd like to be able to use FactoredMatrix with things that implement the interface of torch.Tensor without subclassing it. This slight change allows FactoredMatrix to work with such classes rather than returning None in various places.

(I haven't finished the checklists, so creating this draft PR so I don't forget about this)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have not rewritten tests relating to key interfaces which would affect backward compatibility

cmathw and others added 4 commits May 15, 2024 21:52
)

* update activation function to tanh approximation

* keep RMSNorm calcs in float32 and match cfg dtype for embedding scaling

* formatting

* keep mypy happy

* formatting
I'd like to be able to use `FactoredMatrix` with things that implement the interface of `torch.Tensor` without subclassing it.  This slight change allows `FactoredMatrix` to work with such classes rather than returning `None` in various places.
@bryce13950
Copy link
Collaborator

@JasonGross Do you still have a bit to wrap up on this? If you need any help getting this out the door let me know. If you could add a test for this, that would be greatly appreciated as well.

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.

4 participants