Skip to content

Refactor#11

Merged
kamil271e merged 6 commits intomainfrom
refactor
Dec 20, 2025
Merged

Refactor#11
kamil271e merged 6 commits intomainfrom
refactor

Conversation

@kamil271e
Copy link
Owner

Bug fixes: Fixed torch.clamp symmetric bounds, uninitialized class attributes, infinite loop risk, and nn.ReLU instantiation.

Code restructure: Moved extraction_framework to src/, removed sys.path hacks, wrapped module-level code in main guards, refactored config.py to dataclasses.

Code quality: Removed redundant dtype calls, cleaned up init.py exports, deleted pass-through ClassicExtractor.

Testing: Added pytest/coverage setup with 35 tests covering core utilities, models, and recovery functions.

Documentation: Created docs/ with installation, usage, and API reference.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements comprehensive refactoring with bug fixes, improved code structure, testing infrastructure, and documentation. The changes enhance code quality, maintainability, and developer experience.

Key Changes:

  • Fixed critical bugs in torch.clamp bounds, nn.ReLU instantiation, and infinite loop detection
  • Restructured codebase by removing sys.path hacks, adding main guards, and refactoring config to dataclasses
  • Added pytest/pytest-cov setup with 35 tests covering utilities, models, and recovery functions
  • Created comprehensive documentation including installation, usage, and API reference

Reviewed changes

Copilot reviewed 31 out of 33 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
uv.lock Added coverage 7.13.0 and pytest ecosystem packages for testing
pyproject.toml Added dev dependencies, pytest configuration, and coverage settings
src/extraction_framework/inverse_activation.py Fixed torch.clamp symmetric bounds bug (-max_abs, max_abs)
src/extraction_framework/extraction_framework.py Fixed infinite loop with proper convergence detection, initialized class attributes
src/models/autoencoder.py Fixed nn.ReLU instantiation, removed dtype setting, cleaned up type hints
src/models/softmax_bottleneck_model.py Removed dtype setting and cleaned up imports
src/models/sphere_model.py Removed redundant dtype configuration
src/config.py Refactored to dataclasses for cleaner configuration management
src/spectra/utils.py Removed sys.path hacks and consolidated imports
src/spectra/run.py Removed sys.path hacks, improved path handling with proper directory constants
src/research/emb_dataset.py Wrapped module-level code in main guard
src/research/extraction_framework/classic_extractor.py Deleted pass-through class
src/extraction_framework/main.py Simplified framework usage after ClassicExtractor removal
src/extraction_framework/svd_classifier.py New file for SVD dimension classification
src/*/init.py Added proper exports for public APIs
tests/*.py Added 35 tests with comprehensive coverage of core functionality
tests/conftest.py Added shared test fixtures
docs/*.md Created comprehensive documentation
Makefile Added test, coverage, and lint targets
.github/workflows/code-quality.yml Added test job to CI pipeline
.github/actions/setup/action.yml Added dev dependency sync step

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kamil271e kamil271e merged commit 4879b2a into main Dec 20, 2025
6 checks passed
@kamil271e kamil271e deleted the refactor branch December 20, 2025 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants