Skip to content

refactor(llm): Simplify loader.py - extract format-specific loaders #144

Closed

Description

@m96-chan

Problem

src/pygpukit/llm/loader.py is 1015 lines handling multiple model formats.

Current State

src/pygpukit/llm/
└── loader.py  (1015 lines - all formats)

Proposed Structure

src/pygpukit/llm/loaders/
├── __init__.py          (unified load interface)
├── base.py              (BaseLoader)
├── safetensors.py       (SafeTensors loader)
├── gguf.py              (GGUF loader - future)
├── hf_hub.py            (HuggingFace Hub download)
└── weight_map.py        (weight name mapping)

Benefits

  • Each format loader isolated
  • Easier to add new formats (GGUF, AWQ, etc.)
  • Clear loader interface
  • Better error handling per format

API

from pygpukit.llm.loaders import load_model

# Auto-detect format
model = load_model('path/to/model')

# Explicit format
model = load_model('path/to/model', format='safetensors')

Related

Activity

  1. m96-chan commented on Dec 30, 2025

    @m96-chan
    OwnerAuthor

    Completed in PR #168

  2. added a commit that references this issue on Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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