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

Quick fix of compute_loss to be able to use fit method in tensorflow #275

Merged
merged 1 commit into from
Oct 6, 2021

Conversation

sararb
Copy link
Contributor

@sararb sararb commented Oct 6, 2021

Goals ⚽

The current implementation of compute_loss does not use the call methods of the Head and Model classes. This raises an issue for NextItemPredictionTask as the build method requires body to retrieve necessary information about items embeddings and masking. This class is only accessed via the build method of Head.

Implementation Details 🚧

The current PR presents a quick fix by exposing an argument call_task in the compute_loss of PredictionTask classes. The compute_loss methods of Head / Model are first computing the predictions through their call methods (to correctly build the related tasks), then computing the tasks losses with call_task=False.

Testing Details 🔍

This PR adds a test in test_model.py that defines a model with NextItemPredictionTask head, call the fit and evaluate methods, then check that losses and metrics are correctly computed.

@sararb sararb requested a review from marcromeyn October 6, 2021 16:33
@sararb sararb self-assigned this Oct 6, 2021
@sararb sararb merged commit 6e7bc69 into main Oct 6, 2021
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