-
Notifications
You must be signed in to change notification settings - Fork 446
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
Align Engine.from_config with CLI behavior #2973
Align Engine.from_config with CLI behavior #2973
Conversation
…nsions into harimkan/from-config-callbacks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, please check my comments
…nsions into harimkan/from-config-callbacks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why you need this because it will show a different behavior from my expectation if an user executes the code not exactly as you provided such as
engine = Engine.from_config(
config_path=recipe_path, data_root=data_root, work_dir="otx-workspace-api", seed=1234
)
***********************************************************
Execute some codes generating random variables,
so that change random number generator's inner states
***********************************************************
engine.train(
deterministic=True,
max_epochs=90,
precision=16,
metric=metric,
)
engine.test(metric=metric)
If you really need this, I think that it only happens if deterministic=True
, I would recommend you to implement
class Engine:
def train(self, deterministic=True):
if deterministic:
reset_random_number_generator()
reinit_model_weights()
reinit_data_sampler()
train()
Yes you are right, we need to take care of this on the seed, deterministic side to get the same behavior for now (which probably doesn't look natural to the user). |
Summary
Engine.from_config()
&CLI
The two examples below do the same thing.
API: from_config
CLI command
Same Test results
How to test
Checklist
License
Feel free to contact the maintainers if that's a concern.