Skip to content

Commit 75865fc

Browse files
authored
Merge pull request #3 from Klus3kk/main
pulling changes from main
2 parents 28c7c9a + 73344b6 commit 75865fc

File tree

124 files changed

+18358
-4018
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+18358
-4018
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,43 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main, master, dev ]
5+
branches: [main, develop]
66
pull_request:
7-
branches: [ main, master ]
7+
branches: [main]
88

99
jobs:
10-
test:
10+
lint:
1111
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-python@v4
15+
with:
16+
python-version: '3.10'
17+
- name: Install dependencies
18+
run: |
19+
pip install pre-commit
20+
pre-commit install
21+
- name: Run pre-commit
22+
run: pre-commit run --all-files
23+
24+
test:
25+
needs: lint
26+
runs-on: ${{ matrix.os }}
1227
strategy:
1328
matrix:
14-
python-version: [3.8, 3.9, '3.10']
15-
29+
os: [ubuntu-latest, macos-latest, windows-latest]
30+
python-version: ['3.8', '3.9', '3.10', '3.11']
31+
1632
steps:
17-
- uses: actions/checkout@v3
18-
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v4
20-
with:
21-
python-version: ${{ matrix.python-version }}
22-
- name: Install dependencies
23-
run: |
24-
python -m pip install --upgrade pip
25-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
26-
pip install pytest pytest-cov flake8 black
27-
pip install -e .
28-
- name: Format with black
29-
run: |
30-
# Format the code with black before checking
31-
black .
32-
# Check if any changes were made
33-
git diff --exit-code || { echo "Code was not properly formatted before commit. Black has fixed the formatting issues."; exit 0; }
34-
- name: Lint with flake8
35-
run: |
36-
# stop the build if there are Python syntax errors or undefined names
37-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
38-
# exit-zero treats all errors as warnings
39-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
40-
- name: Test with pytest
41-
run: |
42-
pytest --cov=./ --cov-report=xml
43-
- name: Upload coverage to Codecov
44-
uses: codecov/codecov-action@v3
45-
with:
46-
file: ./coverage.xml
47-
fail_ci_if_error: false
33+
- uses: actions/checkout@v3
34+
- uses: actions/setup-python@v4
35+
with:
36+
python-version: ${{ matrix.python-version }}
37+
- name: Install dependencies
38+
run: |
39+
pip install -e ".[dev]"
40+
- name: Run tests
41+
run: |
42+
pytest tests/ --cov=fit --cov-report=xml
43+
- name: Upload coverage
44+
uses: codecov/codecov-action@v3

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
test.py
2-
*/__pycache__
2+
__pycache__/
33
logs
4-
fit.egg-info
54
.venv
65
.idea
6+
venv
7+
mnist_model.pkl
8+
*.png
9+
fit.egg-info

.pre-commit-config.yaml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ repos:
99
- id: debug-statements
1010
- id: check-merge-conflict
1111

12-
#- repo: https://github.com/psf/black
13-
# rev: 23.3.0
14-
# hooks:
15-
# - id: black
16-
# args: [--line-length=100]
12+
- repo: https://github.com/psf/black
13+
rev: 23.3.0
14+
hooks:
15+
- id: black
16+
args: [--line-length=80]
1717

18-
#- repo: https://github.com/pycqa/flake8
19-
# rev: 6.0.0
20-
# hooks:
21-
# - id: flake8
22-
# args: [--max-line-length=100]
23-
# additional_dependencies: [flake8-docstrings]
18+
- repo: https://github.com/pycqa/flake8
19+
rev: 6.0.0
20+
hooks:
21+
- id: flake8
22+
args: [--max-line-length=80]
23+
additional_dependencies: [flake8-docstrings]
2424

25-
#- repo: https://github.com/pycqa/isort
26-
# rev: 5.12.0
27-
# hooks:
28-
# - id: isort
29-
# args: [--profile=black]
25+
- repo: https://github.com/pycqa/isort
26+
rev: 5.12.0
27+
hooks:
28+
- id: isort
29+
args: [--profile=black]

