I use argparse
as an argument parser in my python code. What is the best way to parse a dictionary to an argparse object?
For example, My dictionary is:
{
"activation_dropout": 0.0,
"activation_fn": "gelu",
"attention_dropout": 0.0,
"beam": 1,
}
What I expect is an argparse.Namespace
object with attributes activation_dropout
, activation_fn
, attention_dropout
, and beam
I wish there was a method in argparse
that takes input as a dictionary and gives out an argparse
with the namespace as those variables.