forked from rlworkgroup/garage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move garage package to src/ (rlworkgroup#665)
This simplifies packaging for pip, and complies with Python packaging best practices.
- Loading branch information
1 parent
544d5fd
commit 8b1bac8
Showing
195 changed files
with
680 additions
and
623 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# project metadata | ||
# | ||
# NOTE: README.md and VERSION are required to run setup.py. Failure to include | ||
# them will create a broken PyPI distribution. | ||
include README.md | ||
include VERSION | ||
include LICENSE | ||
include CONTRIBUTING.md | ||
include CHANGELOG.md | ||
|
||
# tests | ||
graft tests | ||
include setup.cfg | ||
|
||
# documentation | ||
graft docs | ||
prune docs/_build | ||
|
||
# examples, scripts, etc. | ||
include Makefile | ||
graft docker | ||
graft examples | ||
graft scripts | ||
|
||
# ignored files | ||
global-exclude *.py[co] | ||
global-exclude .DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
An example to train a task with DQN algorithm. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
This is an example to train a task with DQN algorithm in pixel environment. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
This is an example to train a task with REPS algorithm. | ||
|
37 changes: 0 additions & 37 deletions
37
garage/contrib/alexbeloi/examples/trpois_inverted_pendulum.py
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
garage/contrib/alexbeloi/examples/vpgis_inverted_pendulum.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
50 changes: 50 additions & 0 deletions
50
src/garage/contrib/alexbeloi/examples/trpois_inverted_pendulum.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
""" | ||
Example using TRPO with ISSampler. | ||
Iterations alternate between live and importance sampled iterations. | ||
""" | ||
import gym | ||
|
||
from garage.contrib.alexbeloi.is_sampler import ISSampler | ||
from garage.envs import normalize | ||
from garage.experiment import LocalRunner, run_experiment | ||
from garage.np.baselines import LinearFeatureBaseline | ||
from garage.tf.algos import TRPO | ||
from garage.tf.envs import TfEnv | ||
from garage.tf.policies import GaussianMLPPolicy | ||
|
||
|
||
def run_task(*_): | ||
"""Run the job.""" | ||
with LocalRunner() as runner: | ||
env = TfEnv(normalize(gym.make('InvertedPendulum-v2'))) | ||
|
||
policy = GaussianMLPPolicy(env_spec=env.spec, hidden_sizes=(32, 32)) | ||
|
||
baseline = LinearFeatureBaseline(env_spec=env.spec) | ||
|
||
optimizer_args = dict( | ||
# debug_nan=True, | ||
# reg_coeff=0.1, | ||
# cg_iters=2 | ||
) | ||
|
||
algo = TRPO( | ||
env_spec=env.spec, | ||
policy=policy, | ||
baseline=baseline, | ||
max_path_length=100, | ||
discount=0.99, | ||
max_kl_step=0.01, | ||
optimizer_args=optimizer_args) | ||
|
||
runner.setup( | ||
algo, env, sampler_cls=ISSampler, sampler_args=dict(n_backtrack=1)) | ||
runner.train(n_epochs=200, batch_size=4000) | ||
|
||
|
||
run_experiment( | ||
run_task, | ||
snapshot_mode='last', | ||
seed=1, | ||
) |
44 changes: 44 additions & 0 deletions
44
src/garage/contrib/alexbeloi/examples/vpgis_inverted_pendulum.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
""" | ||
Example using VPG with ISSampler. | ||
Iterations alternate between live and importance sampled iterations. | ||
""" | ||
import gym | ||
|
||
from garage.contrib.alexbeloi.is_sampler import ISSampler | ||
from garage.envs import normalize | ||
from garage.experiment import LocalRunner, run_experiment | ||
from garage.np.baselines import LinearFeatureBaseline | ||
from garage.tf.algos import VPG | ||
from garage.tf.envs import TfEnv | ||
from garage.tf.policies import GaussianMLPPolicy | ||
|
||
|
||
def run_task(*_): | ||
"""Run the job.""" | ||
with LocalRunner() as runner: | ||
env = TfEnv(normalize(gym.make('InvertedPendulum-v2'))) | ||
|
||
policy = GaussianMLPPolicy(env_spec=env.spec, hidden_sizes=(32, 32)) | ||
|
||
baseline = LinearFeatureBaseline(env_spec=env.spec) | ||
|
||
algo = VPG( | ||
env_spec=env.spec, | ||
policy=policy, | ||
baseline=baseline, | ||
max_path_length=100, | ||
discount=0.99, | ||
max_kl_step=0.01, | ||
) | ||
|
||
runner.setup( | ||
algo, env, sampler_cls=ISSampler, sampler_args=dict(n_backtrack=1)) | ||
runner.train(n_epochs=40, batch_size=4000) | ||
|
||
|
||
run_experiment( | ||
run_task, | ||
snapshot_mode='last', | ||
seed=1, | ||
) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from garage.core.serializable import Serializable | ||
from garage.core.parameterized import Parameterized # noqa: I100 | ||
|
||
__all__ = ["Serializable", "Parameterized"] | ||
__all__ = ['Serializable', 'Parameterized'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.