Token导航 LogoToken导航TokenDH.com
开发需要联网github未标认证来源可访问clear审计提醒

hf-model-inference高频模型推理

Agent Skill

hf-model-inference 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

879

周安装

37

GitHub Stars

93

下载量

308
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:hf-model-inference(高频模型推理)
来源仓库:https://github.com/letta-ai/skills
仓库路径:skills/hf-model-inference
安装命令:
npx skills add https://github.com/letta-ai/skills --skill hf-model-inference
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/letta-ai/skills --skill hf-model-inference

简介

hf-model-inference 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 它适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态、代码变更或协作事项进行整理时使用。
  • 可结合来源仓库、安装命令和原始 README 继续核验具体用法。
  • 安装方式:github;适用宿主:Codex、Claude、Cursor、Gemini CLI。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

HuggingFace Model Inference Service

Overview

This skill provides procedural guidance for setting up HuggingFace model inference services. It covers model downloading, caching strategies, Flask API creation, and service deployment patterns.

Workflow

Phase 1: Environment Setup

  1. Verify package manager availability

- Check for uv, pip, or conda before installing dependencies - Prefer uv for faster dependency resolution when available

  1. Install required packages

- Core: transformers, torch (or tensorflow) - API: flask for REST endpoints - Set appropriate timeouts for large package installations (300+ seconds)

  1. Create model cache directory

- Establish a dedicated directory for model storage (e.g., /app/model_cache/model_name) - Create parent directories as needed before downloading

Phase 2: Model Download

  1. Download the model separately from API startup

- Use a dedicated download script or inline download before starting the service - This prevents timeout issues during API initialization

  1. Specify cache directory explicitly from transformers import pipeline model = pipeline("task-type", model="model-name", cache_dir="/path/to/cache")
  2. Verification step (commonly missed)

- After download, verify model files exist in the target directory - List directory contents to confirm successful download

Phase 3: API Creation

  1. Flask application structure from flask import Flask, request, jsonify from transformers import pipeline app = Flask(__name__) model = None # Load at startup @app.route('/predict', methods=['POST']) def predict(): # Handle inference pass
  2. Input validation requirements

- Check for required fields in request JSON - Validate field types (string, number, etc.) - Handle empty or whitespace-only inputs - Return descriptive error messages with appropriate HTTP status codes

  1. Error response format

- Use consistent JSON structure: {"error": "message"} - Return 400 for client errors, 500 for server errors

Phase 4: Service Deployment

  1. Host and port configuration

- Bind to 0.0.0.0 for external accessibility - Use specified port (commonly 5000) - Example: app.run(host='0.0.0.0', port=5000)

  1. Background execution

- Start Flask in background mode for testing - Allow startup time (2-3 seconds) before sending test requests

Verification Strategies

Model Download Verification

  • List cache directory contents after download
  • Confirm expected model files exist (config.json, model weights, tokenizer files)

API Functionality Testing

Test these scenarios in order:

  1. Positive case: Valid input that should succeed curl -X POST http://localhost:5000/predict \ -H "Content-Type: application/json" \ -d '{"text": "valid input text"}'
  2. Negative case: Different valid input to verify varied responses curl -X POST http://localhost:5000/predict \ -H "Content-Type: application/json" \ -d '{"text": "different input text"}'
  3. Error case: Missing required field curl -X POST http://localhost:5000/predict \ -H "Content-Type: application/json" \ -d '{}'

Extended Edge Cases (Optional)

  • Empty string input
  • Very long text input
  • Non-JSON content type
  • Malformed JSON
  • Wrong field type (number instead of string)

Common Pitfalls

Installation Issues

  • Insufficient timeout: Large packages like torch require extended timeouts (5+ minutes)
  • Missing system dependencies: Some models require additional system packages

Model Loading Issues

  • Cold start timeout: Loading models at first request causes timeouts; load at startup instead
  • Memory constraints: Large models may exceed available RAM; check model requirements

API Issues

  • Development server warning: Flask development server is not suitable for production; acceptable for testing but note the limitation
  • No graceful shutdown: Consider signal handling for clean termination
  • No health check endpoint: Adding /health endpoint aids debugging

Process Management

  • Background process verification: After starting in background, verify the process is running
  • Port conflicts: Check if the specified port is already in use before starting

Task Planning Template

When approaching HuggingFace inference tasks, structure work as follows:

  1. Environment verification (package manager, system requirements)
  2. Dependency installation with appropriate timeouts
  3. Cache directory creation
  4. Model download with explicit cache path
  5. Model download verification
  6. API script creation with validation
  7. Service startup in background
  8. Functional testing (positive, negative, error cases)
  9. Edge case testing (if time permits)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

27.4%
按下载量换算84

Gemini CLI

24.09%
按下载量换算74

Codex

18.47%
按下载量换算57

Antigravity

11.3%
按下载量换算35

OpenCode

8.78%
按下载量换算27

windsurf

3.62%
按下载量换算11

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills