AGENT SKILL

petals

Use Petals for distributed large-language-model inference, prompt tuning, server swarms, block-level internals, benchmarks, and package troubleshooting.

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
petals
license
MIT
metadata
{ "disco-role": "operating" }
description
Use Petals for distributed large-language-model inference, prompt tuning, server swarms, block-level internals, benchmarks, and package troubleshooting.
disable-model-invocation
true

02 资源文件 5

03 SKILL.md 正文

Petals Repo Skill

Use this skill when a task involves Petals, the Python package for collaborative distributed inference and prompt tuning of large language models whose transformer blocks are hosted by remote peers.

This skill is self-contained. Do not rely on a repository checkout being present unless the user explicitly says they are maintaining one; use the bundled references and scripts below for ordinary package workflows.

Start here

  1. For install, import, dependency, cache, model-access, and backend readiness, read references/installation-and-environment.md.

  2. Run the safe root checker when you need a no-network local sanity check:

    python scripts/check_petals_environment.py --pretty
    

    A passing checker means local imports, API discovery, and CLI parser checks worked. It does not prove public swarm health, model access, GPU serving performance, or adapter execution.

  3. Route the user request to the nearest sub-skill below.

  4. For cross-cutting failures, read references/troubleshooting.md.

  5. Before refreshing this skill against a newer Petals release, read references/repo-provenance.md.

Sub-skill routing

User intent Read this
Write client code for distributed generation, sequence classification, public/private swarm clients, AutoDistributedModel*, .generate(), inference_session, routing or retry options sub-skills/client-inference/SKILL.md
Host model blocks, start a server, bootstrap a private DHT, construct python -m petals.cli.run_server / run_dht commands, reason about ports, identities, cache, device, dtype, quantization, adapters, or reachability sub-skills/server-swarms/SKILL.md
Adapt a distributed model with tuning_mode="ptune" or "deep_ptune", train prompt embeddings/classifier heads, plan causal-LM or classification prompt tuning, or troubleshoot PEFT adapter safety sub-skills/prompt-tuning/SKILL.md
Work with RemoteSequential, block slices, hidden-state tensors, load_pretrained_block, QuantType, tensor parallel conversion, speculative Llama internals, dtype resolution, or block-level errors sub-skills/distributed-blocks/SKILL.md
Build benchmark command templates, plan tiny smoke checks, select focused native maintainer checks, or interpret benchmark/CI health signals sub-skills/benchmarks-maintenance/SKILL.md

Core operating model

  • Petals model classes are Transformers-compatible wrappers. Embeddings and heads live on the client; transformer blocks are discovered through a Hivemind DHT and executed by remote Petals servers.
  • The default public swarm is external: availability, hosted block coverage, peer latency, and gated model access can change independently of local package health.
  • Private swarms require consistent initial_peers, dht_prefix, model identifier, and block ranges across clients and servers.
  • Generation needs a remote attention-cache budget. Without an active session, pass exactly one of max_new_tokens or max_length; for interactive continuation, explicitly create and reuse inference_session(max_length=...).
  • Prompt tuning trains local prompt embeddings and, for classification models, local heads. The client does not update remote transformer blocks hosted by servers.
  • Server-side quantization and adapters are optional backend features. Verify the actual torch/CUDA/ROCm/MPS/bitsandbytes stack before claiming they work.

Install and minimal import

python -m pip install petals
python - <<'PY'
import petals
from petals import AutoDistributedModelForCausalLM
print(petals.__version__)
PY

For a checkout maintained by the user, use that checkout's package metadata to choose the Python version and dependencies, then run the same import check from outside the checkout directory. Do not treat import success as proof that a public swarm, gated model, GPU serving, or adapter loading is available.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351