huggingface/smolagents · warning · FutureWarning
The 'model_id' parameter will be required in version 2.0.0.
Error message
The 'model_id' parameter will be required in version 2.0.0. Please update your code to pass this parameter to avoid future errors. For now, it defaults to 'HuggingFaceTB/SmolLM2-1.7B-Instruct'.
What it means
TransformersModel.__init__ warns (FutureWarning) when model_id is not passed; it currently falls back to 'HuggingFaceTB/SmolLM2-1.7B-Instruct' but model_id becomes required in version 2.0.0. The warning is the migration signal before the hard failure.
Source
Thrown at src/smolagents/models.py:933
apply_chat_template_kwargs: dict[str, Any] | None = None,
**kwargs,
):
try:
import torch
from transformers import (
AutoModelForCausalLM,
AutoModelForImageTextToText,
AutoProcessor,
AutoTokenizer,
TextIteratorStreamer,
)
except ModuleNotFoundError:
raise ModuleNotFoundError(
"Please install 'transformers' extra to use 'TransformersModel': `pip install 'smolagents[transformers]'`"
)
if not model_id:
warnings.warn(
"The 'model_id' parameter will be required in version 2.0.0. "
"Please update your code to pass this parameter to avoid future errors. "
"For now, it defaults to 'HuggingFaceTB/SmolLM2-1.7B-Instruct'.",
FutureWarning,
)
model_id = "HuggingFaceTB/SmolLM2-1.7B-Instruct"
max_new_tokens = max_tokens if max_tokens is not None else max_new_tokens
if device_map is None:
device_map = "cuda" if torch.cuda.is_available() else "cpu"
logger.info(f"Using device: {device_map}")
self._is_vlm = False
self.model_kwargs = model_kwargs or {}
self.apply_chat_template_kwargs = apply_chat_template_kwargs or {}
try:
self.model = AutoModelForImageTextToText.from_pretrained(
model_id,View on GitHub (pinned to 30bb116109)
Solutions
- Pass an explicit model_id matching your use case
- If the default was intentional, pass it explicitly to silence the warning
- Audit configs/scripts for TransformersModel( constructions without model_id before upgrading to 2.x
Example fix
# before model = TransformersModel() # after model = TransformersModel(model_id='Qwen/Qwen2.5-7B-Instruct')
Defensive patterns
Strategy: validation
Validate before calling
model = TransformersModel(model_id=os.environ['MODEL_ID'])
Try / catch
import warnings
with warnings.catch_warnings():
warnings.simplefilter('ignore', FutureWarning)
model = TransformersModel() # temporary, will break in 2.0 Prevention
- Always pass model_id explicitly
- Grep code for TransformersModel( without model_id before upgrading
- Store model ids in config/env, not implicit defaults
When it happens
Trigger: Constructing TransformersModel() with no model_id (relying on the old default) after upgrading smolagents; copying legacy examples that omit model_id.
Common situations: Version upgrades where code silently used the default SmolLM2 model; teams surprised their 'unconfigured' model was actually a small default model.
Related errors
- The 'model_id' parameter will be required in version 2.0.0.
- Unsupported model type: {model_type}
- Parameter 'messages' is deprecated and will be removed in ve
- Parameter 'structured_output' was not specified. Currently i
- Parameter 'structured_output' was not specified. Currently i
AI-assisted analysis of huggingface/smolagents@30bb116109 (2026-08-28).
Data as JSON: /api/errors/8a54e48894219faf.
Report an issue: GitHub.