-
Notifications
You must be signed in to change notification settings - Fork 394
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
add example with python parameters file #1799
Conversation
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.
Thank you @aandrusenko !
Missing a couple files:
- \content\docs\start\experiments.md
- \content\docs\user-guide\basic-concepts\parameter.md
Would you mind including them? I can do it if you're unable for any reason, no problem at all.
@shcheklein this makes me realize we only have |
@jorgeorpinel I would not make it a priority, I hope users can figure the idea out from the YAML example.
|
OK. @aandrusenko would you like to try adding a Python params file example in content\docs\command-reference\params\index.md ? Again, I can do it if not. Thanks |
was done
added |
I have already added an example |
Oh, I see. I didn't notice it the first time I looked. OK, checking again now ⌛ |
Alternatively, the entire `TestConfig` group can be referenced, instead of the | ||
parameters in it: |
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.
What other data structures are supported as groups other than classes @aandrusenko @efiop ? Thanks
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.
Only classes and dicts
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.
Looks good. There's a couple minor questions left above which may need addressing but could be merged as-is too, probably.
Do you want to double check @shcheklein ? Thanks
I see that some checks failed? Also, please let's merge upstream master to run (new) link checks? |
``` | ||
|
||
The following [stage](/doc/command-reference/run) depends on params | ||
`IS_BOOL`, `CONST`, as well as `TrainConfig`'s `EPOCHS` and `layers`: |
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.
@aandrusenko qq - if we depend on the instance variable (self.layers
), when do we extract value? What is the semantics here?
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.
From a class, you can extract either class constants or self
variables defined in __init__
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.
Yep, thanks! But what about the semantics? What if I have
self.layers = 10
self.layers = 12
or if I have
self.layers = 3+2
what are the expectations and limitations here?
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.
In the first case, TrainConfig.layers
will be 12
. In the second, TrainConfig.layers
will not be found because the complex expression
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.
let's make it part of the docs and/or example? @aandrusenko it's totally fine if you don't have enough capacity, let us know and we'll take it over, but I think we should specify some basic semantics for this. Modifying example (add a few lines with Python comments + some text ?) should be enough, I guess.
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.
@shcheklein, I added more comments
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.
we still have some open questions we need to answer (and potentially add details to the docs)
@efiop @aandrusenko it would be great if you could help us here
b7eed66
to
ce31fda
Compare
@shcheklein @jorgeorpinel I squashed changes and rebased |
Thanks @aandrusenko ! Looks like there is a conflict. We can fix it on my end, but feel free to rebase if you want. |
ce31fda
to
7f4b8a0
Compare
7f4b8a0
to
2dddbed
Compare
@aandrusenko perfect, thanks! 🙏 one last thing - something is happening with GH not attributing commits to you- could you please check your local and GH settings. Both should use the same email I think. |
3d354f1
to
f3f8b03
Compare
f3f8b03
to
c16149b
Compare
Oh, sorry, fixed it |
thanks @aandrusenko ! |
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.
Post-merge review that I'll address myself. Includes some questions though:
def __init__(self): | ||
# TrainConfig.layers param will be 9 | ||
self.layers = 5 | ||
self.layers = 9 | ||
# TrainConfig.foo will NOT be found because the complex expression | ||
self.foo = 1 + 2 | ||
# TrainConfig.bar will NOT be found | ||
bar = 1 |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
Why can't DVC find vars that need evaluation though? Isn't the whole params file interpreted by Python first @aandrusenko @efiop? (Just curious) Thanks
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.
Nope, parameters are parsed using the ast
module, it parses complex expressions into a complex structure that I did not support
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 see, thanks.
Related to iterative/dvc#4456