用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/firstbatchxyz/kai --skill huggingface命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Inspect and analyze codebases using pygount for LOC counting, language breakdown, and code-vs-comment ratios. Use when asked to check lines of code, repo size, language composition, or codebase stats.
Set up GitHub authentication for the agent using git (universally available) or the gh CLI. Covers HTTPS tokens, SSH keys, credential helpers, and gh auth — with a detection flow to pick the right method automatically.
Production-grade PR review with execution-verified suggestions. Reads repository conventions, history, and security surfaces before reviewing. For every suggested fix, attempts to compile and test it in the sandbox — the comment includes proof. Modelled on GitHub Copilot's agentic architecture with one critical advantage: the sandbox is already running.
基于 SOC 职业分类
正在显示 SKILL.md
| name | huggingface |
| description | Browse, download, and deploy models, datasets, and spaces on HuggingFace Hub |
| version | 1.0.0 |
| author | kai-agent |
| metadata | {"kai":{"tags":["kai","compute","huggingface","models","datasets","inference","ml"]}} |
Skill for browsing, downloading, uploading, and running inference on models, datasets, and spaces from HuggingFace.
This skill uses the HF_TOKEN environment variable. If it is not set, ask your admin
to add it in Agent Settings. You can generate a token at https://huggingface.co/settings/tokens.
Some operations (public model browsing, public dataset loading) work without a token, but gated models, private repos, and uploads always require one.
pip install huggingface-hub transformers datasets
from huggingface_hub import HfApi
api = HfApi()
# Find top text-generation models sorted by downloads
models = api.list_models(
task="text-generation",
sort="downloads",
direction=-1,
limit=10,
)
for m in models:
print(f"{m.id} downloads={m.downloads}")
models = api.list_models(search="llama", sort="downloads", direction=-1, limit=5)
models = api.list_models(
task="text-generation",
library="vllm",
sort="downloads",
direction=-1,
limit=10,
)
This is particularly useful for inference optimization: filter by vllm or text-generation-inference
to find models already packaged for fast serving.
from huggingface_hub import ModelCard
card = ModelCard.load("meta-llama/Llama-3.1-8B-Instruct")
print(card.text) # Full markdown
print(card.data.tags) # Metadata tags
print(card.data.license) # License info
from huggingface_hub import hf_hub_download
path = hf_hub_download(
repo_id="meta-llama/Llama-3.1-8B-Instruct",
filename="config.json",
)
print(path)
from huggingface_hub import snapshot_download
local_dir = snapshot_download(
repo_id="meta-llama/Llama-3.1-8B-Instruct",
local_dir="./llama-3.1-8b",
ignore_patterns=["*.md", "*.txt"], # skip non-essential files
)
For inference optimization, look for GGUF, AWQ, or GPTQ variants:
models = api.list_models(search="Llama-3.1-8B AWQ", sort="downloads", direction=-1, limit=5)
api.upload_folder(
folder_path="./my-fine-tuned-model",
repo_id="your-org/my-model",
repo_type="model",
commit_message="Upload fine-tuned checkpoint",
)
datasets = api.list_datasets(search="code", sort="downloads", direction=-1, limit=10)
from datasets import load_dataset
ds = load_dataset("openai/gsm8k", split="train")
print(ds[0])
ds = load_dataset("allenai/c4", split="train", streaming=True)
for example in ds:
print(example["text"][:200])
break
from huggingface_hub import InferenceClient
client = InferenceClient(model="meta-llama/Llama-3.1-8B-Instruct")
response = client.text_generation(
"Explain quantization in 3 sentences:",
max_new_tokens=200,
temperature=0.7,
)
print(response)
response = client.chat_completion(
messages=[{"role": "user", "content": "What is KV-cache quantization?"}],
max_tokens=500,
)
print(response.choices[0].message.content)
embeddings = client.feature_extraction("Inference optimization for LLMs")
print(len(embeddings[0])) # embedding dimension
api.create_repo(
repo_id="your-org/my-demo",
repo_type="space",
space_sdk="gradio", # or "streamlit", "docker"
)
api.upload_folder(
folder_path="./my-space-app",
repo_id="your-org/my-demo",
repo_type="space",
)
api.duplicate_space("stabilityai/stable-diffusion", to_id="your-org/sd-copy")
library filter: Filter by vllm or text-generation-inference for deployment-ready models.~/.cache/huggingface/. Use huggingface-cli scan-cache to inspect and huggingface-cli delete-cache to free space.ignore_patterns to skip downloading unnecessary files (READMEs, training configs)HF_HOME if you want to customize the cache directoryHF_TOKEN environment variable