mirror of
https://github.com/p-e-w/heretic.git
synced 2026-12-03 18:42:57 +07:00
[GH-ISSUE #516] Headless apply-and-save: interactive tail deadlocks without a TTY — working recipe + driver (validated on Qwen3-VL-8B) #222
Labels
No labels
bug
enhancement
enhancement
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
p-e-w/heretic#222
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @belo-labs on GitHub (Oct 22, 2026).
Original GitHub issue: https://github.com/p-e-w/heretic/issues/516
Version
heretic-llm 1.4.0
Problem
The end of a search run — apply the winning trial and save the merged model — is an interactive TUI flow. Under any non-interactive driver it deadlocks: driving keystrokes through a fifo into the process (no TTY) gets as far as the parameter-restore printout and then blocks forever on a hidden
questionary/rich prompt. Launching under a pty viascript -qeckeeps the search alive but does not help the apply-and-save tail. Anything running heretic in automation (sweeps, CI, overnight batch) hits this.Working headless recipe
The apply step lifts
main.py's own restore flow verbatim, minus the TUI — no TTY anywhere. Full driver (validated end-to-end: Qwen3-VL-8B-Instruct, 200-trial journal → applied trial 51 → saved → converted F16→Q4_K_M; the build then gated at −1 task vs its censored base on a 127-task suite, so the restore is faithful):Notes collected while making this work (all reproducible gotchas)
Settingsrequiresmodelat construction (pydantic validation), andseed=Nonecrashestorch.manual_seed— pass an integer seed even when you don't care.processor.save_pretrained(OUT)omitspreprocessor_config.json(onlyvideo_preprocessor_config.jsonlands).convert_hf_to_gguf --mmprojneeds it — copy it from the source repo before conversion.convert_hf_to_gguf --mmprojexports only the projector; run it in default mode for the main model.llama-quantizeto the target type (Q4_K_M here) — quantizing directly from the merged in-memory save was not attempted, F16-first is the tested path.If this is useful upstream, happy to turn it into a PR — a
--reproduce <index> -o <dir>flag on the CLI (reusing exactly this flow) would make the whole post-search tail automation-friendly.@p-e-w commented on GitHub (Oct 22, 2026):
Heretic already supports fully headless operation through configuration. Every interactive prompt can be pre-set. In this case, the configuration key you are looking for is called
trial_index:github.com/p-e-w/heretic@09271b6202/src/heretic/config.py (L507-L510)@belo-labs commented on GitHub (Oct 22, 2026):
Thank you — that's the cleaner path, and it supersedes the driver in my issue. For future readers hitting the same wall: the deadlock came from driving the interactive flow through a fifo; pre-setting the config keys (
export_strategy,checkpoint_action,trial_index,model_action,save_directory) removes every prompt, no TTY games needed.One detail worth knowing when coming from a journal file:
trial_indexis the position in the sorted Pareto front, not the raw trial'suser_attrs["index"]— map the journal trial to its front position before setting it. (My driver'snext(t for t in study.trials if t.user_attrs.get("index") == N)does the raw-journal equivalent.)The driver stays useful as a library-level fallback for exotic cases (e.g. applying a trial from a journal on a different machine than the search ran on), but the config path is the right answer for normal automation. Closing this out on my side — thanks again for the pointer.