界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
效率与协作 · SKILL.md

layers-and-models

layers-and-models

【效率与协作】Use FLA layer, module, and Transformers model APIs for attention replacement, model construction, generation, training, and evaluation workflows.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: layers-and-models description: "Use FLA layer, module, and Transformers model APIs for attention replacement, model construction, generation, training, and evaluation workflows." disable-model-invocation: true metadata: disco-role: operating license: MIT

FLA Layers and Models

Use this sub-skill when the task is about constructing or smoke-checking Flash Linear Attention (FLA) layers, fused modules, or Transformers-compatible causal language models.

Route here for

  • Replacing a standard token-mixing or self-attention block with an FLA layer from fla.layers, such as GatedLinearAttention or KimiDeltaAttention.
  • Building a tiny or production FLA model with transformers.AutoModelForCausalLM.from_config(...) and config classes from fla.models.
  • Understanding hybrid attention plans through a model config's attn field.
  • Using fused modules such as RMSNorm or FusedLinearCrossEntropyLoss in model/loss code.
  • Planning generation, training, or evaluation flows for FLA models while identifying network, dataset, checkpoint, and GPU requirements.

Do not route here for

  • Kernel implementation internals, backend dispatch, Triton/Gluon/TileLang/CUDA/NPU optimization, or operator benchmark loops.
  • Full repository contribution readiness or PR packaging.
  • Native test execution. This sub-skill only provides safe API smoke helpers and distilled runtime guidance.

Minimal workflow

  1. Read references/api-reference.md for import surfaces, verified signatures, config knobs, return shapes, and known constraints.
  2. Read references/model-workflows.md for attention replacement, tiny AutoModelForCausalLM.from_config construction, hybrid attention plans, fused losses, generation, training, and evaluation recipes.
  3. If something fails to import, instantiate, or generate, consult references/troubleshooting.md before changing code.
  4. For a safe local sanity check that avoids downloads and native test suites, run from this sub-skill directory:
python scripts/smoke_layer_model.py --help
python scripts/smoke_layer_model.py --device cpu

Use --device cuda --require-cuda only when CUDA is intentionally part of the check.

Import rule of thumb

Import config classes from fla.models, not from top-level fla:

from fla.models import GLAConfig, KDAConfig
from transformers import AutoModelForCausalLM

model = AutoModelForCausalLM.from_config(GLAConfig())

Top-level fla exports many layer/model classes when optional imports succeed, but it deliberately omits names ending in Config.

我的收藏