Thank you for your interest in contributing! This document provides guidelines for contributing to the project.
-
Clone the repository:
git clone https://github.com/0DevDutt0/deep-learning-model-scaling-analysis.git cd deep-learning-model-scaling-analysis -
Create a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install the package in development mode:
pip install -e ".[dev]" -
Install pre-commit hooks:
pre-commit install
# Run all tests
pytest
# Run with coverage
pytest --cov
# Run specific test file
pytest tests/unit/test_models.py
# Run specific test
pytest tests/unit/test_models.py::test_small_cnn_parameter_countWe use several tools to maintain code quality:
# Format code
ruff format .
# Lint code
ruff check .
# Fix auto-fixable issues
ruff check --fix .
# Type check
mypy src testsPre-commit hooks run automatically before each commit. To run manually:
pre-commit run --all-files- Follow PEP 8 guidelines
- Use type hints for all function signatures
- Write Google-style docstrings
- Keep line length to 100 characters
- Use meaningful variable names
def train_model(
model: nn.Module,
data_loader: DataLoader,
epochs: int,
learning_rate: float = 0.001,
) -> tuple[float, float]:
"""Train a PyTorch model on the provided data.
Args:
model: The neural network model to train.
data_loader: DataLoader containing training data.
epochs: Number of training epochs.
learning_rate: Learning rate for the optimizer. Defaults to 0.001.
Returns:
A tuple containing (final_accuracy, training_time).
Raises:
ValueError: If epochs is less than 1.
"""
# Implementation
pass- Write tests for all new features
- Maintain test coverage above 80%
- Use descriptive test names
- Use fixtures for common setup
- Mock external dependencies
def test_feature_name_expected_behavior():
"""Test that feature_name produces expected behavior."""
# Arrange
input_data = create_test_data()
# Act
result = function_under_test(input_data)
# Assert
assert result == expected_value-
Create a feature branch from
main:git checkout -b feature/your-feature-name
-
Make your changes and commit:
git add . git commit -m "feat: add your feature description"
-
Push to your fork:
git push origin feature/your-feature-name
-
Open a Pull Request with:
- Clear description of changes
- Link to related issues
- Test results
- Documentation updates
We follow Conventional Commits:
feat:New featurefix:Bug fixdocs:Documentation changestest:Test additions or changesrefactor:Code refactoringperf:Performance improvementschore:Maintenance tasks
When reporting issues, please include:
- Python version
- Operating system
- Steps to reproduce
- Expected vs actual behavior
- Relevant code snippets or error messages
Feel free to open an issue for questions or clarifications!