Skip to content

[QST] Help w/ exporting Retrieval Model.  #1092

@Tmoradi

Description

@Tmoradi

❓ Questions & Help

Details

my current set up is on a vertex ai workbench w/ Tesla T4 GPU, 120 GB RAM, 32vCPUs, and using nvcr.io/nvidia/merlin/merlin-tensorflow:nightly container image.

I am currently working on a retrieval based model and depending on the version of the dataset I use, I cannot export the query tower.

The different dataset's that I've been using are as follows:

v3: various continuous and categorical features for both users and the items we want to recommend.

  • exporting the query tower works fine in this case.

v4: features of v3 + item embeddings generated from sentence transformer.

  • dim size is 384
  • in the NVTabular Workflow, I just tagged the embedding columns as item features. not sure if this is the cause of the issues but I wanted to include this just in case.

v5: features of v3 + item embeddings generated from sentence transformer + multi-hot encoding of user history as implicit feedback.

  • dim of multi-hot encoding is 332
  • in the NVTabular Workflow, I just tagged the these columns Categorify() >> TagAsUserFeatures(). not sure if this is the cause of the issues but I wanted to include this just in case.

so when training a model w/ either v4 or v5 and save the query encoder, I get the following message:
query_tower = model.query_encoder
query_tower.save(...)

Screen Shot 2024-01-03 at 12 04 30 PM
  • note: this screen shot is with v4, when using v5 ds, I get more functions that wont be available.

when I load the query_tower and then try to turn the model into a top_k_model I get another error.
query_tower = tf.keras.models.load_model(".../query_tower_based_on_v5",compile=False)
model = mm.TwoTowerModelV2(query_tower, candidate)
model.compile()
candidate_features = unique_rows_by_features(train, Tags.ITEM, Tags.ITEM_ID)
topk_model = model.to_top_k_encoder(candidate_features, k=10, batch_size=1)
error when trying to convert the model to a top k encoder

sorry for cutting the error message off but its talking about the encoder for the query tower.

sorry for being private w/ the data but its not public.

I hope i was able to portray the issue and any suggestions would be appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions