Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boolean Argument --trajcontrol Misinterpreted as True When Set to False #26

Open
MartaYang opened this issue Dec 16, 2024 · 0 comments
Open

Comments

@MartaYang
Copy link

MartaYang commented Dec 16, 2024

Description

At train_trajnet.py#L41, the --trajcontrol argument is defined with default=False and type=bool, but it always evaluates to True when passed via the CLI, even if explicitly set to False. This is due to the misuse of type=bool, which interprets any non-empty string (e.g., "False") as True.

Steps to Reproduce

  1. Define --trajcontrol as:

    group.add_argument("--trajcontrol", default=False, type=bool, help="If True, finetune trajnet with TrajControl")
  2. Run:

    python train_trajnet.py --trajcontrol False
  3. Observe:

    ipdb> print(args.trajcontrol)
    True

Suggested Fix

  1. Replace type=bool with:
    type=lambda x: x.lower() in ['true', '1']
  2. Or use action='store_true':
    group.add_argument("--trajcontrol", action='store_true', help="If set, finetune trajnet with TrajControl")
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

No branches or pull requests

1 participant