def run_task(snapshot_config, *_):
    """Set up environment and algorithm and run the task.

    Args:
        snapshot_config (garage.experiment.SnapshotConfig): The snapshot
            configuration used by LocalRunner to create the snapshotter.
            If None, it will create one with default settings.
        _ : Unused parameters

    """
    env = TfEnv(env_name='Pusher3DOF-v1')

    runner = LocalRunner(snapshot_config)

    policy = GaussianMLPPolicy(env.spec,
                               hidden_sizes=[32, 32],
                               hidden_nonlinearity=torch.tanh,
                               output_nonlinearity=None)

    baseline = LinearFeatureBaseline(env_spec=env.spec)

    algo = TRPO(env_spec=env.spec,
                policy=policy,
                baseline=baseline,
                max_path_length=49,
                discount=0.99,
                center_adv=False,
                max_kl_step=0.005,
                **copyparams)

    #runner.setup(algo, env)
    #runner.train(n_epochs=100, batch_size=50*250)
    runner.restore(
        "/home/dell/garage/data/local/pusher/pusher_2020_06_01_23_45_24_0001")
    runner.resume(n_epochs=800)
示例#2
0
def resume_experiment(ctxt, saved_dir):
    """Resume a PyTorch experiment.

    Args:
        ctxt (garage.experiment.ExperimentContext): The experiment
            configuration used by LocalRunner to create the snapshotter.
        saved_dir (str): Path where snapshots are saved.

    """
    runner = LocalRunner(snapshot_config=ctxt)
    runner.restore(from_dir=saved_dir)
    runner.resume()