Skip to content

Commit

Permalink
fixes transformers dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
AngeloKiriakoulis committed Feb 1, 2025
1 parent da8e799 commit 669448f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/smolagents/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
)
from huggingface_hub.utils import is_torch_available
from packaging import version
from transformers.agents.tools import Tool as TransformersTool

from ._function_type_hints_utils import (
TypeHintParsingException,
Expand Down Expand Up @@ -788,7 +787,7 @@ class ToolCollection:
For example and usage, see: [`ToolCollection.from_hub`] and [`ToolCollection.from_mcp`]
"""

def __init__(self, tools: List[Union[Tool, TransformersTool]]):
def __init__(self, tools: List[Tool]):
self.tools = tools

def detect_tool_type(repo_id: str) -> str:
Expand Down Expand Up @@ -849,9 +848,8 @@ def from_hub(
_hub_repo_ids = {item.item_id for item in _collection.items if item.item_type == "space"}
tools = {
Tool.from_hub(repo_id, token, trust_remote_code)
if cls.detect_tool_type(repo_id) == "smolagents"
else TransformersTool.from_hub(repo_id, token)
for repo_id in _hub_repo_ids
if cls.detect_tool_type(repo_id) == "smolagents"
}

return cls(tools)
Expand Down

0 comments on commit 669448f

Please sign in to comment.