If you're experiencing issues with model discovery or tag matching (e.g., "No models found corresponding to the given tag"), use the debug_discovery.py utility to diagnose the problem.
From your MAD or MAD-internal repository (where you run madengine):
# Copy the debug script from madengine repository
cp /path/to/madengine/debug_discovery.py .
# Run it (requires madengine installed: pip install -e /path/to/madengine)
python3 debug_discovery.py [TAG]# Debug the default MAD/dummy_multi tag
python3 debug_discovery.py
# Debug a specific tag
python3 debug_discovery.py MAD/dummy_multi
python3 debug_discovery.py MAD-private/some_model
python3 debug_discovery.py category1- Current directory context: Where you're running from, whether scripts/ exists
- Directory structure: Contents of scripts/ directory
- All discovered models: Names, tags, scripts paths, and internal filesystem paths
- Tag matching test: Attempts to select models with your tag and shows why matches succeed/fail
Cause: Running from wrong directory or missing root models.json
Solution:
- Run from the repository root (where models.json should be)
- If using per-directory models.json (submodules), create an empty root models.json:
echo "[]" > models.json
The debug script will show you exactly why:
-
No models discovered at all:
- Check that scripts/SCOPE/ directories exist
- Check that models.json files are present in the right locations
-
Models discovered but don't match:
- Check the discovered model names (e.g.,
MAD/dummy/dummy_multi/model1) - Check if your tag matches the pattern
- For scoped tags (SCOPE/filter), models must either:
- Have
filterin their tags field, OR - Have name exactly matching
SCOPE/filter, OR - Have name starting with
SCOPE/filter/(direct child directory), OR - Have
filterappearing as any path component afterSCOPE/
- Have
- Check the discovered model names (e.g.,
-
Wrong model names:
- Model names are derived from directory structure
- Interim "scripts" directories are stripped
- Example:
scripts/MAD/scripts/dummy_multi/→ models namedMAD/dummy_multi/modelX
Examples: MAD/dummy_multi, MAD-private/some_model
A model matches if ALL of these are true:
- Model name starts with
SCOPE/ - At least ONE of:
filter == "all"(matches everything in that scope)filteris in the model'stagsfield- Model name exactly equals
SCOPE/filter - Model name starts with
SCOPE/filter/(direct child directory) filterappears as any path component afterSCOPE/(flexible path matching)
Examples: category1, test
A model matches if:
tag_nameis in the model'stagsfield
scripts/
└── MAD/
└── dummy_multi/
├── models.json # Models: MAD/dummy_multi/model1, MAD/dummy_multi/model2
└── run.sh
Tag MAD/dummy_multi matches via direct child directory matching.
scripts/
└── MAD/
└── dummy/
└── dummy_multi/
├── models.json # Models: MAD/dummy/dummy_multi/model1
└── run.sh
Tag MAD/dummy_multi matches via path component matching (new in this version).
scripts/
└── MAD/ # MAD submodule
└── scripts/
└── dummy_multi/
├── models.json # Models: MAD/dummy_multi/model1, MAD/dummy_multi/model2
└── run.sh
Tag MAD/dummy_multi matches via direct child directory matching (interim scripts/ stripped).
scripts/
└── Model-Repo1/ # First submodule
└── scripts/
└── Model-Repo2/ # Second submodule (inside first)
└── scripts/
└── dummy/
├── models.json # Models: Model-Repo2/dummy/modelX
└── run.sh
Note: The directory immediately before the last "scripts" becomes part of the model name prefix.
scripts/
└── MAD/
├── dummy/
│ └── dummy_multi/
│ └── models.json # Models: MAD/dummy/dummy_multi/model1
└── other/
└── dummy_multi/
└── models.json # Models: MAD/other/dummy_multi/model2
Tag MAD/dummy_multi matches BOTH locations via path component matching.
If the debug script doesn't help you resolve the issue, include its full output when reporting the problem. This helps maintainers understand:
- What directory structure you have
- What models are being discovered
- Why tag matching is failing