8000 Pass vLLM (VLLMModel) model client params as `client_kwargs` by sergiopaniego · Pull Request #1137 · huggingface/smolagents · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Pass vLLM (VLLMModel) model client params as client_kwargs #1137

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

Merged
merged 4 commits into from
Apr 3, 2025

Conversation

sergiopaniego
Copy link
Member
@sergiopaniego sergiopaniego commented Apr 3, 2025

fix #1136

This support is already present in another model client such as HfApiModel and OpenAIServerModel.

I've tested it with the following code:

from smolagents import CodeAgent, DuckDuckGoSearchTool, VLLMModel

# Import search tool
search_tool = DuckDuckGoSearchTool()

# Load model
model_name = "google/gemma-3-4b-it"
# model = VLLMModel(model_id=model_name)
model = VLLMModel(model_id=model_name, client_kwargs={"max_model_len": 65536}) # new functionality!

# Initialize the agent with search_tool
agent = CodeAgent(tools=[search_tool], model=model)

# Run it!
result = agent.run("How did Real Madrid do in their last La Liga match?")
result

BTW, there are currently no tests for VLLMModel in test_models.py and it's not described in the guided tour docs.

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.

Thanks for addressing this issue.

While I agree with providing users the ability to customize their model configuration, I have concerns about the proposed naming convention.

The term client_kwargs is typically used in our codebase for API-based models that need a client to request remote inference (like in HfApiModel, OpenAIServerModel, etc.). However, vLLM is a local inference library rather than a remote API client.

A more appropriate approach might be to rename this to model_kwargs(?) or llm_kwargs to better reflect that these parameters configure a local model instance rather than a remote API client. This would maintain consistency with how we distinguish between local models and API-based models elsewhere in the codebase.

Otherwise, I think the functionality itself is valuable and should be implemented.

@sergiopaniego
Copy link
Member Author

Thanks for the review!
I've updated it to model_kwargs, as you suggested. It feels more natural now

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.

Thanks!

@Hellisotherpeople
Copy link

Big love for this!

@aymeric-roucher aymeric-roucher merged commit b781114 into huggingface:main Apr 3, 2025
3 checks passed
@sergiopaniego sergiopaniego deleted the vllm-model-params branch April 4, 2025 07:04
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.

Pass params to vLLM model creation to improve flexibility
4 participants
0