Skip to content

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
@hanouticelina hanouticelina requested a review from Wauplin October 25, 2024 16:32
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.

@hanouticelina hanouticelina merged commit 96e297f into main Nov 18, 2024
17 checks passed
@hanouticelina hanouticelina deleted the automatically-handle-outdated-inference-params branch November 18, 2024 17:12
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.

4 participants