Problem
The YOLO plugin has 70+ occurrences of hardcoded "cpu" as the default device parameter. This causes the plugin to run on CPU even when the config file (models.yaml) specifies device: "cuda".
Locations affected:
plugin.py - Tool function defaults, manifest schema defaults
inference/*.py - All detection/tracking functions
video/*.py - All video processing functions
utils/team.py - Team classification
Current workaround:
The run_tool() method now reads from config, but if someone calls the underlying functions directly, they'll still get CPU.
Proposed Solution
-
Add a CI check to prevent new hardcoded "cpu" defaults:
- Create a script that scans for
device: str = "cpu" patterns
- Fail CI if found outside of config fallback
-
Refactor to use config throughout:
- Create a
get_default_device() helper in configs/__init__.py
- Replace all
device: str = "cpu" with device: str = get_default_device()
-
Document the pattern:
- Add to plugin development guide
- Ensure all plugins follow the same pattern
Impact
- GPU acceleration not working by default on GPU-enabled systems
- Performance degradation on Kaggle/Colab where GPU is expected
- Confusing UX when config file is ignored
Priority
High - Affects core functionality (GPU vs CPU inference)
Problem
The YOLO plugin has 70+ occurrences of hardcoded
"cpu"as the default device parameter. This causes the plugin to run on CPU even when the config file (models.yaml) specifiesdevice: "cuda".Locations affected:
plugin.py- Tool function defaults, manifest schema defaultsinference/*.py- All detection/tracking functionsvideo/*.py- All video processing functionsutils/team.py- Team classificationCurrent workaround:
The
run_tool()method now reads from config, but if someone calls the underlying functions directly, they'll still get CPU.Proposed Solution
Add a CI check to prevent new hardcoded
"cpu"defaults:device: str = "cpu"patternsRefactor to use config throughout:
get_default_device()helper inconfigs/__init__.pydevice: str = "cpu"withdevice: str = get_default_device()Document the pattern:
Impact
Priority
High - Affects core functionality (GPU vs CPU inference)