Skip to content

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.

    Development Setup

  • Code Style


    Learn about the coding standards and style guidelines.

    Code Style

  • Testing Guide


    Discover how to write and run tests for TorchEBM.

    Testing Guide

  • :material-git-commit:{ .lg .middle } Commit Conventions


    Understand the commit message format and conventions.

    Commit Conventions

Understanding the Architecture

  • Project Structure


    Explore the organization of the TorchEBM codebase.

    Project Structure

  • Design Principles


    Learn about the guiding principles behind TorchEBM.

    Design Principles

  • Core Components


    Understand the core components and their interactions.

    Core Components

Implementation Details

  • Energy Functions


    Detailed information about energy function implementations.

    Energy Functions

  • Samplers


    Understand how samplers are implemented in TorchEBM.

    Samplers

  • Loss Functions


    Learn about the implementation of various loss functions.

    Loss Functions

  • Model Architecture


    Explore the implementation of neural network models.

    Model Architecture

  • :material-gpu:{ .lg .middle } CUDA Optimizations


    Discover performance optimizations using CUDA.

    CUDA Optimizations

Contributing

  • Contributing


    Guidelines for contributing to TorchEBM.

    Contributing

  • API Design


    Learn about API design principles in TorchEBM.

    API Design

  • API Generation


    Understand how API documentation is generated.

    API Generation

  • Performance


    Best practices for optimizing performance.

    Performance

Contributing Process

The general process for contributing to TorchEBM involves:

  1. Set up the development environment: Follow the development setup guide to prepare your workspace.

  2. Understand the codebase: Familiarize yourself with the project structure, design principles, and core components.

  3. Make changes: Implement your feature or bug fix, following the code style guidelines.

  4. Write tests: Add tests for your changes as described in the testing guide.

  5. 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