Thank you for your interest in contributing to ModelForge! This guide will help you get started.
- 🐛 Report bugs via GitHub Issues
- 💡 Suggest features via GitHub Discussions
- 📝 Improve documentation
- 🔧 Submit code improvements
- 🤖 Add model recommendations
- 🏗️ Add new providers or strategies
# Fork on GitHub, then clone your fork
git clone https://github.com/YOUR_USERNAME/ModelForge.git
cd ModelForge# Create virtual environment
python3.11 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e .
# Install development dependencies
pip install pytest black flake8 mypygit checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fixWe follow PEP 8 with some modifications:
- Maximum line length: 100 characters
- Use Black for formatting
- Use type hints where possible
Format code:
black ModelForge/Lint code:
flake8 ModelForge/ --max-line-length=100Type check:
mypy ModelForge/- Use ESLint and Prettier
- Follow Airbnb style guide
- Functional components with hooks
Follow conventional commits:
feat: add QLoRA strategy support
fix: resolve CUDA memory leak
docs: update Windows installation guide
refactor: improve provider abstraction
test: add tests for training service
Types: feat, fix, docs, style, refactor, test, chore
- ✅ Code follows style guidelines
- ✅ All tests pass
- ✅ Documentation updated
- ✅ Commits are clean and descriptive
- Push to your fork
- Create PR on GitHub
- Fill out PR template
- Link related issues
- Respond to feedback promptly
- Make requested changes
- Keep PR focused and small
- Delete your branch
- Pull latest changes
- Celebrate! 🎉
See Model Configurations Guide for detailed instructions.
Quick steps:
- Add JSON file to
ModelForge/model_configs/ - Follow schema:
{
"profile": "mid_range",
"tasks": {
"text-generation": {
"primary": "meta-llama/Llama-3.2-3B",
"alternatives": ["mistralai/Mistral-7B-v0.1"]
}
}
}Create ModelForge/providers/your_provider.py:
from typing import Any, Tuple
from ..logging_config import logger
class YourProvider:
def load_model(
self,
model_id: str,
model_class: str,
quantization_config=None,
device_map=None,
**kwargs
) -> Tuple[Any, Any]:
"""Load model and tokenizer."""
logger.info(f"Loading model {model_id} with Your Provider")
# Implementation here
return model, tokenizer
def load_tokenizer(self, model_id: str, **kwargs) -> Any:
"""Load tokenizer."""
# Implementation here
return tokenizer
def validate_model_access(self, model_id: str, model_class: str) -> bool:
"""Check if model is accessible."""
# Implementation here
return True
def get_provider_name(self) -> str:
"""Return provider name."""
return "your_provider"Edit ModelForge/providers/provider_factory.py:
from .your_provider import YourProvider
class ProviderFactory:
_providers = {
"huggingface": HuggingFaceProvider,
"unsloth": UnslothProvider,
"your_provider": YourProvider, # Add here
}Create tests/test_your_provider.py:
def test_your_provider_loads():
provider = YourProvider()
assert provider.get_provider_name() == "your_provider"Add docs to docs/providers/your_provider.md
Create ModelForge/strategies/your_strategy.py:
from typing import Any, Dict
from ..logging_config import logger
class YourStrategy:
def get_strategy_name(self) -> str:
return "your_strategy"
def prepare_model(self, model: Any, config: Dict) -> Any:
"""Prepare model for training."""
logger.info("Preparing model with Your Strategy")
# Implementation here
return model
def prepare_dataset(self, dataset: Any, tokenizer: Any, config: Dict) -> Any:
"""Prepare dataset for strategy."""
# Implementation here
return dataset
def create_trainer(
self,
model,
train_dataset,
eval_dataset,
tokenizer,
config,
callbacks
):
"""Create trainer instance."""
# Implementation here
return trainer
def get_required_dataset_fields(self):
"""Return required dataset fields."""
return ["input", "output"]Edit ModelForge/strategies/strategy_factory.py:
from .your_strategy import YourStrategy
class StrategyFactory:
_strategies = {
"sft": SFTStrategy,
"qlora": QLoRAStrategy,
"rlhf": RLHFStrategy,
"dpo": DPOStrategy,
"your_strategy": YourStrategy, # Add here
}Similar to providers above.
pytestpytest tests/test_providers.pypytest --cov=ModelForge --cov-report=html# Start development server
modelforge cli
# Test in browser
open http://localhost:8000Documentation is in Markdown. Preview with any Markdown viewer.
- Create
.mdfile in appropriatedocs/subdirectory - Add to index in
docs/README.md - Use relative links:
[text](../other/file.md)
- Use clear, simple language
- Include code examples
- Add links to related docs
- Use emoji sparingly (✅❌
⚠️ )
Include:
- ModelForge version
- Python version
- OS and platform
- GPU model and VRAM
- Steps to reproduce
- Error messages/logs
- Expected vs actual behavior
Include:
- Use case description
- Expected behavior
- Why it's useful
- Implementation ideas (optional)
- Be respectful and professional
- Help others learn and grow
- Give constructive feedback
- Follow Code of Conduct
Contributors are recognized in:
- GitHub Contributors page
- Release notes
- README (for significant contributions)
- Check FAQ
- Ask in GitHub Discussions
- Read Architecture Guide
Thank you for contributing to ModelForge! 🎉