Preserve user-specified model in auto mode retry logic

- Track if user explicitly specified --model before auto mode runs
- Skip retry with alternative models when user's model fails
- Show clear error message explaining user's choice is preserved
- Only auto-selected models can be retried with alternatives
parent be1e5b9d
Pipeline #229 canceled with stages
...@@ -3318,6 +3318,11 @@ def main(args): ...@@ -3318,6 +3318,11 @@ def main(args):
if getattr(args, 'auto', False) and not hasattr(args, '_auto_mode'): if getattr(args, 'auto', False) and not hasattr(args, '_auto_mode'):
if not args.prompt: if not args.prompt:
parser.error("--auto requires --prompt to analyze") parser.error("--auto requires --prompt to analyze")
# Track if user explicitly specified the model (before auto mode modifies it)
# This is used to preserve user's model choice during retry
args._user_specified_model = args.model is not None and args.model != (list(MODELS.keys())[0] if MODELS else None)
args = run_auto_mode(args, MODELS) args = run_auto_mode(args, MODELS)
if args is None: if args is None:
sys.exit(1) sys.exit(1)
...@@ -3520,7 +3525,15 @@ def main(args): ...@@ -3520,7 +3525,15 @@ def main(args):
max_retries = getattr(args, '_max_retries', 3) max_retries = getattr(args, '_max_retries', 3)
alternative_models = getattr(args, '_auto_alternative_models', []) alternative_models = getattr(args, '_auto_alternative_models', [])
failed_base_models = getattr(args, '_failed_base_models', set()) failed_base_models = getattr(args, '_failed_base_models', set())
user_specified_model = getattr(args, '_user_specified_model', False)
# If user explicitly specified the model, don't retry with alternatives
# The user's model choice should be preserved
if user_specified_model:
print(f"\n⚠️ User-specified model failed: {model_id_to_load}")
print(f" The model was explicitly provided with --model, not retrying with alternatives.")
print(f" Please verify the model exists or try a different model.")
else:
# If this was a LoRA with a base model, track the failed base model # If this was a LoRA with a base model, track the failed base model
if is_lora and base_model_id: if is_lora and base_model_id:
failed_base_models.add(base_model_id) failed_base_models.add(base_model_id)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment