|
| 1 | +# Contributing to airML |
| 2 | + |
| 3 | +Thank you for your interest in contributing to airML! |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +### Prerequisites |
| 8 | + |
| 9 | +- Rust 1.75 or later |
| 10 | +- ONNX Runtime (for testing) |
| 11 | + |
| 12 | +### Building |
| 13 | + |
| 14 | +```bash |
| 15 | +# Clone the repository |
| 16 | +git clone https://github.com/airml/airml.git |
| 17 | +cd airml |
| 18 | + |
| 19 | +# Build in debug mode |
| 20 | +cargo build |
| 21 | + |
| 22 | +# Build in release mode |
| 23 | +cargo build --release |
| 24 | + |
| 25 | +# Run tests |
| 26 | +cargo test |
| 27 | + |
| 28 | +# Run clippy |
| 29 | +cargo clippy --all-features |
| 30 | + |
| 31 | +# Format code |
| 32 | +cargo fmt |
| 33 | +``` |
| 34 | + |
| 35 | +## Development Workflow |
| 36 | + |
| 37 | +1. **Fork** the repository |
| 38 | +2. **Create a branch** for your changes |
| 39 | +3. **Make your changes** with clear, atomic commits |
| 40 | +4. **Write tests** for new functionality |
| 41 | +5. **Run tests and lints** before submitting |
| 42 | +6. **Submit a pull request** |
| 43 | + |
| 44 | +## Code Style |
| 45 | + |
| 46 | +- Follow Rust standard style (enforced by `rustfmt`) |
| 47 | +- Use meaningful variable and function names |
| 48 | +- Write doc comments for public APIs |
| 49 | +- Keep functions focused and small |
| 50 | + |
| 51 | +## Commit Messages |
| 52 | + |
| 53 | +Use conventional commits format: |
| 54 | + |
| 55 | +``` |
| 56 | +type(scope): short description |
| 57 | +
|
| 58 | +Longer description if needed. |
| 59 | +``` |
| 60 | + |
| 61 | +Types: |
| 62 | +- `feat`: New feature |
| 63 | +- `fix`: Bug fix |
| 64 | +- `docs`: Documentation |
| 65 | +- `refactor`: Code refactoring |
| 66 | +- `test`: Adding tests |
| 67 | +- `chore`: Maintenance tasks |
| 68 | + |
| 69 | +Examples: |
| 70 | +``` |
| 71 | +feat(core): add support for dynamic input shapes |
| 72 | +fix(preprocess): handle images with alpha channel |
| 73 | +docs(readme): add installation instructions |
| 74 | +``` |
| 75 | + |
| 76 | +## Pull Request Guidelines |
| 77 | + |
| 78 | +- Keep PRs focused on a single change |
| 79 | +- Update documentation if needed |
| 80 | +- Add tests for new functionality |
| 81 | +- Ensure CI passes |
| 82 | +- Request review from maintainers |
| 83 | + |
| 84 | +## Architecture Overview |
| 85 | + |
| 86 | +``` |
| 87 | +airML/ |
| 88 | +├── crates/ |
| 89 | +│ ├── airml-core/ # Core inference engine |
| 90 | +│ │ ├── engine.rs # InferenceEngine |
| 91 | +│ │ ├── session.rs # Session configuration |
| 92 | +│ │ └── error.rs # Error types |
| 93 | +│ │ |
| 94 | +│ ├── airml-preprocess/ # Input preprocessing |
| 95 | +│ │ ├── image.rs # Image preprocessing |
| 96 | +│ │ └── text.rs # Text tokenization |
| 97 | +│ │ |
| 98 | +│ ├── airml-providers/ # Execution providers |
| 99 | +│ │ ├── cpu.rs # CPU provider |
| 100 | +│ │ └── coreml.rs # CoreML provider |
| 101 | +│ │ |
| 102 | +│ └── airml-embed/ # Model embedding |
| 103 | +│ |
| 104 | +└── src/ # CLI binary |
| 105 | + ├── main.rs # Entry point |
| 106 | + ├── cli.rs # Clap definitions |
| 107 | + └── commands/ # Command implementations |
| 108 | +``` |
| 109 | + |
| 110 | +## Adding a New Execution Provider |
| 111 | + |
| 112 | +1. Create a new file in `crates/airml-providers/src/` |
| 113 | +2. Implement the provider configuration |
| 114 | +3. Add to feature flags in `Cargo.toml` |
| 115 | +4. Export in `lib.rs` |
| 116 | +5. Add to auto-selection logic |
| 117 | + |
| 118 | +## Adding a New Preprocessing Mode |
| 119 | + |
| 120 | +1. Add configuration in `crates/airml-preprocess/src/image.rs` |
| 121 | +2. Implement the preprocessing logic |
| 122 | +3. Add a constructor method (e.g., `ImagePreprocessor::new_mode()`) |
| 123 | +4. Add to CLI preset options |
| 124 | + |
| 125 | +## Questions? |
| 126 | + |
| 127 | +Open a [Discussion](https://github.com/airml/airml/discussions) for questions or ideas. |
0 commit comments