算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
template-verbalizer-design【设计与创意】Design, load, validate, and troubleshoot OpenPrompt templates, verbalizers, calibration, LM-BFF generators, and bundled prompt assets without depending on the original repository checkout.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when a task asks you to write or debug OpenPrompt prompt components: template grammar, hard/mixed/soft/prefix/P-tuning/PTR templates, manual/one2one/knowledgeable/automatic/generation/soft/proto/PTR verbalizers, LM-BFF template or label-word generation, calibration, or prompt asset files.
Do not use this sub-skill for full training loops, dataset acquisition, runner selection, or benchmark reproduction. Route those to the OpenPrompt data/config and training/generation sub-skills when available.
OpenPrompt separates prompt design into two cooperating objects:
Template wraps each InputExample into pieces containing literal text, placeholders from text_a/text_b or meta, soft tokens, special tokens, and one or more mask positions.Verbalizer maps language-model outputs at mask positions into task labels, usually through label words.The most common failure mode is treating template text, class order, and label-word files as independent. They are coupled:
{"mask"};PTRVerbalizer or generation logic;Choose the prompt family.
ManualTemplate + ManualVerbalizer.MixedTemplate or PtuningTemplate.PrefixTuningTemplate.SoftTemplate; learned head verbalizer: SoftVerbalizer.PTRTemplate + PTRVerbalizer.GenerationVerbalizer.T5TemplateGenerator, RobertaVerbalizerGenerator, or AutomaticVerbalizer.Write the template string. Use OpenPrompt's Python-dict-like grammar: {"placeholder": "text_a"}, {"placeholder": "text_b"}, {"meta": "field"}, {"mask"}, {"text": "literal"}, {"special": "<sep>"}, {"soft"}, {"soft": "seed text"}, and optional shortenable, post_processing, soft_id, duplicate, or same attributes.
Choose class mapping. For dict verbalizers, pass classes=[...] matching dataset labels exactly. For list/text verbalizers, ensure the file line order matches label ids.
Load from code or assets. Use from_file(path, choice=...) for one-line-per-template files and OpenPrompt verbalizer files. Use the bundled assets under references/prompt-assets/scripts/ when you need repo-maintained examples without the original checkout.
Validate before model work. Run the bundled static validator:
python scripts/validate_prompt_assets.py
# or, from this sub-skill directory:
python scripts/validate_prompt_assets.py --assets-dir references/prompt-assets/scripts
Add --tokenizer /path-or-name --allow-remote-tokenizer only if the user permits downloads; otherwise it uses local tokenizer files only.
Only then connect training. PromptForClassification extracts model outputs at loss_ids > 0, then the verbalizer processes them. PromptForGeneration and GenerationVerbalizer use generation-style targets instead of fixed class label words.
references/api-reference.md — class signatures, loader keys, base method behavior, and file format contracts.references/workflows.md — tested design workflows for manual/mixed/soft/PTR/generation/LM-BFF/calibration usage.references/troubleshooting.md — common grammar, mask, prefix-space, class-order, tokenizer, calibration, and file-format failures.references/prompt-assets.md — bundled asset corpus layout, adaptation notes, and validation policy.references/prompt-assets/scripts/ — self-contained copy/adaptation of the repo scripts/**/*.txt|json|jsonl prompt assets.scripts/validate_prompt_assets.py — static checker for bundled or user-supplied prompt assets.This sub-skill was distilled from OpenPrompt commit f6fb080ef755c37c01b7959e7560d007049510e8 using openprompt/prompt_base.py, openprompt/prompts/*.py, openprompt/utils/calibrate.py, docs/source/notes/template.rst, docs/source/notes/verbalizer.rst, tutorials 1.*, 3.1_LMBFF.py, 4.1_all_tasks_are_generation.py, and the repository scripts/ prompt assets.
.txt, .json, or .jsonl formats.