Hugging Face Trending Models
Quick Start
Fetch the top trending models:
CODEBLOCK0
Core Features
Fetch Trending Models
Basic usage:
CODEBLOCK1
Filter by Task
Filter models by specific AI tasks:
CODEBLOCK2
Common task filters:
- -
text-generation - Large language models - INLINECODE1 - Vision models
- INLINECODE2 - Multimodal models
- INLINECODE3 - Machine translation
- INLINECODE4 - Text summarization
- INLINECODE5 - QA models
Filter by Library
Filter by ML framework:
CODEBLOCK3
Export to JSON
Save results for further analysis:
CODEBLOCK4
Proxy Configuration
The script requires an HTTP proxy to access Hugging Face API (network restrictions).
Use the -p flag:
CODEBLOCK5
For most WSL2 environments with v2rayN:
- - Proxy URL: INLINECODE7
- Or use dynamic IP: INLINECODE8
Command-Line Options
| Flag | Long Form | Description | Default |
|---|
| INLINECODE9 | INLINECODE10 | Number of models to fetch | 10 |
| INLINECODE11 |
--sort | Sort by: trending, likes, downloads, created | trending |
|
-t |
--task | Filter by task/pipeline | None |
|
-l |
--library | Filter by library (pytorch, tensorflow, jax) | None |
|
-j |
--json | Export results to JSON file | None |
|
-p |
--proxy | Proxy URL for HTTP requests | None |
Output Format
The script displays models in a structured format:
CODEBLOCK6
Model Information
Each model entry includes:
- - Model ID: Full Hugging Face model name
- Likes: Number of likes (popularity metric)
- Downloads: Total download count
- Task: Primary task/pipeline (e.g., text-generation)
- Library: ML framework (transformers, pytorch, tensorflow)
- Created/Updated: Date information
Use Cases
Daily Monitoring
Check trending models daily for new releases:
CODEBLOCK7
Task-Specific Research
Explore popular models for specific AI tasks:
CODEBLOCK8
Framework-Specific Analysis
Compare models by ML framework:
CODEBLOCK9
Integration with OpenClaw
Use within OpenClaw sessions:
CODEBLOCK10
Troubleshooting
Network Errors
Problem: "Network is unreachable" or connection errors
Solution: Ensure proxy is specified with -p flag:
CODEBLOCK11
Check if v2rayN proxy is running on Windows.
Empty Results
Problem: "No models found"
Solution: Try different filters or increase limit:
CODEBLOCK12
Dependencies Missing
Problem: "requests package not installed"
Solution: Install required dependencies:
CODEBLOCK13
Technical Notes
- - API Limitation: Hugging Face's public API doesn't provide a dedicated trending endpoint without authentication. The script fetches recent models and sorts by popularity metrics.
- Proxy Requirement: Due to network restrictions, all requests must go through a proxy. The script supports HTTP proxy configuration.
- Rate Limits: The public API has rate limits. Avoid making too many requests in quick succession.
- Data Freshness: Models are fetched from the Hugging Face API. Recent changes may take time to reflect.
Reference
See Hugging Face API Documentation for more details on model metadata and available filters.
Hugging Face 热门模型
快速开始
获取热门模型:
bash
scripts/hf_trends.py -n 10 -p http://172.28.96.1:10808
核心功能
获取热门模型
基本用法:
bash
获取前10个热门模型
scripts/hf_trends.py -n 10 -p http://172.28.96.1:10808
获取点赞数最多的前5个模型
scripts/hf_trends.py -n 5 -s likes -p http://172.28.96.1:10808
获取下载量最多的模型
scripts/hf_trends.py -n 10 -s downloads -p http://172.28.96.1:10808
按任务筛选
按特定AI任务筛选模型:
bash
文本生成模型
scripts/hf_trends.py -n 10 -t text-generation -p http://172.28.96.1:10808
图像分类模型
scripts/hf_trends.py -n 10 -t image-classification -p http://172.28.96.1:10808
翻译模型
scripts/hf_trends.py -n 10 -t translation -p http://172.28.96.1:10808
常见任务筛选:
- - text-generation - 大语言模型
- image-classification - 视觉模型
- image-to-text - 多模态模型
- translation - 机器翻译
- summarization - 文本摘要
- question-answering - 问答模型
按框架筛选
按机器学习框架筛选:
bash
仅PyTorch模型
scripts/hf_trends.py -n 10 -l pytorch -p http://172.28.96.1:10808
仅TensorFlow模型
scripts/hf_trends.py -n 10 -l tensorflow -p http://172.28.96.1:10808
JAX模型
scripts/hf_trends.py -n 10 -l jax -p http://172.28.96.1:10808
导出为JSON
保存结果以供进一步分析:
bash
导出为JSON文件
scripts/hf
trends.py -n 10 -j trendingmodels.json -p http://172.28.96.1:10808
使用特定筛选条件导出
scripts/hf
trends.py -n 20 -t text-generation -j textmodels.json -p http://172.28.96.1:10808
代理配置
脚本需要HTTP代理才能访问Hugging Face API(网络限制)。
使用-p参数:
bash
scripts/hf_trends.py -p http://172.28.96.1:10808
对于大多数使用v2rayN的WSL2环境:
- - 代理URL:http://172.28.96.1:10808
- 或使用动态IP:http://$(ip route show | grep default | awk {print $3}):10808
命令行选项
| 参数 | 长格式 | 描述 | 默认值 |
|---|
| -n | --limit | 获取模型数量 | 10 |
| -s |
--sort | 排序方式:trending、likes、downloads、created | trending |
| -t | --task | 按任务/流水线筛选 | 无 |
| -l | --library | 按框架筛选(pytorch、tensorflow、jax) | 无 |
| -j | --json | 将结果导出为JSON文件 | 无 |
| -p | --proxy | HTTP请求的代理URL | 无 |
输出格式
脚本以结构化格式显示模型:
🤖 Hugging Face 热门模型 (5 个)
============================================================
- 1. moonshotai/Kimi-K2.5
⭐ 2.0K likes 📥 647.6K downloads
📊 Task: image-text-to-text 📚 Library: transformers
📅 Created: 2026-01-01 Updated: N/A
...
模型信息
每个模型条目包括:
- - 模型ID:完整的Hugging Face模型名称
- 点赞数:点赞数量(流行度指标)
- 下载量:总下载次数
- 任务:主要任务/流水线(例如text-generation)
- 框架:机器学习框架(transformers、pytorch、tensorflow)
- 创建/更新:日期信息
使用场景
日常监控
每日检查热门模型以获取新发布:
bash
创建每日监控的cron任务
0 9
* cd /home/ltx/.openclaw/workspace && \
/home/ltx/.openclaw/workspace/skills/huggingface-trends/scripts/hf_trends.py \
-n 20 -p http://172.28.96.1:10808 >> /tmp/hf-trends.log 2>&1
特定任务研究
探索特定AI任务的流行模型:
bash
研究热门文本生成模型
scripts/hf_trends.py -n 15 -t text-generation -s likes -p http://172.28.96.1:10808
查找流行的图像转文本模型
scripts/hf_trends.py -n 15 -t image-to-text -s downloads -p http://172.28.96.1:10808
框架特定分析
按机器学习框架比较模型:
bash
比较PyTorch与TensorFlow的流行度
scripts/hf
trends.py -n 20 -l pytorch -j pytorchmodels.json -p http://172.28.96.1:10808
scripts/hf
trends.py -n 20 -l tensorflow -j tensorflowmodels.json -p http://172.28.96.1:10808
与OpenClaw集成
在OpenClaw会话中使用:
python
以编程方式获取热门模型
from skills.huggingface-trends.scripts import hf_trends
fetcher = hf_trends.HuggingFaceTrends(proxy=http://172.28.96.1:10808)
models = fetcher.fetchtrendingmodels(limit=10)
格式化显示
output = fetcher.format_models(models)
print(output)
故障排除
网络错误
问题: 网络不可达或连接错误
解决方案: 确保使用-p参数指定代理:
bash
scripts/hf_trends.py -p http://172.28.96.1:10808
检查Windows上v2rayN代理是否正在运行。
空结果
问题: 未找到模型
解决方案: 尝试不同的筛选条件或增加限制数量:
bash
scripts/hf_trends.py -n 50 -p http://172.28.96.1:10808
缺少依赖
问题: 未安装requests包
解决方案: 安装所需依赖:
bash
pip install requests
技术说明
- - API限制: Hugging Face的公共API在没有认证的情况下不提供专用的热门端点。脚本获取最近的模型并按流行度指标排序。
- 代理要求: 由于网络限制,所有请求必须通过代理。脚本支持HTTP代理配置。
- 速率限制: 公共API有速率限制。避免快速连续发送过多请求。
- 数据新鲜度: 模型从Hugging Face API获取。最近的更改可能需要时间才能反映。
参考
有关模型元数据和可用筛选条件的更多详细信息,请参阅Hugging Face API文档。