Skip to content

Conversation

julien-c
Copy link
Member

@julien-c julien-c commented Apr 15, 2025

  • more closely follows the name of the underlying library (huggingface_hub's InferenceClient) which we are going to push more in the coming months cc @Wauplin @hanouticelina – along with Inference Providers
  • make the name less HF-centric, given the actual inference is (most of the time) not performed by HF directly
  • still conserve the Model suffix to adhere to smolagents' naming convention

@julien-c julien-c changed the base branch from main to docs-tweaks April 15, 2025 09:52
@julien-c julien-c changed the title rename HfApiModel to `InferenceClientModel rename HfApiModel to InferenceClientModel Apr 15, 2025
Copy link
Contributor

@hanouticelina hanouticelina left a comment

Choose a reason for hiding this comment

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

LGTM

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.

Makes perfect sense to switch the naming as early as possible !

Base automatically changed from docs-tweaks to main April 15, 2025 11:06
julien-c and others added 3 commits April 15, 2025 13:07
Co-authored-by: Lucain <lucainp@gmail.com>
Co-authored-by: Lucain <lucainp@gmail.com>
Copy link
Member Author

Choose a reason for hiding this comment

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

unrelated note: if we renamed all doc files to .md (which is the case in our other libraries IIRC) we would have less messy diffs inside GitHub.

cc @mishig25 for viz

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we did it to get documentation examples like https://github.com/huggingface/smolagents/blob/main/docs/source/en/examples/multiagents.mdx work in Colab (the open in Colab button)

Copy link
Member

@albertvillanova albertvillanova Apr 15, 2025

Choose a reason for hiding this comment

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

Yes, I renamed them to .mdx to have them automatically converted to notebooks: https://github.com/huggingface/notebooks

This is the case for some other libraries like: datasets, setfit, diffusers,...

Note that the weird diffs are indeed caused by the HTML header comment:

<!--Copyright 2024 The HuggingFace Team. All rights reserved.
...

In datasets we decided to delete this header comment.

I can remove them as well in smolagents if you agree.

Copy link
Member

Choose a reason for hiding this comment

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

I have opened a PR on the doc-builder repo to add support for creating notebooks from .md files as well:

Once merged, we could rename all relevant files from .mdx back to .md. This will enable native Markdown rendering in IDEs.

CC: @julien-c @aymeric-roucher

Copy link
Member Author

Choose a reason for hiding this comment

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

nice! thanks @albertvillanova

@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
Member Author

@julien-c julien-c left a comment

Choose a reason for hiding this comment

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

i've merged main, so the commit history is slightly messy but the diff should be 👍

@julien-c julien-c mentioned this pull request Apr 15, 2025
@merveenoyan
Copy link
Contributor

merveenoyan commented Apr 15, 2025

@julien-c I will close my PR and follow and build on your branch, thanks for the ping

@merveenoyan
Copy link
Contributor

merveenoyan commented Apr 15, 2025

I accidentally didn't checkout to a new branch when I made my changes (derived from your branch) @julien-c CLI tests are passing on my end, I can revert or not however you like! sorry

@julien-c
Copy link
Member Author

@merveenoyan it's fine 😄

Copy link
Member

@albertvillanova albertvillanova left a comment

Choose a reason for hiding this comment

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

Just a general thought: as we're removing the Hf prefix from the name, I'm wondering how users will be able to distinguish this from other inference-client-style models (which we usually refer to as ApiModels), such as those for LiteLLM or OpenAI. Do you think we might need some additional naming clarity to help differentiate them?

@julien-c
Copy link
Member Author

@albertvillanova i think it's fine (maybe better) if the name is kinda generic and does not reference HF explicitly, given one of the goals is precisely:

make the name less HF-centric, given the actual inference is (most of the time) not performed by HF directly

let me know if this makes sense!

@albertvillanova
Copy link
Member

albertvillanova commented Apr 16, 2025

Thanks for the clarification, @julien-c.

Let me try to explain my point a bit better. My concern is that the name InferenceClientModel is so generic that it might be confusing to users, especially when thinking about other inference-client-style models.

For instance, LiteLLMModel also fits that description: it uses a client to request models and supports multiple providers like OpenAI, Anthropic, Hugging Face, Anyscale, etc. So from a user perspective, InferenceClientModel could easily be interpreted as referring to something like LiteLLMModel.

My question is: shouldn't we aim for a name that more clearly distinguishes our inference-client model from other similar inference-client models (like LiteLLM), to avoid ambiguity?

@aymeric-roucher
Copy link
Collaborator

We have discussed this internally with @julien-c on Slack .
I agree that the name InferenceClientModel, in the sole context of smolagents, could lead to some confusion : what about other Inference clients like LiteLLM, does this class wrap them?

But in the broader context of the Hub + smolagents, this renaming makes sense.
We will probably have many users coming to smolagents from the Hub, so having Hub expectations like "Hub has this great portal named Inference Providers" (and Julien said that "Inference Client" is going to get pushed a lot in coming months), for users with these priors, the name InferenceClient* makes sense.
Maybe we could make it even clearer for any context, like HubInferenceModel, WDYT @julien-c ?
But else, for me the name InferenceClientModel works.

@Wauplin
Copy link
Contributor

Wauplin commented Apr 16, 2025

(leaning towards InferenceClientModel as well for consistency with the existing naming in our ecosystem)

@julien-c
Copy link
Member Author

@albertvillanova it's a bit philosophical and i agree the name is generic but we can't change it now as we've strongly pushed InferenceClient in both our Python and JS SDKs.
That being said we also have libraries named "datasets" and "transformers" 😁

@merveenoyan
Copy link
Contributor

merveenoyan commented Apr 16, 2025

I think InferenceClient especially with inference providers is sticking to users, so I wouldn't worry about confusion around it given we have documentation in smolagents (also you can't use it without documentation properly, so I don't think there'd be confusion)

@aymeric-roucher
Copy link
Collaborator

aymeric-roucher commented Apr 16, 2025

One failing test @julien-c : FAILED tests/test_models.py::TestHfApiModel::test_init_model_with_tokens - TypeError: object.__new__() takes exactly one argument (the type to instantiate)

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.

7 participants