Skip to content

--seed 0 silently picks a random seed — print or pin the effective seed #154

Open

Description

@barlowa124

protein_mpnn_run.py treats --seed 0 (the default) as a request for a random seed:

if args.seed:
    seed=args.seed
else:
    seed=int(np.random.randint(0, high=999, size=1, dtype=int)[0])

The help text does say "If set to 0 then a random seed will be picked", so this is intentional — but it's a footgun for downstream callers: passing --seed 0 expecting determinism (a natural reading, since 0 is a valid seed in most tools) silently produces different sequences on every run. We hit this in a pipeline wrapper where seed: 0 in config was assumed to pin sampling; results were irreproducible until we noticed the falsy check.

Two possible improvements:

  1. Print the effective seed at startup — it is already recorded in output fasta headers (seed={}), but that is post-hoc; a one-line print makes randomized runs auditable as they launch.
  2. Or accept 0 as a literal seed — e.g. default None and seed = args.seed if args.seed is not None else random_draw(), so an explicit --seed 0 is deterministic and only an absent flag randomizes.

Happy to open a PR for whichever direction you prefer. Our downstream fork currently does option 1 (prints the effective seed when 0 triggers a random draw).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions