Spaces:
Running on Zero
Fix: Bayesian trials slider ignored + increase pipeline timeout for Optuna
Two fixes in one:
1. Bayesian Trials slider value is ignored (bug fix)
The "Bayesian Trials" slider in the Advanced Settings UI lets users choose 10-200 trials, but the value was never actually passed to the pipeline. The adv_bayesian_trials parameter comes into the run_obliterate function but is silently dropped โ it's not forwarded to either AbliterationPipeline or InformedAbliterationPipeline.
Instead, the excise stage in abliterate.py falls back to METHODS[method]["bayesian_trials"] which is hardcoded to 50, regardless of what the user selects in the UI.
The fix sets pipeline._bayesian_trials = int(adv_bayesian_trials) after pipeline construction for both code paths (informed and standard). The excise stage already checks getattr(self, "_bayesian_trials", 0) first before falling back to the method default, so this is all that's needed.
2. Pipeline timeout increased from 45 min to 400 hours
Same change as PR #4 โ the 45-minute timeout kills the Optuna optimization loop before it can finish on larger models. See PR #4 for full rationale.
Both fixes are needed together: without the slider fix, Optuna always runs 50 trials regardless of user input. Without the timeout fix, even 50 trials can't finish on 13B+ models.
This supersedes PR #4 (timeout-only fix) โ it includes that change plus a bug fix for the Bayesian trials slider.
I noticed that when I set the slider to 100 trials in the UI, the logs still showed "Running Bayesian optimization (50 trials)..." โ so I traced it through the code. The adv_bayesian_trials parameter is accepted by run_obliterate() but never forwarded to the pipeline object. The excise stage checks self._bayesian_trials first (line 2974 of abliterate.py) but since it's never set, it falls back to METHODS[method]["bayesian_trials"] which is always 50.
The two-line fix just sets pipeline._bayesian_trials = int(adv_bayesian_trials) after pipeline construction for both the informed and standard paths. Minimal change, no signature modifications needed in abliterate.py.
The timeout fix from this PR is already in main (_max_pipeline_secs = 400 * 60 * 60). However, the Bayesian trials slider fix (pipeline._bayesian_trials = int(adv_bayesian_trials)) is a separate valid bug fix not yet in main. This PR has a merge conflict in app.py so it cannot be merged as-is. The space owner should apply the Bayesian trials fix manually to app.py to ensure the slider value is actually forwarded to the pipeline.