Skip to content

Fix: pass --cuda flag to train_vae in bin subcommand#7

Open
rec3141 wants to merge 1 commit into
LorMeBioAI:mainfrom
rec3141:fix/bin-cmd-cuda-flag
Open

Fix: pass --cuda flag to train_vae in bin subcommand#7
rec3141 wants to merge 1 commit into
LorMeBioAI:mainfrom
rec3141:fix/bin-cmd-cuda-flag

Conversation

@rec3141

@rec3141 rec3141 commented Feb 12, 2026

Copy link
Copy Markdown

Summary

  • The bin subcommand accepts a --cuda argument (line 197) but never passes it to train_vae() on line 238, which falls through to auto-detection via torch.cuda.is_available()
  • The train and cluster subcommands already pass args.cuda correctly (lines 256, 265)
  • One-line fix: train_vae(logger, args.output, epoch=args.epoch)train_vae(logger, args.output, epoch=args.epoch, is_cuda=args.cuda)

Impact

Without this fix, LorBin bin --cuda silently ignores the --cuda flag. Auto-detection still works when CUDA is available, but explicit opt-in (forcing GPU on ambiguous systems) and opt-out (forcing CPU when GPU is present) are broken for the primary user-facing subcommand.

Test plan

  • Verified train_vae signature accepts is_cuda kwarg (line 63)
  • Verified train and cluster subcommands already use this pattern
  • Confirmed auto-detection still works as fallback when --cuda is not passed (args.cuda defaults to False, but train_vae treats False vs None differently — False disables CUDA, None triggers auto-detection)

Note: Since args.cuda is False (not None) when --cuda is omitted, this change means LorBin bin without --cuda will now disable GPU rather than auto-detect. If the intended default is auto-detection, the fix should use args.cuda if args.cuda else None instead, or change the argparse default to None.

🤖 Generated with Claude Code

The `bin` subcommand accepts a `--cuda` argument but never passes it
to `train_vae()`, which falls through to auto-detection via
`torch.cuda.is_available()`.  The `train` and `cluster` subcommands
already pass `args.cuda` correctly (lines 256, 265).

Without this fix, `LorBin bin --cuda` silently ignores the flag.
Auto-detection still works in most cases, but explicit opt-in/opt-out
is broken for the primary user-facing subcommand.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rec3141 rec3141 force-pushed the fix/bin-cmd-cuda-flag branch from 0f33182 to aaf35c4 Compare February 12, 2026 18:50
rec3141 added a commit to rec3141/danaSeq that referenced this pull request Feb 22, 2026
Idempotent script that applies four open PRs not yet merged upstream:
- LorMeBioAI/LorBin#6: Fix sklearn n_neighbors=0 crash, NameError in
  mcluster, missing argparse type= annotations
- LorMeBioAI/LorBin#7: Pass --cuda flag to train_vae in bin subcommand
- LottePronk/whokaryote#13: Fix GFF3 parsing for Bakta/PGAP output
- oschwengers/bakta#429: Make AMRFinderPlus failure non-fatal (warn + return)

Run once after install.sh. Safe to re-run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant