Skip to main content
Huggingface 工具(支持文本 I/O)可以直接使用 load_huggingface_tool 函数加载。
# 需要 transformers>=4.29.0 和 huggingface_hub>=0.14.1
pip install -qU  transformers huggingface_hub > /dev/null
pip install -qU  langchain-community
from langchain_community.agent_toolkits.load_tools import load_huggingface_tool

tool = load_huggingface_tool("lysandre/hf-model-downloads")

print(f"{tool.name}: {tool.description}")
model_download_counter: 这是一个返回 Hugging Face 中心上给定任务下载量最多模型的工具。它接受类别名称(例如 text-classification、depth-estimation 等),并返回检查点的名称
tool.run("text-classification")
'facebook/bart-large-mnli'