Skip to content

How do you run examples using python main.py? #20

@jackwilkinson255

Description

@jackwilkinson255

How do you run mbpo/examples/development/main.py on command line using 'python main.py', rather than doing:

mbpo run_local examples.development --config=examples.config.halfcheetah.0 --gpus=1 --trial-gpus=1

Here's what I've changed in the main.py file but it doesn't work:

def main(argv=None):
    """Run ExperimentRunner locally on ray.

    To run this example on cloud (e.g. gce/ec2), use the setup scripts:
    'softlearning launch_example_{gce,ec2} examples.development <options>'.

    Run 'softlearning launch_example_{gce,ec2} --help' for further
    instructions.
    """
    # __package__ should be `development.main`

    run_example_local('examples.development.main', argv, local_mode=True)

if __name__ == '__main__':

    main(argv = ['--config=examples.config.halfcheetah.0', '--gpus=1', '--trial-gpus=1'])

Gets the error:

Traceback (most recent call last):
  File "/home/jack/repos/mbpo/examples/development/main.py", line 255, in <module>
    main(argv = ['--config=examples.config.halfcheetah.0', '--gpus=1', '--trial-gpus=1'])
  File "/home/jack/repos/mbpo/examples/development/main.py", line 248, in main
    run_example_local('examples.development.main', argv, local_mode=True)
  File "/home/jack/repos/mbpo/examples/instrument.py", line 205, in run_example_local
    example_args = example_module.get_parser().parse_args(example_argv)
AttributeError: module 'examples.development.main' has no attribute 'get_parser'

I'd like to run it this way for debugging purposes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions