Skip to content

refactor(llm): Clean up __init__.py - move logic to dedicated modules #143

Closed

Description

@m96-chan

Problem

src/pygpukit/llm/__init__.py is 688 lines with too much logic that should be in dedicated modules.

Current State

src/pygpukit/llm/
└── __init__.py  (688 lines - imports + logic)

Issues

  • __init__.py should primarily be exports
  • Contains initialization logic that belongs elsewhere
  • Hard to understand module structure
  • Circular import risks

Proposed Changes

  1. Move model loading logic to loader.py
  2. Move configuration to config.py
  3. Keep only exports in __init__.py
  4. Target: < 100 lines in __init__.py

Proposed Structure

# __init__.py (< 100 lines)
from pygpukit.llm.models import QwenModel, LlamaModel
from pygpukit.llm.loader import load_model, from_safetensors
from pygpukit.llm.config import ModelConfig
from pygpukit.llm.chat import ChatSession

__all__ = [...]

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