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

Fix merge of boolean experiment variables with string from CLI #1247

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wico-silva
Copy link
Contributor

This PR fixes boolean conversion from CLI strings when merging with experiment configuration.

This is the current behavior:

python tools/train.py ... save_history_ckpt False

results in self.save_history_ckpt=True because the function merge() executes the following code:

v = src_type(v) -> self.save_history_ckpt = bool("False") -> self.save_history_ckpt = True

In Python, any non-empty string when cast to bool returns True.

Naturally, the expected behavior is actually self.save_history_ckpt = False.

@FateScript
Copy link
Member

waht if you try save_history_ckpt "True"

@wico-silva
Copy link
Contributor Author

wico-silva commented Apr 15, 2022

Without this PR:

  • save_history_ckpt "True" will result in self.save_history_ckpt = True, as expected.
  • Not expected is that save_history_ckpt "False" also results in self.save_history_ckpt = True.
  • Any character/string inside the quotes will result in self.save_history_ckpt = True.
  • The only way to make it False is with save_history_ckpt "".

With this PR:

  • save_history_ckpt "True" will result in self.save_history_ckpt = True.
  • save_history_ckpt "False" will result in self.save_history_ckpt = False.

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.

None yet

2 participants