Problem Summary
Configuration parameters specified via --with flag or config.json file are not being passed to model initialization in *_wsgi.py files, breaking customization functionality that previously worked.
Expected Behavior
kwargs from --with flag should be passed to model constructor
kwargs from config.json should be passed to model constructor
- Model should initialize with custom parameters as specified in configuration
Current Behavior
kwargs are loaded and parsed correctly
kwargs are only used during the --check validation step
kwargs are not passed to the actual model instance used by the web app
- Model initializes with default parameters only
Steps to Reproduce
- Run any WSGI example with custom kwargs:
python examples/yolo/_wsgi.py --with param=value
- Observe that the web app uses default model parameters
Code Analysis
In examples/yolo/_wsgi.py (and other WSGI files):
kwargs = get_kwargs_from_config()
if args.kwargs:
kwargs.update(parse_kwargs())
if args.check:
model = YOLO(**kwargs) # ✅ kwargs used here
app = init_app(
model_class=YOLO, # ❌ kwargs not passed here
basic_auth_user=args.basic_auth_user,
basic_auth_pass=args.basic_auth_pass,
)
Root Cause
The init_app() function appears to have removed support for passing **kwargs to the model constructor, but the argument parsing logic was left intact, creating a misleading interface.
Questions
- Is this an intentional breaking change? Should kwargs support be removed entirely?
- Is there a new recommended way to pass model parameters other than environment variables?
- Should
init_app() be updated to accept and forward kwargs to model initialization?
Proposed Solutions
Option A: Restore kwargs functionality
app = init_app(
model_class=YOLO,
model_kwargs=kwargs, # Pass kwargs to init_app
basic_auth_user=args.basic_auth_user,
basic_auth_pass=args.basic_auth_pass,
)
Option B: Remove misleading argument parsing
- Remove
--with and --kwargs options if they're no longer supported
- Update documentation to reflect current capabilities
Environment
- Affected files: All
*_wsgi.py files in examples/
- Configuration methods: Both
--with flag and config.json affected
- Impact: High - breaks existing workflows that rely on model customization
Labels: bug, breaking-change, configuration, wsgi
Problem Summary
Configuration parameters specified via
--withflag orconfig.jsonfile are not being passed to model initialization in*_wsgi.pyfiles, breaking customization functionality that previously worked.Expected Behavior
kwargsfrom--withflag should be passed to model constructorkwargsfromconfig.jsonshould be passed to model constructorCurrent Behavior
kwargsare loaded and parsed correctlykwargsare only used during the--checkvalidation stepkwargsare not passed to the actual model instance used by the web appSteps to Reproduce
python examples/yolo/_wsgi.py --with param=valueCode Analysis
In
examples/yolo/_wsgi.py(and other WSGI files):Root Cause
The
init_app()function appears to have removed support for passing**kwargsto the model constructor, but the argument parsing logic was left intact, creating a misleading interface.Questions
init_app()be updated to accept and forward kwargs to model initialization?Proposed Solutions
Option A: Restore kwargs functionality
Option B: Remove misleading argument parsing
--withand--kwargsoptions if they're no longer supportedEnvironment
*_wsgi.pyfiles in examples/--withflag andconfig.jsonaffectedLabels:
bug,breaking-change,configuration,wsgi