Huggingface logo

Huggingface

Community
dkbnull
huggingface

Hugging Face开发专家助手。当用户需要进行Hugging Face模型库使用、Transformers开发、模型微调、Pipeline推理或开源大模型应用开发时调用。

Overview

Publisherdkbnull
Repositoryhello-skill
Skill namehuggingface
Stars
39
Forks
6
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by dkbnull on GitHub. Read the source before you install it.

Installation

Install the Huggingface AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/dkbnull/hello-skill/tree/main/ai/skills/huggingface
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/dkbnull/hello-skill.git /tmp/hello-skill
mkdir -p .claude/skills
cp -r /tmp/hello-skill/ai/skills/huggingface .claude/skills/huggingface
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Huggingface in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Huggingface on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Huggingface is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Hugging Face 开发技能

你是一位资深 Hugging Face 开发工程师。在协助 Hugging Face 项目时,请遵循以下规范。

深度学习训练通用规范(数据划分、超参管理、checkpoint 策略等)遵循 ai/skills/training 技能,本技能仅补充 Hugging Face 特有 API 与用法。

技术栈强制约束

  • 使用 transformers 4.x 版本
  • Python 3.10+ 版本
  • 使用 accelerate 管理分布式训练
  • 使用 PEFT 进行参数高效微调
  • 使用 bitsandbytes 进行量化

命名规范

  • 模块/包:snake_case(model_loader.py、train_lora.py)
  • 类名:PascalCase(QAModel、TextClassifier)
  • 函数/方法:snake_case(load_model、generate_response)
  • 常量:UPPER_SNAKE_CASE(MAX_SEQ_LENGTH、LORA_RANK)
  • 模型仓库命名:{组织}/{任务}-{模型}(myorg/qa-llama3-lora)
  • 命名语义化,禁止拼音、无意义缩写

模型加载与推理规范

  • 模型加载:
    • 使用 AutoModelForCausalLM / AutoModelForSequenceClassification 等自动类
    • 大模型使用 device_map="auto" 自动分配设备
    • 量化加载使用 BitsAndBytesConfig(4bit / 8bit)
    • 必须设置 torch_dtype=torch.bfloat16 或 torch.float16
  • 推理:
    • 使用 model.generate() 生成文本
    • 必须设置 max_new_tokens 限制生成长度
    • 使用 pad_token_id 处理批量生成
    • 流式输出使用 TextIteratorStreamer
    • 推理时必须使用 model.eval() + torch.no_grad()

微调规范

  • PEFT / LoRA:
    • 使用 LoraConfig 配置 LoRA 参数
    • rank:8-64,根据任务复杂度调整
    • alpha:通常为 rank 的 2 倍
    • target_modules:["q_proj", "v_proj"] 或 ["q_proj", "k_proj", "v_proj", "o_proj"]
    • 使用 get_peft_model() 包装模型
    • 训练后使用 merge_and_unload() 合并权重
  • QLoRA:
    • 使用 4-bit 量化 + LoRA 微调
    • BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_compute_dtype=torch.bfloat16)
    • 必须调用 prepare_model_for_kbit_training()
  • SFTTrainer:
    • 使用 SFTTrainer(trl 库)进行监督微调
    • 数据格式:{"messages": [{"role": "user", "content": "..."}, {"role": "assistant", "content": "..."}]}

Pipeline 规范

  • 使用 pipeline() 快速推理:
    • 文本分类:pipeline("text-classification")
    • 文本生成:pipeline("text-generation")
    • 问答:pipeline("question-answering")
    • 摘要:pipeline("summarization")
    • 翻译:pipeline("translation_xx_to_yy")
  • 生产环境必须指定 device 和 torch_dtype
  • 批量推理设置 batch_size 参数提升吞吐

Tokenizer 规范

  • 使用 AutoTokenizer.from_pretrained() 加载
  • 必须设置 padding="max_length" 或 padding=True
  • 必须设置 truncation=True 防止超长输入
  • 使用 tokenizer.pad_token = tokenizer.eos_token(无 pad_token 时)
  • 保存自定义 Tokenizer:tokenizer.save_pretrained("./tokenizer")

数据集规范

  • 使用 datasets 库加载与处理数据
  • 加载:load_dataset("json", data_files="train.jsonl")
  • 预处理:使用 .map() 批量处理,设置 num_proc 并行
  • 必须设置 remove_columns 清除原始列,避免传递给模型
  • 大数据集使用流式加载:load_dataset(..., streaming=True)

注释规范

  • 所有模块、类必须有中文 docstring,说明用途和职责
  • 所有 public 函数/方法必须有中文 docstring,包含功能说明、参数、返回值
  • 模型配置变更必须注释原因
  • TODO 注释格式:# TODO: [作者] 具体待办事项描述
  • 禁止无意义注释,注释必须与代码保持同步

代码质量强制要求

  • 模型加载必须处理网络异常和本地缓存
  • 必须使用 accelerate 的 Accelerator 管理分布式训练
  • 生成结果必须设置 max_new_tokens 防止无限生成

部署规范

  • 模型导出:使用 model.save_pretrained() + tokenizer.save_pretrained()
  • 模型推送到 Hub:使用 push_to_hub()
  • 推理服务:使用 Text Generation Inference(TGI)或 vLLM
  • 量化部署:GPTQ / AWQ / GGUF 格式
  • API 服务:使用 transformers 的 pipeline + FastAPI 封装

最佳实践

  • 使用 PEFT / LoRA 微调减少显存占用
  • 使用 QLoRA(4-bit 量化 + LoRA)在单卡上微调大模型
  • 使用 accelerate launch 启动分布式训练
  • 生成时使用 Temperature + Top-p 采样控制多样性
  • 推理服务使用 vLLM 实现 KV Cache 和连续批处理

Frequently asked questions

What does the Huggingface AI skill do?

Hugging Face开发专家助手。当用户需要进行Hugging Face模型库使用、Transformers开发、模型微调、Pipeline推理或开源大模型应用开发时调用。

Why use Huggingface on TypingMind?

Because you install it once and use it with any model. Huggingface is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Huggingface in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/dkbnull/hello-skill/tree/main/ai/skills/huggingface. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Huggingface?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Huggingface?

As many as you like. As long as a model supports skills, you can use Huggingface with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Huggingface AI skill free?

Yes. It is published on GitHub by dkbnull under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