executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
inference-pipelinesUse Transformers pipelines and AutoClass inference workflows across text, vision, audio, video, and multimodal tasks, with safe device, dtype, batching, offline, and validation choices.
Independent GitHub snapshot · Automated classification · Original documentation governs
Use this sub-skill when an agent needs high-level inference with transformers.pipeline() or needs to decide whether a Pipeline, AutoClass call, or lower-level generation workflow is the right fit.
generate(), streamers, decoding, generation config, or token-level control.trust_remote_code review.The inspected package exposes transformers.pipeline() with these important constructor choices:
from transformers import pipeline
pipe = pipeline(
task="text-classification",
model="distilbert/distilbert-base-uncased-finetuned-sst-2-english",
device=-1,
dtype="auto",
)
print(pipe("Transformers pipelines are convenient."))
Key parameters include task, model, config, tokenizer, feature_extractor, image_processor, video_processor, processor, revision, use_fast, token, device, device_map, dtype="auto", trust_remote_code, model_kwargs, pipeline_class, and task-specific **kwargs.
Use references/api-reference.md for task families, constructor parameters, expected input/output shapes, AutoClass alternatives, and validation checks.
task id and model id/local path; avoid relying on default models for reproducible code.revision for reproducible Hub loading.local_files_only=True for no-network validation.device=-1 or omit device; avoid batching unless measured.device=0; consider dtype="float16" only when supported.device="mps"; validate dtype support.device_map="auto" and do not also set device.Use references/workflows.md for complete patterns and copyable snippets.
This sub-skill bundles a dry-run-first helper:
python sub-skills/inference-pipelines/scripts/pipeline_smoke.py \
--task text-classification \
--model ./local-model \
--local-files-only
By default the script imports Transformers, checks task/model arguments, tries AutoConfig.from_pretrained(..., local_files_only=True) when a model is provided, and prints construction advice without downloading weights. Add --run only when the requested model and optional dependencies are available locally or network access is intended.
dtype="auto" for generic code; use explicit float16/bfloat16 only after confirming the backend and hardware support it.device and device_map; pipeline warns that device overrides device_map and can produce unexpected behavior.model_kwargs={...} for model-loading options, but do not duplicate dtype or device_map both top-level and inside model_kwargs.token=True or a token string only for private/gated Hub models; never hard-code secrets in skill examples or application code.trust_remote_code=False unless the model repository code has been reviewed and the workflow explicitly requires it.local_files_only=True and point model, tokenizer, processor, and config arguments to local directories.Validate outputs by task rather than assuming one shape:
label and score.generated_text; chat inputs may return generated message structures depending on task/model behavior.answer, score, start, and end when supported.text, optionally chunks when timestamps are requested.Use references/troubleshooting.md when you see:
device_map/device conflicts or placement warnings.trust_remote_code prompts or unsafe custom-code requirements.Text classification:
from transformers import pipeline
classifier = pipeline("text-classification", model="distilbert/distilbert-base-uncased-finetuned-sst-2-english")
result = classifier("Skill routing should be explicit.")
assert isinstance(result, list) and {"label", "score"} <= result[0].keys()
Image classification:
from transformers import pipeline
classifier = pipeline("image-classification", model="google/vit-base-patch16-224")
result = classifier(images="cat.png")
assert isinstance(result, list) and "score" in result[0]
ASR:
from transformers import pipeline
asr = pipeline("automatic-speech-recognition", model="openai/whisper-large-v3")
result = asr(audio="clip.flac", return_timestamps=True)
assert "text" in result
Text generation with Pipeline:
from transformers import pipeline
generator = pipeline("text-generation", model="openai-community/gpt2", max_new_tokens=20)
result = generator("A compact smoke test", return_full_text=False)
assert "generated_text" in result[0]
For detailed chat/generation trade-offs, route to generation.
This sub-skill distills Transformers 5.13.0.dev0 behavior from the README quickstart, quicktour, pipeline API docs, pipeline implementation, and pipeline tests. Runtime guidance is self-contained and does not require opening source files.