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 functional-methods to make it easier to transform blocks & models. #1194

Merged
merged 12 commits into from
Jul 12, 2023

Conversation

marcromeyn
Copy link
Contributor

@marcromeyn marcromeyn commented Jul 10, 2023

Goals ⚽

This PR adds methods like map, filter, walk to our blocks. This makes it easier to transform models. This would enable things like adapters, something like:

def llora(module):
    if isintance(module, (nn.Linear, nn.Embedding)):
        return LoRALayer(module)
​
    return modulewith_adapters = Block(....).walk(llora)

@github-actions
Copy link

Documentation preview

https://nvidia-merlin.github.io/models/review/pr-1194

@marcromeyn marcromeyn self-assigned this Jul 11, 2023
@marcromeyn marcromeyn added enhancement New feature or request area/pytorch labels Jul 11, 2023
@marcromeyn marcromeyn marked this pull request as ready for review July 11, 2023 13:43
@marcromeyn marcromeyn changed the title Torch/functional core Add functional-methods to make it easier to transform blocks & models. Jul 11, 2023
tests/unit/torch/test_container.py Outdated Show resolved Hide resolved
tests/unit/torch/test_container.py Outdated Show resolved Hide resolved
@marcromeyn marcromeyn merged commit 8b1ff94 into main Jul 12, 2023
@marcromeyn marcromeyn deleted the torch/functional-core branch July 12, 2023 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants