-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Can't cast Trainer automatically generated args to their required types #1139
Comments
@alexeykarnachev could you pls give a complete example, I am missing which is the
if you need the default values, pls use |
Yes, sorry for the insufficient details from my side. Here is a gist: It's not runnable script, because I've simplified it a lot. But it contains the problem i've described. If I'll execute this script with any Trainer argument, for example:
It will fail without the types casting, because |
if do understand your use-case you want to have some parameters to be passed from CMD and/but some Trainer arguments to be fixed - forced to have a certain value, right?
but in the case of |
Yes, I'll do it. But do you have any suggestions of how can it be performed ?
And it's possible to pass a |
Please, consider a PR #1147 |
don’t we already have support for this? |
@williamFalcon this issue is about assigning types for the automatically added arguments. By default argparser assumes that they are strings. And these string typed args will be passed to the trainer constructor, and will break it. So, this issue is about types casting, but not about any new functionality |
❓ Questions and Help
What is your question?
I'm not sure, that this is a bug, so I put it like a question.
The problem is: if I want to add the Trainer arguments to my custom
ArgumentParser
object, I call theadd_argparse_args
Trainer classmethod. But this method doesn't cast the Trainer arguments to their required types.It forces me to cast the arguments by myself. Like so:
And after that, I can pass updated arguments to the Trainer:
And I can't find a central place, where the Trainer handles an automatically generated arguments (their types).
What have you tried?
I've tried to pass arguments to the trainer without handling their types. For instance, if i'll not cast
accumulate_grad_batches
to the integer type, the exception will be raised:What's your environment?
The text was updated successfully, but these errors were encountered: