adapter-core
Core PEFT adapter setup, configuration, target module selection, adapter lifecycle, model/layer status diagnostics, custom models, and low-level adapter injection.
- License 许可
- Apache-2.0
- 最近更新
- 2026-10-08
- Stars
- ★ 11
- Forks
- 3
01 前言 Front Matter
- name
- adapter-core
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Core PEFT adapter setup, configuration, target module selection, adapter lifecycle, model/layer status diagnostics, custom models, and low-level adapter injection.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/api-reference.md7.9 KB
- 参考文档references/troubleshooting.md8.0 KB
- 参考文档references/workflows.md7.2 KB
03 SKILL.md 正文
Adapter Core
Use this sub-skill when the task is about constructing PEFT configs, wrapping a model with adapters, managing adapters after creation, diagnosing adapter state, targeting modules in custom models, or using low-level adapter injection.
Route Here For
- Install/import smoke checks for
peft,torch,transformers, andacceleratewithout downloading models. - Core API choices:
PeftConfig,TaskType,PeftType,get_peft_model,PeftModel, and adapter names. - Adapter lifecycle: add, load, activate, disable, delete, inspect trainable parameters, and inspect model/layer status.
- Target module selection for custom or non-Transformers
torch.nn.Modulemodels. - Low-level injection with
inject_adapter_in_modelwhen aPeftModelwrapper is not desired. - Diagnosing invalid task/PEFT types, missing target modules, unsupported module classes, or unexpected trainable status.
Route Elsewhere
- LoRA variants, quantized loading, DoRA, rsLoRA, QLoRA-style workflows, and LoRA-specific initialization: use
../lora-and-quantization/SKILL.md. - Prompt tuning, prefix tuning, p-tuning, soft prompts, or prompt encoder internals: use
../prompt-and-soft-methods/SKILL.md. - Saving, loading checkpoints, merging adapters into base weights, or deployment packaging: use
../save-load-merge/SKILL.md. - Trainer, Accelerate, distributed, FSDP, DeepSpeed, or multi-GPU training integration: use
../training-and-integrations/SKILL.md.
Start Fast
- Run
python scripts/check_peft_env.pyfrom this sub-skill directory to verify imports and local package facts. - Read
references/api-reference.mdfor the core class/function surface and common enum values. - Follow
references/workflows.mdfor adapter construction, custom model targeting, lifecycle management, and low-level injection. - Use
references/troubleshooting.mdwhen errors mention invalid task types, missingtarget_modules, unsupported modules, adapter status irregularities, or optional dependency imports.
Core Decision Pattern
- Prefer
get_peft_model(base_model, peft_config, adapter_name="default")for normal Transformers and custom PyTorch models when PEFT should return aPeftModelwrapper with helper methods. - Use explicit
target_modulesfor custom models unless the method and architecture have a known PEFT default mapping. - Use
modules_to_savefor non-adapter layers that must remain trainable and be stored with the adapter, such as custom heads or task heads. - Use
print_trainable_parameters(),get_model_status(), andget_layer_status()before training when trainable counts, active adapters, or merged/disabled states look surprising. - Use low-level
inject_adapter_in_model(peft_config, model, adapter_name=...)only when the caller needs adapter layers in a plaintorch.nn.Moduleand does not needPeftModelhelper methods.
Bundled Materials
references/api-reference.md: API inventory, enum usage, config validation, lifecycle helpers, and status helpers.references/workflows.md: practical recipes for standard wrapping, custom modules, target discovery, adapter lifecycle, and low-level injection.references/troubleshooting.md: diagnosis paths for target module, enum, trainability, optional dependency, custom module, and low-level injection failures.scripts/check_peft_env.py: safe local import/config smoke check with--help, JSON output option, and optional CUDA facts.
04 同仓库更多 Skills
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
python-api
Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP/mAP semantics, and source-style import diagnostics.
file-evaluation
Folder-based PASCAL VOC AP/mAP evaluation from ground-truth and detection text files.
object-detection-metrics
Guides legacy Object-Detection-Metrics PASCAL VOC AP/mAP evaluation from detection text folders and direct Python API classes.
nx-workspace-patterns
Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.