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

[InferenceClient] Automatically handle outdated task parameters #2633

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

hanouticelina
Copy link
Contributor

@hanouticelina hanouticelina commented Oct 24, 2024

This PR will complete some tasks from #2063.
The PR adds the possibility to automatically check for outdated parameters of task methods in the inference client, aligning these task methods with their corresponding parameter specs. More specifically, the script will check and update parameter types and docstrings. The latter is the most possible to happen as parameter descriptions tend to change more frequently.

  • ✅ detect and update outdated parameter's type and/or docstring in method signature.
  • ✅ detect and update outdated parameter's type and/or docstring in method docstrings.

some changes in the inference client code are automatically generated after re-running utils/generate_inference_types.py and utils/check_task_parameters.py to be able to import some missing type aliases from huggingface_hub/inference/_generated_types module.

⚠️ the docstring parsing code is a little bit clunky as it's quite difficult to extract or update a parameter's docstring in a structured way using libcst. this implementation relies on heuristics heavily based on the "format" of the method docstring.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@hanouticelina hanouticelina marked this pull request as ready for review October 25, 2024 16:31
Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hanouticelina, impressive work!

⚠️ the docstring parsing code is a little bit clunky as it's quite difficult to extract or update a parameter's docstring in a structured way using libcst. this implementation relies on heuristics heavily based on the "format" of the method docstring.

Let's hope it'll not break too often (I'm quite confident). Let's remember the utility is only meant to help us and is not publicly released so it's fine to have more clunky logic there.

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.

3 participants