Train a Foundation Models LoRA adapter to extract structured runway performance data from raw NOTAM text.
# 1. Setup environment
./setup.sh
# 2. Prepare training data
./prepare_data.sh
# 3. Train the adapter
./train_adapter.sh
# 4. Upload to App Store Connect
./upload_adapter.shThis pipeline trains a custom LoRA adapter for Apple's Foundation Models framework to parse NOTAMs and extract runway performance data.
[NOTAM API] → [Filter] → [Label with Claude] → [Train] → [Export] → [Upload]
- macOS with Apple Silicon (32GB+ RAM recommended)
- Python 3.11 (via pyenv)
- Apple's adapter training toolkit
- Anthropic API key (for labeling)
- Apple Developer Program membership (for hosting)
Download from Apple Developer:
unzip adapter_training_toolkit_v26_0_0.zip./setup.shcp .env.example .env
# Edit .env with your credentialsRequired variables:
ANTHROPIC_API_KEY- For Claude-based labelingTOOLKIT_PATH- Path to Apple's toolkitASC_ISSUER_ID,ASC_KEY_ID,ASC_PRIVATE_KEY_PATH- App Store Connect API credentialsAPP_APPLE_ID- Your app's Apple ID (numeric)
./prepare_data.shOr run individual steps:
python download_all_notams.py- Download NOTAMs from APIpython filter_relevant_notams.py- Filter runway-relevant NOTAMspython generate_silver_labels.py- Label with Claudepython review_tool.py --low-confidence- Review low-confidence labelspython fix_silver_labels.py- Apply automatic fixespython format_training_data.py- Format for training
./train_adapter.shOptions:
--export-only- Export existing checkpoint without training
Environment variables:
| Variable | Default | Description |
|---|---|---|
TOOLKIT_PATH |
required | Apple toolkit location |
EPOCHS |
5 | Training epochs |
BATCH_SIZE |
4 | Batch size (reduce if OOM) |
LEARNING_RATE |
1e-3 | Learning rate |
For memory issues:
BATCH_SIZE=1 ./train_adapter.sh./upload_adapter.shOptions:
--dry-run- Validate without uploading
The script uses the App Store Connect API to:
- Create/find an asset pack
- Create a new version
- Upload the adapter
- Commit and verify processing
Request the Foundation Models Framework Adapter Entitlement from Apple before shipping:
- Go to Apple Developer Account
- Certificates, Identifiers & Profiles → Identifiers
- Select your App ID → Request entitlement
├── setup.sh # Environment setup
├── prepare_data.sh # Data preparation pipeline
├── train_adapter.sh # Training script
├── upload_adapter.sh # Upload to App Store Connect
├── requirements.txt # Python dependencies
├── .env.example # Environment template
├── data/ # Training data (gitignored)
├── checkpoints/ # Model checkpoints (gitignored)
└── exports/ # Exported adapters (gitignored)
[
{"role": "user", "content": "Extract runway data from this NOTAM...\n\nRWY 28L THR DSPLCD 500FT"},
{"role": "assistant", "content": "{\"airportID\":\"KSFO\",\"runway\":\"28L\",\"takeoffShortening\":500,...}"}
]| Field | Type | Description |
|---|---|---|
airportID |
string | ICAO airport code |
runway |
string? | Runway designator |
runwayClosed |
bool | Runway fully closed |
takeoffShortening |
number? | Takeoff distance reduction |
landingShortening |
number? | Landing distance reduction |
TORA, TODA, LDA |
number? | Declared distances |
obstacleHeight |
number? | Obstacle height AGL |
contaminations |
array | Surface contaminations |
MIT License - see LICENSE