Thank you for your interest in contributing to xModelFactory! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Setup
- How to Contribute
- Pull Request Process
- Coding Standards
- Testing
- Documentation
This project and everyone participating in it is governed by our commitment to providing a welcoming and inclusive environment for all contributors.
- Fork the repository
- Clone your fork locally
- Set up your development environment
- Make your changes
- Submit a pull request
- Python 3.8 or higher
- pip or conda
- Git
# Clone your fork
git clone https://github.com/YOUR_USERNAME/xModelFactory.git
cd xModelFactory
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e ".[dev]"
# Install pre-commit hooks (optional)
pre-commit install# For DeepSpeed support
pip install deepspeed
# For Lion optimizer
pip install lion-pytorch
# For all dependencies
pip install -e ".[all]"- Check if the bug has already been reported in Issues
- If not, create a new issue with:
- Clear description of the bug
- Steps to reproduce
- Expected vs actual behavior
- Your environment (Python version, PyTorch version, OS)
- Open an issue with the label
enhancement - Describe the feature and its use case
- Discuss with maintainers before implementation
- Pick an issue to work on (or propose a new one)
- Create a feature branch:
git checkout -b feature/your-feature-name
- Make your changes
- Write/update tests
- Update documentation if needed
- Submit a pull request
- Ensure your code passes all tests
- Update the README.md if needed
- Update documentation for any new features
- Follow the PR template
- Request review from maintainers
- Code follows the project's coding standards
- All tests pass
- New features have corresponding tests
- Documentation is updated
- Commit messages are clear and descriptive
- Follow PEP 8 guidelines
- Use Black for code formatting:
black xmodel_factory/
- Use type hints for function signatures
- Keep line length to 100 characters
Use Google-style docstrings:
def function_name(param1: str, param2: int) -> bool:
"""Short description of function.
Longer description if needed.
Args:
param1: Description of first parameter.
param2: Description of second parameter.
Returns:
Description of return value.
Raises:
ValueError: When invalid input is provided.
"""
pass- One class/module per file for major components
- Keep related functions together
- Avoid circular imports
# Run all tests
pytest tests/
# Run specific test file
pytest tests/test_basic.py
# Run with coverage
pytest tests/ --cov=xmodel_factory- Place tests in the
tests/directory - Name test files as
test_*.py - Use descriptive test function names
- Test both success and failure cases
Example:
def test_model_config_creation():
"""Test that ModelConfig can be created with valid parameters."""
config = ModelConfig(
vocab_size=32000,
hidden_size=512,
)
assert config.vocab_size == 32000
assert config.hidden_size == 512cd docs/
make html- Keep README.md up to date
- Document all public APIs
- Include usage examples
- Update CHANGELOG.md for significant changes
- Update version in
xmodel_factory/__init__.py - Update CHANGELOG.md
- Create a GitHub release
- Build and publish to PyPI:
python -m build twine upload dist/*
Feel free to open an issue for questions or reach out to the maintainers.
Thank you for contributing to xModelFactory!