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] Manually updating chat_completion()'s params types #2682

Merged
merged 2 commits into from
Nov 28, 2024

Conversation

hanouticelina
Copy link
Contributor

This PR updates InferenceClient.chat_completion() to match the latest (TGI) changes (see: huggingface.js#1030). This is done manually rather than with utils/check_task_parameters.py script because chat completion specs are listed in a ChatCompletionInput dataclass, unlike other tasks that use a *Parameters dataclass to list the task parameters.

IMO it's better to handle InferenceClient.chat_completion() updates manually to ensure maximum reliability and avoid adding special cases to the utils/check_task_parameters.py script which is already quite clunky.

Note: I also discovered a small bug in utils/check_task_parameters.py and i added the fix here. Also, this PR should fix some issues in the CI in #2664.

@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.

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!

IMO it's better to handle InferenceClient.chat_completion() updates manually

Agree!

Comment on lines +1229 to +1233
negative_prompt: Optional[List[str]] = None,
num_inference_steps: Optional[int] = None,
guidance_scale: Optional[float] = None,
model: Optional[str] = None,
target_size: Optional[ImageToImageTargetSize] = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

(nit) worth mentioning this breaking change in the release notes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

btw, I did not add a proper deprecation given the possible limited usage of InferenceClient.image_to_image(), but of course, this will be mentioned in the release notes!

Copy link
Contributor

Choose a reason for hiding this comment

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

yep, no need for a deprecation cycle here 👍

@hanouticelina hanouticelina merged commit 446e9c1 into main Nov 28, 2024
17 checks passed
@hanouticelina hanouticelina deleted the update-chat-completion-params branch November 28, 2024 14:23
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