TorchEBM Developer Guide¶
Welcome to the TorchEBM developer guide! This comprehensive resource is designed to help you understand the project's architecture, contribute effectively, and follow best practices when working with the codebase.
Getting Started with Development¶
-
Development Setup
Set up your development environment and prepare for contribution.
-
Code Style
Learn about the coding standards and style guidelines.
-
Testing Guide
Discover how to write and run tests for TorchEBM.
-
:material-git-commit:{ .lg .middle } Commit Conventions
Understand the commit message format and conventions.
Understanding the Architecture¶
-
Project Structure
Explore the organization of the TorchEBM codebase.
-
Design Principles
Learn about the guiding principles behind TorchEBM.
-
Core Components
Understand the core components and their interactions.
Implementation Details¶
-
Energy Functions
Detailed information about energy function implementations.
-
Samplers
Understand how samplers are implemented in TorchEBM.
-
Loss Functions
Learn about the implementation of various loss functions.
-
Model Architecture
Explore the implementation of neural network models.
-
:material-gpu:{ .lg .middle } CUDA Optimizations
Discover performance optimizations using CUDA.
Contributing¶
-
Contributing
Guidelines for contributing to TorchEBM.
-
API Design
Learn about API design principles in TorchEBM.
-
API Generation
Understand how API documentation is generated.
-
Performance
Best practices for optimizing performance.
Contributing Process¶
The general process for contributing to TorchEBM involves:
-
Set up the development environment: Follow the development setup guide to prepare your workspace.
-
Understand the codebase: Familiarize yourself with the project structure, design principles, and core components.
-
Make changes: Implement your feature or bug fix, following the code style guidelines.
-
Write tests: Add tests for your changes as described in the testing guide.
-
Submit a pull request: Follow the contributing guidelines to submit your changes.
We welcome contributions from the community and are grateful for your help in improving TorchEBM!
Development Philosophy¶
TorchEBM aims to be:
- Modular: Components should be easy to combine and extend
- Performant: Critical operations should be optimized for speed
- User-friendly: APIs should be intuitive and well-documented
- Well-tested: Code should be thoroughly tested to ensure reliability
Learn more about our Design Principles.
Quick Reference¶
- Installation for development:
pip install -e ".[dev]"
- Run tests:
pytest
- Check code style:
black torchebm/ && isort torchebm/ && flake8 torchebm/
- Build documentation:
mkdocs serve
- Pre-commit hooks:
pre-commit install
Getting Help¶
If you encounter issues during development, you can:
- Open an issue on GitHub
- Ask questions in the GitHub Discussions
- Reach out to maintainers via email or GitHub