Thank you for your interest in contributing to TATO (Adaptive Transformation Optimization for Domain-Shared Time Series Foundation Models)! This document provides guidelines and instructions for contributing to the project.
- Code of Conduct
- Getting Started
- Development Workflow
- Code Style and Standards
- Testing
- Documentation
- Pull Request Process
- Adding New Features
- Reporting Issues
- Community
We are committed to fostering an open and welcoming environment. Please read and follow our Code of Conduct in all interactions.
- Python 3.8+
- Git
- Basic understanding of time series forecasting and foundation models
-
Fork and Clone the Repository
git clone https://github.com/thulab/TATO.git cd TATO -
Set Up Base Environment
# Create a virtual environment python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate # Install base dependencies pip install -r base_requirements.txt
-
Set Up Model-Specific Environments Due to dependency conflicts between different time series foundation models, TATO uses separate environments:
# Timer model bash scripts/timer_runs/setup_timer.sh # MOIRAI model bash scripts/moirai_runs/setup_moirai.sh # Chronos model bash scripts/chronos_runs/setup_chronos.sh # Sundial model (requires transformers 4.40.1) bash scripts/sundial_runs/setup_sundial.sh
-
Download Pre-trained Models and Datasets
# Create directories mkdir -p CKPT DATASET # Download checkpoints and datasets as described in README.md # Place them in the appropriate directories
main: Stable production codedevelop: Integration branch for featuresfeature/*: New featuresbugfix/*: Bug fixeshotfix/*: Critical production fixes
# Sync with upstream
git fetch upstream
git checkout develop
git pull upstream develop
# Create feature branch
git checkout -b feature/your-feature-name- Make your changes in the feature branch
- Add tests for new functionality
- Update documentation as needed
- Ensure code follows style guidelines
We follow conventional commits format:
type(scope): description
[optional body]
[optional footer]
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
Example:
git commit -m "feat(transformation): add wavelet denoiser transformation"- Follow PEP 8 guidelines
- Use type hints for function signatures
- Maximum line length: 88 characters (Black formatting)
- Use meaningful variable and function names
# Standard library imports
import os
import sys
from typing import Dict, List, Optional
# Third-party imports
import numpy as np
import torch
from transformers import AutoModelForCausalLM
# Local imports
from transformation.base import BaseTransformation
from utils.tools import EarlyStopping- Use Google-style docstrings for all public functions and classes
- Include type hints in docstrings
- Document complex algorithms and design decisions
Example:
def forecast(self, data: np.ndarray, pred_len: int) -> np.ndarray:
"""Generate forecasts for input data.
Args:
data: Input time series data of shape (batch_size, seq_len, num_features)
pred_len: Number of time steps to forecast
Returns:
Forecasted values of shape (batch_size, pred_len, num_features)
Raises:
ValueError: If input data has incorrect shape
"""- Use YAML for configuration files
- Follow existing structure in
configs/model_config.yaml - Include comments explaining configuration options
# Run all tests
python -m pytest tests/
# Run specific test module
python -m pytest tests/test_model_factory.py
# Run with coverage
python -m pytest tests/ --cov=model --cov-report=html- Place tests in
tests/directory - Use descriptive test names
- Test both normal and edge cases
- Mock external dependencies when appropriate
Example:
def test_model_factory_load_valid_model():
"""Test loading a valid model from factory."""
model = ModelFactory.load_model('Timer-UTSD', device='cpu', args=None)
assert model is not None
assert isinstance(model, Timer)tests/
├── __init__.py
├── test_model_factory.py
├── test_transformations.py
├── test_pipeline.py
└── test_utils.py
- Update README.md for major changes
- Add docstrings for new functions and classes
- Update API documentation in
docs/directory - Create tutorials for new features
# Install documentation dependencies
pip install sphinx sphinx-rtd-theme
# Build documentation
cd docs
make html-
Create a Pull Request
- Target the
developbranch - Provide a clear description of changes
- Reference related issues
- Target the
-
PR Checklist
- Code follows style guidelines
- Tests pass
- Documentation updated
- No breaking changes
- Dependencies updated if needed
-
Code Review
- Address reviewer comments
- Update PR as needed
- Ensure CI passes
-
Merge
- Squash commits if needed
- Use descriptive merge message
- Delete feature branch after merge
- Create new transformation class in
transformation/library/ - Inherit from
BaseTransformation - Define
search_spaceclass variable - Implement
pre_processandpost_processmethods - Add to
transformation/transformation_factory.py - Write tests
Example:
# transformation/library/wavelet_denoiser.py
from transformation.base import BaseTransformation
class WaveletDenoiser(BaseTransformation):
"""Wavelet-based denoising transformation."""
search_space = {
'wavelet': ['db1', 'db2', 'sym4'],
'level': [1, 2, 3],
'threshold': [0.1, 0.5, 1.0]
}
def __init__(self, wavelet: str, level: int, threshold: float):
self.wavelet = wavelet
self.level = level
self.threshold = threshold
def pre_process(self, data: np.ndarray) -> np.ndarray:
# Implementation
return denoised_data
def post_process(self, data: np.ndarray) -> np.ndarray:
# Inverse transformation if needed
return data- Create model class in
model/directory - Implement
__init__andforecastmethods - Add to
model/model_factory.py - Update
configs/model_config.yaml - Add model-specific requirements
- Write tests
- Add dataset loading logic to
data/dataset.py - Follow existing dataset interface
- Update dataset documentation
- Add to supported datasets list in README
When reporting bugs, include:
- Clear description of the issue
- Steps to reproduce
- Expected vs actual behavior
- Environment details (Python version, OS, etc.)
- Error messages and stack traces
For feature requests, include:
- Use case description
- Proposed solution
- Alternative solutions considered
- Impact on existing functionality
Please report security issues privately to the maintainers.
- Check the documentation
- Search existing issues
- Join our [Discord/Slack community]
- Attend community meetings
- Improve documentation
- Write tutorials
- Report bugs
- Suggest features
- Help other contributors
- Review pull requests
Contributors are recognized in:
- Project README
- Release notes
- Contributor hall of fame
By contributing to TATO, you agree that your contributions will be licensed under the project's MIT License.
Thank you for contributing to making time series foundation models more adaptable across domains!
This document was inspired by best practices from open source projects and adapted for TATO's specific needs.