custom-components
Implement and register custom YiVal readers, wrappers, evaluators, generators, enhancers, selection strategies, and output parsers.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- custom-components
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Implement and register custom YiVal readers, wrappers, evaluators, generators, enhancers, selection strategies, and output parsers.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/custom-component-patterns.md3.9 KB
- 参考文档references/custom-examples.md2.4 KB
- 参考文档references/registry-and-import-paths.md2.5 KB
- 参考文档references/troubleshooting.md2.1 KB
- 脚本scripts/write_component_skeleton.py4.7 KB
03 SKILL.md 正文
YiVal custom components
Use this sub-skill when the user needs to extend YiVal with a custom data reader, wrapper, evaluator, data generator, variation generator, enhancer, selection strategy, or output parser, or when a YAML custom_* section fails to register.
Read first
- Custom component patterns: base classes, required methods, config dataclasses, and YAML registration.
- Registry and import paths: how YiVal resolves custom classes.
- Custom examples: concise examples for common custom components.
- Custom troubleshooting: import, config, and registry failures.
Useful helper:
python sub-skills/custom-components/scripts/write_component_skeleton.py --kind evaluator --output-dir ./my_yival_componentswrites small starter files for selected component kinds.
Custom YAML sections
| Component | YAML section | Base class |
|---|---|---|
| Reader | custom_reader |
yival.data.base_reader.BaseReader |
| Wrapper | custom_wrappers |
yival.wrappers.base_wrapper.BaseWrapper |
| Evaluator | custom_evaluators |
yival.evaluators.base_evaluator.BaseEvaluator |
| Data generator | custom_data_generators |
yival.data_generators.base_data_generator.BaseDataGenerator |
| Variation generator | custom_variation_generators |
yival.variation_generators.base_variation_generator.BaseVariationGenerator |
| Selection strategy | custom_selection_strategies |
yival.result_selectors.selection_strategy.SelectionStrategy |
| Enhancer | custom_enhancers |
yival.enhancers.base_combination_enhancer.BaseCombinationEnhancer |
General runtime form:
custom_evaluators:
simple_evaluator:
class: my_components.simple_evaluator.SimpleEvaluator
config_cls: my_components.simple_evaluator.SimpleEvaluatorConfig
Then use the registry id in the normal section:
evaluators:
- name: simple_evaluator
evaluator_type: individual
metric_calculators: []
Implementation checklist
- Put the custom module on
PYTHONPATHor install it in the active environment. - Define a dataclass config that inherits the matching YiVal base config class when one exists.
- Subclass the correct base class and implement the required abstract method.
- Set
default_configon the class if config generation/default lookup should work. - Add the correct
custom_*YAML block withclassandconfig_cls. - Reference the custom id in
dataset.reader,dataset.data_generators,variations[].generator_name,evaluators[].name,selection_strategy, orenhancer.name. - Run a tiny no-network fixture before provider-backed work.
Important import-path behavior
YiVal's helper _get_class_from_path() splits a dotted class path into a module path and class name. For ordinary installed modules, use package.module.ClassName. For ad-hoc files, put the parent directory on PYTHONPATH and still use a dotted module path.
Avoid relying on absolute filesystem strings in reusable configs; install or package the custom module where possible.
Route elsewhere
- Use setup for base YAML generation/validation.
- Use run for executing experiments and inspecting output pickles.
- Use evaluation-optimization for custom evaluator semantics, AHP metrics, and enhancer behavior.
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).