技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
dataset-and-prompts【数据与研究】Guides Stanford Alpaca dataset schema, prompt formatting, label masking, validation, intended use, and license checks.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when the task is about the released Alpaca instruction dataset, Alpaca-style data files, prompt rendering, source/target construction, label masking, or pre-flight validation before training or generation.
alpaca_data.json record schema and the verified 52,002-row release count.input and records with an empty input.train.py constructs sources, appends the tokenizer EOS token to targets, and masks prompt labels with IGNORE_INDEX = -100.instruction-generation at ../instruction-generation/SKILL.md.fine-tuning at ../fine-tuning/SKILL.md.weight-diff-recovery at ../weight-diff-recovery/SKILL.md.../../SKILL.md.Start with the offline validator; it never calls OpenAI, downloads models, imports Torch, or reads the original repository.
python scripts/validate_alpaca_data.py path/to/alpaca_or_generated.json --preview 2
For the public release, expect a JSON array with exactly 52,002 objects and the keys instruction, input, and output on every row:
python scripts/validate_alpaca_data.py alpaca_data.json --expect-count 52002
For generated data handoff, validate JSONL or JSON first, then send schema-clean examples to instruction-generation if the question is about producing more examples or to fine-tuning if the question is about training with the file.
Treat empty input as valid: it selects the no-input prompt template. Treat missing input as invalid because the released dataset uses the key on every row.
Treat blank output as a warning by default because the released dataset contains a small number of blank outputs; use --require-nonempty-output when building a stricter training corpus.
train.PROMPT_DICT keys are prompt_input and prompt_no_input.train.preprocess signature is preprocess(sources, targets, tokenizer) -> Dict.SupervisedDataset loads a JSON list, selects the prompt template with example.get("input", "") != "", and sets each target to output + tokenizer.eos_token.preprocess tokenizes source + target and the source alone, then masks prompt-token labels with -100 so loss is only taken on the response portion.DataCollatorForSupervisedDataset pads input_ids with tokenizer.pad_token_id, pads labels with -100, and returns attention_mask = input_ids.ne(tokenizer.pad_token_id).Before training or generation, confirm:
instruction, input, and output fields.instruction is non-empty after trimming whitespace.output rows are intentional, filtered, or accepted by the downstream owner.