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

Log if handler service is using default or custom functions implementation #114

Merged
merged 1 commit into from
Apr 29, 2024

Conversation

aduverger
Copy link
Contributor

Issue #, if available:

Description of changes:
Currently, when there is no model_fn function implemented by the user (or when the handler service fails to load such implementation), the default load function is being used to load the model.

Because it's not clear from the logs when that default function is being used, this makes things difficult for users to debug when they were expecting their own implementations to be used.
E.g.: let's say I write a inference.py script with a model_fn. For some reason, this function is not being picked up by the handler service. This reason could be:

  • The name of the method is not exactly model_fn
  • An issue with the archive file: e.g. the archive is named model_artifacts_v2.tar.gz, but the root folder in this archive is named model_artifacts and not model_artifacts_v2
  • ...

Because the default load function is being used in that case, the logs would display an error such as:

 "You need to define one of the following [...] as env 'HF_TASK'.",

Which make things confusing as the user thinks they need to set a env variable to fix the issue, whereas the problem is related to the custom implementation not being used.

This PR adds some logs to tell the user which implementation are being used for each function.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@aduverger aduverger marked this pull request as ready for review March 14, 2024 20:39
@aduverger
Copy link
Contributor Author

aduverger commented Mar 19, 2024

Hey @philschmid, any chance you could take a look at this?
Thanks!

@aduverger
Copy link
Contributor Author

Anyone around 😅?

@philschmid philschmid merged commit c2440c1 into aws:main Apr 29, 2024
@philschmid
Copy link
Collaborator

Sorry, took a while. Addded it. Its never bad to add some extra logs.

@aduverger aduverger deleted the logging branch April 30, 2024 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants