NVIDIA-Merlin / models

Merlin Models is a collection of deep learning recommender system model reference implementations
https://nvidia-merlin.github.io/models/main/index.html
Apache License 2.0
262 stars 50 forks source link

Add functional-methods to make it easier to transform blocks & models. #1194

Closed marcromeyn closed 1 year ago

marcromeyn commented 1 year ago

Goals :soccer:

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 module
​
with_adapters = Block(....).walk(llora)
github-actions[bot] commented 1 year ago

Documentation preview

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