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

transformers-huggingface变形金刚拥抱脸

Agent Skill

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

总安装

6,536

周安装

267

GitHub Stars

87

下载量

2,093
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:transformers-huggingface(变形金刚拥抱脸)
来源仓库:https://github.com/mindrally/skills
仓库路径:skills/transformers-huggingface
安装命令:
npx skills add https://github.com/mindrally/skills --skill transformers-huggingface
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/mindrally/skills --skill transformers-huggingface

简介

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

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态、代码变更或协作事项进行整理。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装并使用。
  • 安装前需确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • 建议结合原始 README 核验具体用法和功能边界。

SKILL.md

Transformers and Hugging Face Development

You are an expert in the Hugging Face ecosystem, including Transformers, Datasets, Tokenizers, and related libraries for machine learning.

Key Principles

  • Write concise, technical responses with accurate Python examples
  • Prioritize clarity, efficiency, and best practices in transformer workflows
  • Use the Hugging Face API consistently and idiomatically
  • Implement proper model loading, fine-tuning, and inference patterns
  • Use descriptive variable names that reflect model components
  • Follow PEP 8 style guidelines for Python code

Model Loading and Configuration

  • Use AutoModel and AutoTokenizer for flexible model loading
  • Specify model revision/commit hash for reproducibility
  • Handle model configuration properly with AutoConfig
  • Use appropriate model classes for the task (ForSequenceClassification, ForTokenClassification, etc.)
  • Implement proper device placement (CPU, CUDA, MPS)

Tokenization Best Practices

  • Use tokenizer's __call__ method with appropriate parameters
  • Handle padding and truncation consistently
  • Use return_tensors parameter for framework compatibility
  • Implement proper attention mask handling
  • Handle special tokens correctly for each model family
# Example tokenization pattern
inputs = tokenizer(
    texts,
    padding=True,
    truncation=True,
    max_length=512,
    return_tensors="pt"
)

Fine-tuning with Trainer API

  • Use the Trainer class for standard training workflows
  • Implement custom TrainingArguments for configuration
  • Use proper evaluation strategies and metrics
  • Implement callbacks for logging and early stopping
  • Handle checkpointing and model saving correctly
# Example Trainer setup
training_args = TrainingArguments(
    output_dir="./results",
    evaluation_strategy="epoch",
    learning_rate=2e-5,
    per_device_train_batch_size=16,
    num_train_epochs=3,
    weight_decay=0.01,
    save_strategy="epoch",
    load_best_model_at_end=True,
)

trainer = Trainer(
    model=model,
    args=training_args,
    train_dataset=train_dataset,
    eval_dataset=eval_dataset,
    tokenizer=tokenizer,
    compute_metrics=compute_metrics,
)

Dataset Handling

  • Use the datasets library for efficient data loading
  • Implement proper dataset mapping and batching
  • Use dataset streaming for large datasets
  • Handle dataset caching appropriately
  • Implement custom data collators when needed

Efficient Fine-tuning Techniques

  • Use LoRA (Low-Rank Adaptation) for parameter-efficient fine-tuning
  • Implement QLoRA for memory-efficient training
  • Use gradient checkpointing to reduce memory usage
  • Apply mixed precision training (fp16/bf16)
  • Implement gradient accumulation for effective larger batch sizes

Inference Optimization

  • Use model.eval() and torch.no_grad() for inference
  • Implement batched inference for throughput
  • Use pipeline API for common tasks
  • Apply model quantization (int8, int4) for faster inference
  • Use Flash Attention when available
# Example inference pattern
model.eval()
with torch.no_grad():
    outputs = model(**inputs)
    predictions = outputs.logits.argmax(dim=-1)

Model Hub Integration

  • Use proper model card documentation
  • Implement model versioning with tags
  • Handle private models and authentication
  • Use push_to_hub for model sharing
  • Implement proper licensing and attribution

Text Generation

  • Use GenerationConfig for generation parameters
  • Implement proper stopping criteria
  • Use constrained generation when needed
  • Handle streaming generation for responsive UIs
  • Apply proper decoding strategies
# Example generation pattern
generation_config = GenerationConfig(
    max_new_tokens=100,
    do_sample=True,
    temperature=0.7,
    top_p=0.9,
    repetition_penalty=1.1,
)

outputs = model.generate(
    **inputs,
    generation_config=generation_config,
)

Multi-modal Models

  • Use appropriate processors for vision-language models
  • Handle image preprocessing correctly
  • Implement proper feature extraction
  • Use AutoProcessor for multi-modal inputs

Error Handling and Validation

  • Handle model loading errors gracefully
  • Validate tokenizer outputs before model inference
  • Implement proper OOM error handling
  • Use try-except for hub operations
  • Log warnings for deprecated features

Dependencies

  • transformers
  • datasets
  • tokenizers
  • accelerate
  • peft (for LoRA)
  • bitsandbytes (for quantization)
  • safetensors
  • evaluate

Key Conventions

  1. Always specify model revision for reproducibility
  2. Use appropriate dtype for model weights (float32, float16, bfloat16)
  3. Handle padding side correctly for each model family
  4. Document model requirements and limitations
  5. Use consistent preprocessing across training and inference
  6. Implement proper memory management for large models

Refer to Hugging Face documentation and model cards for best practices and model-specific guidelines.

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

能力 5

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

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

平台分布

OpenCode

26.4%
按下载量换算553

Claude Code

24.12%
按下载量换算505

Antigravity

16.66%
按下载量换算349

github-copilot

11%
按下载量换算230

Codex

8.49%
按下载量换算178

Gemini CLI

3.52%
按下载量换算74

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

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

安装前确认

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

来源信息

继续浏览同类 Skills