engine-api
Use SnipsNLUEngine's Python API for fitting datasets, parsing text, inspecting intents and slots, configuring training, and persisting or loading engines.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- engine-api
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use SnipsNLUEngine's Python API for fitting datasets, parsing text, inspecting intents and slots, configuring training, and persisting or loading engines.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-reference.md6.0 KB
- 参考文档references/configuration-and-persistence.md5.4 KB
- 参考文档references/troubleshooting.md6.7 KB
- 参考文档references/workflows.md4.4 KB
- 脚本scripts/snips_nlu_engine_smoke.py8.3 KB
03 SKILL.md 正文
Snips NLU engine API
Use this sub-skill when the task is to operate Snips NLU through Python code:
create a SnipsNLUEngine, fit an already-valid dataset, parse user text,
retrieve intent or slot-only outputs, control random state or force_retrain,
and persist or load an engine artifact.
Route here when
- The user has a Snips dataset dict or JSON file and wants Python API code.
- The task involves
SnipsNLUEngine.fit,parse,get_intents,get_slots,persist,from_path, orNLUEngineConfig. - The user needs to understand parsing result shapes, None-intent behavior,
intent filters,
top_n, or model-version/resource persistence behavior.
Route elsewhere
- Dataset YAML/JSON authoring, resource acquisition details, or dataset schema
repair: read
../dataset-and-resources/SKILL.md. - CLI commands, batch command lines, command metrics, or evaluation workflows:
read
../cli-workflows/SKILL.md. - Custom processing-unit implementation: use this sub-skill only for how such
units are plugged into
NLUEngineConfig; keep implementation details outside this engine API route unless the task explicitly asks for integration code.
Required references
Read only the references needed for the task:
references/api-reference.mdfor signatures, result shapes, None intent, filters,top_n,get_intents, andget_slots.references/workflows.mdfor fit/parse code patterns and the bundled smoke helper usage.references/configuration-and-persistence.mdfor default language configs, random state,force_retrain, resources, and persisted model compatibility.references/troubleshooting.mdwhen exceptions, missing resources, nondeterminism, loading failures, or dependency/Python-version issues appear.
Safe helper
For a quick API smoke test against a user-provided dataset JSON, run the bundled helper from this sub-skill directory:
python scripts/snips_nlu_engine_smoke.py \
--dataset path/to/dataset.json \
--query "turn on the kitchen lights" \
--intent-filter sampleTurnOnLight \
--top-n 2
The helper never uses an embedded source-relative dataset path and never overwrites an existing persistence directory. It prints a JSON report and, when language resources are unavailable, reports the resource name and next steps.
Operating guardrails
- Treat a fitted engine as required before parsing or retrieving intents/slots.
- Pass Python
strtext, not bytes, intoparseorget_slots. - Preserve
None/JSONnullintent semantics: intent filters do not remove the None intent, andget_slots(text, None)returns an empty list. - Do not promise probabilities sum to 1.0; they are confidence scores.
- For reproducible training, pass a fixed
random_statetoSnipsNLUEngineand keep the same package/model version and language resources. - Do not load persisted engines across incompatible Snips NLU model versions
unless the caller deliberately accepts
bypass_version_check=Truerisk.
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).