Skip to content

refactor(llm): Split layers.py by layer type #142

@m96-chan

Description

@m96-chan

Problem

src/pygpukit/llm/layers.py is 1491 lines with all layer implementations.

Current State

src/pygpukit/llm/
└── layers.py  (1491 lines - all layers)

Proposed Structure

src/pygpukit/llm/layers/
├── __init__.py          (exports)
├── base.py              (BaseLayer)
├── attention.py         (Attention, GQA, MHA)
├── mlp.py               (MLP, GatedMLP, SwiGLU)
├── norm.py              (RMSNorm, LayerNorm wrappers)
├── embedding.py         (TokenEmbedding, PositionEmbedding)
└── block.py             (TransformerBlock)

Benefits

  • Each layer type in its own file
  • Easier to understand layer implementations
  • Clear dependencies between layers
  • Easier testing per layer type

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions