Conversation
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.