Skip to content

Latest commit

 

History

History
87 lines (54 loc) · 3.23 KB

CONTRIBUTING.md

File metadata and controls

87 lines (54 loc) · 3.23 KB

Contributing to Composer

Thanks for considering contributing to Composer!

Issues tagged with good first issue are great options to start contributing.

If you have questions, join us on Slack -- we'll be happy to help you!

We welcome contributions for bug fixes, new efficient methods you'd like to contribute to the community, or new models and datasets!

New Algorithms

Have a new algorithm you'd like to contribute to the library as part of your research? We welcome any PRs, and recommend filing an issue with the proposed method or reaching out on Slack first!

Prerequisites

To set up the development environment in your local box, run the commands below.

1. Install the dependencies needed for testing and linting the code:

pip install -e '.[all]'

2. Configure pre-commit, which automatically formats code before each commit:

pre-commit install

Submitting a Contribution

To submit a contribution:

1. Fork a copy of the Composer library to your own account.

2. Clone your fork locally and add the mosaicml repo as a remote repository:

git clone [email protected]:<github_id>/composer.git
cd composer
git remote add upstream https://github.com/mosaicml/composer.git

3. Create a branch and make your proposed changes.

git checkout -b cool-new-feature

4. When you are ready, submit a pull request into the composer repository! If merged, we'll reach out to send you some free swag :)

Configuring README Code Snippets

Composer uses pytest-codeblocks to test all example code snippets. The pytest-codeblocks repository explains how to annotate code snippets, which supports most pytest configurations. For example, if a test requires model training, the GPU mark (<!--pytest.mark.skip-->) should be applied.

Running Tests

To test your changes locally, run:

  1. make test # run CPU tests
  2. make test-gpu # run GPU tests
  3. cd docs && make doctest # run doctests

Some of our checks test distributed training as well. To test these, run:

  • make test-dist WORLD_SIZE=2 # run 2-cpu distributed tests
  • make test-dist-gpu WORLD_SIZE=2 # run 2-gpu distributed tests

These tests run with the composer launcher. We also support WORLD_SIZE=1, which would run the tests with the composer launcher on a single device.

See the Makefile for more information.

If you want to run pre-commit hooks manually, which check for code formatting and type annotations, run pre-commit run --all-files

Code Style & Typing

See the Composer Style Guide for guidelines on how to structure and format your code.

Composer aims to annotate all functions with type annotations (introduced in PEP 526). Don't worry if you are not a Python typing expert; put in the pull request, and we'll help you with getting the code into shape.