Skip to content

Commit

Permalink
Make --seed and --server mutually exclusive
Browse files Browse the repository at this point in the history
Also remove --seed default value. So either --seed or --server must be specified.
  • Loading branch information
emnoor-reef committed Nov 19, 2024
1 parent 20dcc6f commit 3cf6f47
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/compute_horde_prompt_solver/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,31 @@ def parse_arguments():
parser.add_argument(
"--top-p", type=float, default=0.1, help="Top-p sampling parameter"
)
parser.add_argument(
"--seed", type=int, default=42, help="Random seed for reproducibility"
)
parser.add_argument(
"--dtype", default="auto",
choices=("auto", "half", "float16", "bfloat16", "float", "float32"),
help=(
"model dtype - setting `float32` helps with deterministic prompts in different batches"
)
)
parser.add_argument(

seed_or_server_group = parser.add_mutually_exclusive_group(required=True)
seed_or_server_group.add_argument(
"--seed", type=int, help="Random seed for reproducibility"
)
seed_or_server_group.add_argument(
"--server",
action="store_true",
help="Spin up a temporary HTTP server to receive the seed",
)

parser.add_argument(
"--server-port",
type=int,
default=8000,
help="Port for temporary HTTP server",
)

return parser.parse_args()


Expand Down Expand Up @@ -157,7 +161,6 @@ def main():

args.output_dir.mkdir(parents=True, exist_ok=True)

# TODO: make sure if it is ok to load model before calling set_deterministic()!!
model = setup_model(args.model, dtype=args.dtype)

start_server_event.set()
Expand Down

0 comments on commit 3cf6f47

Please sign in to comment.