CHANGELOG.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Changelog
2+
3+
## Why This Major Restructuring?
4+
5+
When I started developing FIT framework I wanted it to be as an educational project to understand deep learning from first principles. But after some initial development, I was coming up with more and more ideas, so tgat the project would be useful for the public usage:
6+
7+
1. **Scale Beyond Educational Use**: Transform from a learning project into a production-ready framework
8+
2. **Meet Professional Standards**: Align with industry best practices for ML frameworks
9+
3. **Ensure Long-term Viability**: Build a sustainable project architecture
10+
11+
### Complete Project Restructuring
12+
13+
#### **Previous Issues**
14+
- **Flat Structure**: Mixed organization with some modules in root, others scattered
15+
- **Unclear Imports**: Inconsistent import paths (`from train.optim import Adam` vs `from nn.linear import Linear`)
16+
- **Limited Testing**: Basic test coverage without proper organization
17+
- **No CI/CD**: Manual testing and deployment
18+
- **Minimal Documentation**: Lack of comprehensive docs and examples
19+
- **Code Quality**: Inconsistent style, missing type hints, print-based debugging
20+
21+
### Added
22+
23+
#### **Core Improvements**
24+
- **Exception Hierarchy**: Custom exceptions for better error handling
25+
- `TensorError`, `ShapeError`, `AutogradError` for specific error types
26+
- Detailed error messages with context
27+
- **Logging System**: Professional logging replacing print statements
28+
- Colored console output
29+
- File logging support
30+
- Performance tracking
31+
- **Configuration Management**: Centralized configuration system
32+
- YAML config support
33+
- Environment variable integration
34+
- Validation and type checking
35+
- **Type Annotations**: Full type hints throughout the codebase
36+
- **Memory Management**: Tensor caching and memory profiling
37+
38+
#### **Development Infrastructure**
39+
- **CI/CD Pipeline**: GitHub Actions for automated testing
40+
- Multi-OS testing (Ubuntu, macOS, Windows)
41+
- Multiple Python versions (3.8-3.11)
42+
- Automated benchmarking
43+
- Coverage reporting
44+
- **Code Quality Tools**:
45+
- Pre-commit hooks (black, isort, flake8, mypy)
46+
- Automated code formatting
47+
- Style consistency enforcement
48+
- **Documentation System**:
49+
- Sphinx-based API documentation
50+
- Tutorials and guides
51+
- Example gallery
52+
53+
#### **New Features**
54+
- **Enhanced Optimizers**:
55+
- SAM (Sharpness-Aware Minimization) with adaptive mode
56+
- Lion optimizer with memory efficiency
57+
- Learning rate schedulers
58+
- **Advanced Layers**:
59+
- Spectral Normalization
60+
- Neural ODEs with multiple solvers
61+
- Attention mechanisms (planned)
62+
- **Improved Data Pipeline**:
63+
- Better DataLoader with sampling strategies
64+
- Transform pipeline
65+
- Memory-efficient data handling
66+
67+
### Changed
68+
69+
#### **Module Organization**
70+
- **Before**: `from train.optim import Adam`
71+
- **After**: `from fit.optim.adam import Adam`
72+
- Clear separation between stable and experimental features
73+
- Consistent import paths
74+
75+
#### **API Improvements**
76+
- Tensor operations now support method chaining
77+
- Consistent parameter names across modules
78+
- Better default values based on best practices
79+
80+
#### **Error Messages**
81+
- **Before**: `ValueError: shapes not aligned`
82+
- **After**: `ShapeError: Cannot multiply tensors with shapes (2, 3) and (4, 5). Expected shapes to be compatible for matrix multiplication.`
83+
84+
### Fixed
85+
- Memory leaks in autograd graph
86+
- Numerical instability in softmax computation
87+
- Broadcasting issues in tensor operations
88+
- Gradient accumulation bugs
89+
- Thread safety issues in data loading
90+
91+
### Testing
92+
- Unit tests for all core functionality
93+
- Integration tests for common workflows
94+
- Performance benchmarks
95+
- Gradient checking tests
96+
97+
### Breaking Changes
98+
- Import paths have changed
99+
- Some internal APIs renamed for consistency
100+
- Removed deprecated functions
101+
- Default dtype changed from float64 to float32
102+
103+
### Future Plans
104+
- GPU support via CuPy
105+
- Distributed training
106+
- JIT compilation
107+
- Model deployment utilities
-143 Bytes
Binary file not shown.
-724 Bytes
Binary file not shown.
File renamed without changes.

0 commit comments

Comments
 (0)