towhee
Route Towhee pipeline, operator, data utility, service, Triton, training, and model-zoo tasks to self-contained workflow guidance.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- towhee
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Route Towhee pipeline, operator, data utility, service, Triton, training, and model-zoo tasks to self-contained workflow guidance.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/installation-and-compatibility.md3.9 KB
- 参考文档references/repo-provenance.md2.4 KB
- 参考文档references/repo-routing-metadata.json511 B
- 参考文档references/troubleshooting.md4.5 KB
- 脚本scripts/check_towhee_environment.py4.9 KB
03 SKILL.md 正文
Towhee Repo Skill
Use this skill when the user asks about Towhee, x2vec, Towhee Hub operators, towhee.pipe, towhee.ops, AutoPipes, AutoConfig, DataCollection, towhee server, APIService, Triton packaging for Towhee pipelines, or optional Towhee training/model-zoo workflows.
Towhee 1.1.x is a Python framework for orchestrating unstructured-data pipelines over text, image, audio, video, embeddings, retrieval, service wrapping, and optional Triton deployment. This generated skill is self-contained; do not reopen the original repository checkout for normal operation.
First checks
-
Read installation and compatibility when the task starts with install/import failures, package versions, optional dependency choices, or environment setup.
-
Run the safe root diagnostic when the user wants proof that a Towhee environment is usable:
python scripts/check_towhee_environment.py --verboseThe helper verifies imports, a local lambda pipeline, batch execution,
Entity.combine,APIService, and CLI help. It does not download Hub operators, start web servers, run Docker/Triton, use GPUs, or train models. -
Read root troubleshooting for cross-cutting import,
pkg_resources, Pydantic, Hub/cache, optional dependency, service, Docker, or Triton issues. -
Read repo provenance before deciding whether this skill is stale for a different Towhee checkout.
Route by task
| User task | Read next |
|---|---|
Build or debug a custom method-chained pipeline with pipe.input(...).map(...).output(...), flat_map, filter, window, concat, batch, debug, flush, AutoConfig, or AutoPipes |
pipeline-programming |
Use ops, register local operators, choose Hub operator revisions, validate towhee CLI help, or reason about towhee init side effects |
operator-hub-and-cli |
Wrap a pipeline/function as an API service, plan towhee server, HTTP/GRPC routes, Triton model repositories, Docker images, build_pipeline_model, or build_docker_image |
serving-and-triton |
Convert pipeline results with DataCollection, use Entity, DataLoader, media array wrappers, display tables, serialization, visualizer, tracer, or profiler outputs |
data-utilities |
Configure optional PyTorch training, TrainingConfig, Trainer, NNOperator.train, checkpoints/model cards, or decide whether to install towhee.models |
training-and-models |
Common safe patterns
Minimal local pipeline
from towhee import AutoConfig, pipe
p = (
pipe.input('x')
.map('x', 'y', lambda x: x + 1, config=AutoConfig.LocalCPUConfig())
.output('y')
)
print(p(2).get()) # [3]
Start with local lambdas/callables to validate schema and graph shape before introducing Hub operators, model downloads, Triton, or training.
Hub/model operators
Hub operators are accessed through ops, for example ops.image_embedding.timm(...) or ops.namespace.operator(...). Treat Hub resolution as potentially networked and dependency-installing. Pin revisions when reproducibility matters and use the operator/CLI sub-skill for local registration or towhee init guidance.
Service and deployment
Construct APIService objects or api_service.build_service(...) before starting live HTTP/GRPC servers. Use object-level smoke checks first; only run towhee server, Docker, Triton, or GPU/CUDA commands after confirming ports, dependencies, artifacts, cleanup, and user approval.
Optional training and model zoo
Towhee's training/model surfaces are optional and PyTorch-centered. Use CPU-safe config templates first. Do not import trainer/model modules in a constrained environment unless optional package installation is acceptable; Towhee dependency helpers can auto-install missing packages.
Known compatibility flags
- Towhee 1.1.x imports
pkg_resources; if import fails withNo module named 'pkg_resources', install a compatible setuptools such assetuptools<81. - The repo's own test requirements use
pydantic<2; prefer Pydantic v1 for old Towhee service workflows unless the exact Pydantic v2 path has been tested. - GPU, Docker/Triton, live HTTP/GRPC service, Hub downloads, and real model training are optional workflow checks, not proof from a base Towhee import.
04 同仓库更多 Skills
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.
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.
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.
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.
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.
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).