-
Notifications
You must be signed in to change notification settings - Fork 661
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
remote execution with hydra #219
Comments
This is awesome stuff @elinep !
What do you think? Edit: |
Glad to read your willing to support hydra ;)
And here a snippet to generate a trains hyperparameter view of the yaml file. The purpose is to profit from the hyperparameter diff provided by trains when comparing experiments.
Maybe a first step is for trains to support Omegaconf configuration (the object generated by hydra based on the composition of all the yaml files) and let the user deal with hydra. This way we can link hyperparameter as usual:
As always thank you for your great support ! |
I would imagine Assuming (1) is done, and
😊 Thank you! |
Lots of questions. |
👍
Indeed, I think we only have to store the Omegaconf. ConfigStore is just a tool to describe configurations from python instead of yaml files along the application. It can store values but hydra merges all informations from yaml files, ConfigStore and CLI to generate a OmegaConf config for the application. I have not much experience with OmegaConf. It might be complex object for you to handle. It might be simpler and safer to rely on its yaml serialization/deserialization to connect it with trains as I did in the minimal example.
Yes it works (beside the working_dir detection issue) . When remotely executed, the config is provided by trains based on the model_configuration. Therefore we can edit the model_configuration on the UI to tweak the task. Although It is not as powerful as running from the command line since hydra can't help building the conf (autocompletion, preset suggestion, etc...)
Yes it is argparse based. I considered two options to save the config:
I think you can let the user decide to autoconnect or not with auto_connect_arg_parser argument from Task.init(). Argparse override should work fine. When we enter the main function (the one decorated with hydra) the config should be complete. Although in my current application, I edit it inside the main() before calling task.connect_configuration(). |
Hi @elinep
Points to think about
What do you think? BTW: |
I love this proposal. I would also like to add a suggestion from my use experience. $ python train.py +optimizer=adam optimizer.lr=0.003 so that later I would be able to run experiment with |
That's an implementation detail, argparse is really nasty and I causes almost too much problems even with limited amount of usage Hydra is making with it. Another thing that is worth considering is that argparse contains parameters for Hydra itself. some of which are not easy to translate. for example --config-dir points to a local directory that contains additional configs. --multirun completely changes the behavior of Hydra, and makes it run the function multiple times with different arguments etc. |
@elinep you can force hydra not to change working directory:
|
@EgShes @bmartinn
Indeed, not very practical, that's why I ended up doing things like in the script I linked above.
I'm not sure I'm following you on this one. Maybe it is a question of taste:
In my opinion, currently the most convenient way to run remotely a new experiment is to run it locally and use task.execute_remotely() to enqueue it.
Indeed that would be awesome! I guess it is a lot of work.
One app, one task, sounds right.
yes probably.
You mean the custom app config help defined by the user ? If I'm correct there is not such things with hydra yet.
I think the final OmegaConf object is enough but I might lack of experience with hydra.
Indeed, it could save the user writing some boilerplate code such as:
|
I think that we all agree that even though the @elinep I love the new reference implementation script (the @omry as far as I understand there is no callback to register before the app is being launched, so my thinking is to monkey-patch the Basically my suggestion is for The easiest way to implement it would be to make sure, you call the Task.init before the main hydra app, but as previously mentioned that is a reasonable assumption. What do you guys think? |
@bmartinn, there is no callback YET. |
I am going to close my eyes and pretend it didn't happen. |
😄
Sure, I agree. Given these constrains, is that possible?
@omry what do you think? |
Yes.
It could also be called inside the Launcher.
Launcher is not involved in Hydra 1.0. Since there are no callbacks yet users will have to call Task.init.
Launcher is on the execution path before the user's function. You can check existing Launcher plugins in Hydra repo for inspiration. |
@elinep, @iakremnev, @EgShes, what do you think? |
…x cwd outside of repository root folder
Hi @bmartinn
|
Thank you for testing @elinep ! |
I did nothing special. The first time I ran the script I had no error but the script info on the web page results were blank. Here is how I tested the patch:
|
Thanks @elinep ! |
I confirm it works now. |
Hi @elinep
Here is how it works.
When executing remotely (only 2 supports overriding), you can add overrides in the Hyper-Parameter section, and they should work as expected. You can also set What do you think? |
Hi @bmartinn, I tried your commit. It is a good first step. Here are my thoughts:
Unfortunately as you wrote it, this is incompatible with UI config edition and remote execution. |
Hi @elinep , Regrading (3), I'm open to suggestions :) EDIT: |
Hi @elinep
|
Hi @elinep, Closing this as the support has been part of ClearML SDK for a long time. Please re-open if there are any issues. |
Hello trains team,
I'm trying to use trains and hydra.
hydra is nice to manage configuration and helps the user to build one from the command line with auto-completion and preset features.
Nevertheless I'm strugling with remote execution. As explained here, hydra changes the working dir which defeats trains
script information detector.
At runtime hydra creates a directory to compose the configuration and set the working dir inside that untracked directory.
If we tried to remote execute such a task, trains-agent complains that the working dir does not exist.
I came up with two non sastisfactoring partial solutions demonstrated here
First the defective script:
The trains task is created inside hydra main, working_dir and entrypoint are wrong.
Fisrt fix attempt:
The trains task is created before entering hydra's main function. Script info are indeed correct, but I'd like to modify the task name and project according to the application config. I did not find a way to set the project name once the task is created.
Anyway I don't find this solution to be elegant.
Second fix attempt:
The task is created inside hydra's context and I try to update the working_dir and entrypoint. I tested this solution in my closed source application. It looks very fragile as the script info is filled by a trains thread and I didn't find a way to porperly synchronize with it although this minimal example seems to work.
Any suggestion ?
The text was updated successfully, but these errors were encountered: