Closed JasonDarkBlue closed 1 year ago
@JasonDarkBlue hello. We dont have an api to export a session encoder from TF4Rec model. What you can do is to extract hidden state embeddings out of the Trainer module via model.heads[0].body(batch[0]
for each batch in your dataset. This should return a 3D array size of (batch_size, sequence_length, d_model)
. hope that helps.
Thank you for your answer! It worked perfectly!
❓ Questions & Help
Details
Hello!
How can I retrieve the embedding of the transformer block for a new session from a trained T4R model, so that I can use it for downstream tasks? I attempted to reconstruct the model without the prediction task, but couldn't find an easy solution.
Thank you very much!