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

Handle ColumnSchema `target` in serialization of `SequenceTransform` #1214

Closed oliverholworthy closed 11 months ago

oliverholworthy commented 1 year ago

Fixes #1212

Goals :soccer:

Enable serialization of SequenceTransform layers. with schema target.

Implementation Details :construction:

Handle ColumnSchema target in serialization of SequenceTransform

Testing Details :mag:

github-actions[bot] commented 1 year ago

Documentation preview

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

oliverholworthy commented 1 year ago

While this change will enable saving a model with SequenceTransform layers with a target type of ColumnSchema.

The example code linked in the related bug issue, shows that the SequenceMaskLast layer is only used as part of the pre of the .evaluate call. This layer then fails to serialize when calling .save() on the model, because keras finds a ColumnSchema object which it doesn't know what to do with.

We should check if it's intended that the call to evaluate has a side-effect of adding this SequenceMaskLast layer to the model. Since if the SequenceTransform layers are only used in the pre, and don't become part of the model, in that usecase, they may not strictly need to be saved/serialized to json correctly.

rnyak commented 1 year ago

@gabrielspmoreira @sararb fyi.

rnyak commented 11 months ago

@gabrielspmoreira and @oliverholworthy I tested this fix and now we can serve topk_model on Triton, however served topK_model returns only top 100 scores which does not make sense without item ids. we might need to fix the pertinent code so that it returns both the scores and corresponding item_ids. I assume for that we need exported schema to show to outputs (scores and ids) ?