Skip to content

Add option to pass list of arguments as hyperparameters instead of dict #2689

@nateraw

Description

@nateraw

Describe the feature you'd like

Right now, you have to pass hyperparameters as a dict, with keys being the name of the flag and values being the explicitly defined value. That can be fine in many scenarios, but is very frustrating if you have a script that accepts argparse actions, as the hyperparameters you need to pass do not match the user experience of passing store_true-type flags.

How would this feature be used? Please describe.
A clear and concise description of the use case for this feature. Please provide an example, if possible.

I'd like the option to pass arguments as a list of strings (a la sys.argv).

estimator = HuggingFace(
    ...
    hyperparameters=['--output_dir', 'my_output_dir/', '--do_train', '--do_eval']
)

Describe alternatives you've considered

This could be a new kwarg for estimators called arguments instead, that way there's no collision between current hyperparameters kwarg.

Additional context

This enables you to build runners that can run right from the command line, avoiding any need to write python code.

python some_script.py --some_flag some_value --some_action_flag

...can be run via a wrapper you can put together if this feature is enabled. Here I call it run_on_sagemaker.

run_on_sagemaker some_script.py --some_flag some_value --some_action_flag

as opposed to what you'd have to do now, where you must explicitly define action flag values.

run_on_sagemaker some_script.py --some_flag some_value --some_action_flag True

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions