Search is not available for this dataset
repo stringlengths 2 152 ⌀ | file stringlengths 15 239 | code stringlengths 0 58.4M | file_length int64 0 58.4M | avg_line_length float64 0 1.81M | max_line_length int64 0 12.7M | extension_type stringclasses 364
values |
|---|---|---|---|---|---|---|
mmsegmentation | mmsegmentation-master/tools/convert_datasets/drive.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import os.path as osp
import tempfile
import zipfile
import cv2
import mmcv
def parse_args():
parser = argparse.ArgumentParser(
description='Convert DRIVE dataset to mmsegmentation format')
parser.add_argument(
'trainin... | 4,238 | 36.184211 | 78 | py |
mmsegmentation | mmsegmentation-master/tools/convert_datasets/hrf.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import os.path as osp
import tempfile
import zipfile
import mmcv
HRF_LEN = 15
TRAINING_LEN = 5
def parse_args():
parser = argparse.ArgumentParser(
description='Convert HRF dataset to mmsegmentation format')
parser.add_argument... | 4,364 | 37.973214 | 79 | py |
mmsegmentation | mmsegmentation-master/tools/convert_datasets/isaid.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import glob
import os
import os.path as osp
import shutil
import tempfile
import zipfile
import mmcv
import numpy as np
from PIL import Image
iSAID_palette = \
{
0: (0, 0, 0),
1: (0, 0, 63),
2: (0, 63, 63),
3: (0, 63, ... | 8,164 | 32.191057 | 79 | py |
mmsegmentation | mmsegmentation-master/tools/convert_datasets/loveda.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import os.path as osp
import shutil
import tempfile
import zipfile
import mmcv
def parse_args():
parser = argparse.ArgumentParser(
description='Convert LoveDA dataset to mmsegmentation format')
parser.add_argument('dataset_path... | 2,696 | 35.445946 | 76 | py |
mmsegmentation | mmsegmentation-master/tools/convert_datasets/pascal_context.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os.path as osp
from functools import partial
import mmcv
import numpy as np
from detail import Detail
from PIL import Image
_mapping = np.sort(
np.array([
0, 2, 259, 260, 415, 324, 9, 258, 144, 18, 19, 22, 23, 397, 25, 284,
158... | 2,925 | 32.25 | 78 | py |
mmsegmentation | mmsegmentation-master/tools/convert_datasets/potsdam.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import glob
import math
import os
import os.path as osp
import tempfile
import zipfile
import mmcv
import numpy as np
def parse_args():
parser = argparse.ArgumentParser(
description='Convert potsdam dataset to mmsegmentation format')
par... | 5,847 | 36.012658 | 77 | py |
mmsegmentation | mmsegmentation-master/tools/convert_datasets/stare.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import gzip
import os
import os.path as osp
import tarfile
import tempfile
import mmcv
STARE_LEN = 20
TRAINING_LEN = 10
def un_gz(src, dst):
g_file = gzip.GzipFile(src)
with open(dst, 'wb+') as f:
f.write(g_file.read())
g_file.close... | 6,039 | 35.167665 | 78 | py |
mmsegmentation | mmsegmentation-master/tools/convert_datasets/vaihingen.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import glob
import math
import os
import os.path as osp
import tempfile
import zipfile
import mmcv
import numpy as np
def parse_args():
parser = argparse.ArgumentParser(
description='Convert vaihingen dataset to mmsegmentation format')
p... | 5,905 | 36.858974 | 96 | py |
mmsegmentation | mmsegmentation-master/tools/convert_datasets/voc_aug.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os.path as osp
from functools import partial
import mmcv
import numpy as np
from PIL import Image
from scipy.io import loadmat
AUG_LEN = 10582
def convert_mat(mat_file, in_dir, out_dir):
data = loadmat(osp.join(in_dir, mat_file))
mask = ... | 3,107 | 32.419355 | 79 | py |
mmsegmentation | mmsegmentation-master/tools/model_converters/beit2mmseg.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os.path as osp
from collections import OrderedDict
import mmcv
import torch
from mmcv.runner import CheckpointLoader
def convert_beit(ckpt):
new_ckpt = OrderedDict()
for k, v in ckpt.items():
if k.startswith('blocks'):
... | 1,747 | 29.666667 | 79 | py |
mmsegmentation | mmsegmentation-master/tools/model_converters/mit2mmseg.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os.path as osp
from collections import OrderedDict
import mmcv
import torch
from mmcv.runner import CheckpointLoader
def convert_mit(ckpt):
new_ckpt = OrderedDict()
# Process the concat between q linear weights and kv linear weights
f... | 3,069 | 35.987952 | 79 | py |
mmsegmentation | mmsegmentation-master/tools/model_converters/stdc2mmseg.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os.path as osp
import mmcv
import torch
from mmcv.runner import CheckpointLoader
def convert_stdc(ckpt, stdc_type):
new_state_dict = {}
if stdc_type == 'STDC1':
stage_lst = ['0', '1', '2.0', '2.1', '3.0', '3.1', '4.0', '4.1']
... | 2,307 | 31.055556 | 79 | py |
mmsegmentation | mmsegmentation-master/tools/model_converters/swin2mmseg.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os.path as osp
from collections import OrderedDict
import mmcv
import torch
from mmcv.runner import CheckpointLoader
def convert_swin(ckpt):
new_ckpt = OrderedDict()
def correct_unfold_reduction_order(x):
out_channel, in_channel ... | 2,728 | 30.011364 | 79 | py |
mmsegmentation | mmsegmentation-master/tools/model_converters/twins2mmseg.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os.path as osp
from collections import OrderedDict
import mmcv
import torch
from mmcv.runner import CheckpointLoader
def convert_twins(args, ckpt):
new_ckpt = OrderedDict()
for k, v in list(ckpt.items()):
new_v = v
if k.... | 2,752 | 30.284091 | 79 | py |
mmsegmentation | mmsegmentation-master/tools/model_converters/vit2mmseg.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os.path as osp
from collections import OrderedDict
import mmcv
import torch
from mmcv.runner import CheckpointLoader
def convert_vit(ckpt):
new_ckpt = OrderedDict()
for k, v in ckpt.items():
if k.startswith('head'):
... | 2,117 | 28.830986 | 79 | py |
mmsegmentation | mmsegmentation-master/tools/model_converters/vitjax2mmseg.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os.path as osp
import mmcv
import numpy as np
import torch
def vit_jax_to_torch(jax_weights, num_layer=12):
torch_weights = dict()
# patch embedding
conv_filters = jax_weights['embedding/kernel']
conv_filters = conv_filters.permu... | 4,675 | 36.709677 | 79 | py |
mmsegmentation | mmsegmentation-master/tools/torchserve/mmseg2torchserve.py | # Copyright (c) OpenMMLab. All rights reserved.
from argparse import ArgumentParser, Namespace
from pathlib import Path
from tempfile import TemporaryDirectory
import mmcv
try:
from model_archiver.model_packaging import package_model
from model_archiver.model_packaging_utils import ModelExportUtils
except Imp... | 3,700 | 32.044643 | 76 | py |
mmsegmentation | mmsegmentation-master/tools/torchserve/mmseg_handler.py | # Copyright (c) OpenMMLab. All rights reserved.
import base64
import os
import cv2
import mmcv
import torch
from mmcv.cnn.utils.sync_bn import revert_sync_batchnorm
from ts.torch_handler.base_handler import BaseHandler
from mmseg.apis import inference_segmentor, init_segmentor
class MMsegHandler(BaseHandler):
... | 1,867 | 31.77193 | 79 | py |
mmsegmentation | mmsegmentation-master/tools/torchserve/test_torchserve.py | # Copyright (c) OpenMMLab. All rights reserved.
from argparse import ArgumentParser
from io import BytesIO
import matplotlib.pyplot as plt
import mmcv
import requests
from mmseg.apis import inference_segmentor, init_segmentor
def parse_args():
parser = ArgumentParser(
description='Compare result of torc... | 1,795 | 29.440678 | 77 | py |
CSD-locomotion | CSD-locomotion-master/README.md | # Controllability-Aware Unsupervised Skill Discovery
## Overview
This is the official implementation of [**Controllability-aware Skill Discovery** (**CSD**)](https://arxiv.org/abs/2302.05103) on locomotion environments (MuJoCo Ant, HalfCheetah, and Humanoid).
The codebase is based on the implementation of [LSD](https... | 6,890 | 106.671875 | 900 | md |
CSD-locomotion | CSD-locomotion-master/dowel_wrapper.py | import sys
assert 'dowel' not in sys.modules, 'dowel must be imported after dowel_wrapper.'
# https://stackoverflow.com/a/6985648/2182622
import dowel
dowel_eval = dowel
del sys.modules['dowel']
import dowel
dowel_plot = dowel
del sys.modules['dowel']
import dowel
all_dowels = [dowel, dowel_eval, dowel_plot]
assert... | 781 | 25.965517 | 80 | py |
CSD-locomotion | CSD-locomotion-master/global_context.py | import copy
_g_session = None
_g_context = {}
class GlobalContext:
def __init__(self, context):
self.context = context
def __enter__(self):
global _g_context
self.prev_g_context = _g_context
_g_context = self.context
def __exit__(self, exc_type, exc_val, exc_tb):
... | 849 | 20.794872 | 84 | py |
CSD-locomotion | CSD-locomotion-master/setup.py | import os
from setuptools import find_packages
from setuptools import setup
setup(
name='iod',
packages=find_packages(where='.'),
package_dir={'': '.'},
python_requires='>=3.5',
)
| 198 | 15.583333 | 38 | py |
CSD-locomotion | CSD-locomotion-master/dowel/__init__.py | """Logger module.
This module instantiates a global logger singleton.
"""
from dowel.histogram import Histogram
from dowel.logger import Logger, LoggerWarning, LogOutput
from dowel.simple_outputs import StdOutput, TextOutput
from dowel.tabular_input import TabularInput
from dowel.csv_output import CsvOutput # noqa: I... | 634 | 21.678571 | 57 | py |
CSD-locomotion | CSD-locomotion-master/dowel/csv_output.py | """A `dowel.logger.LogOutput` for CSV files."""
import csv
import warnings
from dowel import TabularInput
from dowel.simple_outputs import FileOutput
from dowel.utils import colorize
class CsvOutput(FileOutput):
"""CSV file output for logger.
:param file_name: The file this output should log to.
"""
... | 2,451 | 29.65 | 79 | py |
CSD-locomotion | CSD-locomotion-master/dowel/histogram.py | """Histogram logger input."""
import numpy as np
class Histogram(np.ndarray):
"""A `dowel.logger` input representing a histogram of raw data.
This is implemented as a typed view of a numpy array. It will accept
input that `numpy.asarray` will.
See https://docs.scipy.org/doc/numpy/user/basics.subclas... | 650 | 28.590909 | 76 | py |
CSD-locomotion | CSD-locomotion-master/dowel/logger.py | """Logging facility.
It takes in many different types of input and directs them to the correct
output.
The logger has 4 major steps:
1. Inputs, such as a simple string or something more complicated like
TabularInput, are passed to the log() method of an instantiated Logger.
2. The Logger class checks fo... | 9,416 | 27.536364 | 79 | py |
CSD-locomotion | CSD-locomotion-master/dowel/setup.py | import os
from setuptools import find_packages
from setuptools import setup
setup(
name='dowel',
packages=find_packages(where='.'),
package_dir={'': '.'},
python_requires='>=3.5',
)
| 200 | 15.75 | 38 | py |
CSD-locomotion | CSD-locomotion-master/dowel/simple_outputs.py | """Contains the output classes for the logger.
Each class is sent logger data and handles it itself.
"""
import abc
import datetime
import os
import sys
import dateutil.tz
from dowel import LogOutput
from dowel.tabular_input import TabularInput
from dowel.utils import mkdir_p
class StdOutput(LogOutput):
"""Sta... | 3,052 | 27.801887 | 78 | py |
CSD-locomotion | CSD-locomotion-master/dowel/tabular_input.py | """A `dowel.logger` input for tabular (key-value) data."""
import contextlib
import warnings
import numpy as np
import tabulate
from dowel.utils import colorize
class TabularInput:
"""This class allows the user to create tables for easy display.
TabularInput may be passed to the logger via its log() method... | 4,786 | 29.883871 | 79 | py |
CSD-locomotion | CSD-locomotion-master/dowel/tensor_board_output.py | """A `dowel.logger.LogOutput` for tensorboard.
It receives the input data stream from `dowel.logger`, then add them to
tensorboard summary operations through tensorboardX.
Note:
Neither TensorboardX nor TensorBoard supports log parametric
distributions. We add this feature by sampling data from a
`tfp.distributions.D... | 6,395 | 35.340909 | 79 | py |
CSD-locomotion | CSD-locomotion-master/dowel/utils.py | """Utilities for console outputs."""
import errno
import os
color2num = dict(
gray=30,
red=31,
green=32,
yellow=33,
blue=34,
magenta=35,
cyan=36,
white=37,
crimson=38)
def colorize(string, color, bold=False, highlight=False):
"""Colorize the string for console output."""
... | 796 | 18.439024 | 61 | py |
CSD-locomotion | CSD-locomotion-master/envs/__init__.py | 0 | 0 | 0 | py | |
CSD-locomotion | CSD-locomotion-master/envs/mujoco/__init__.py | 0 | 0 | 0 | py | |
CSD-locomotion | CSD-locomotion-master/envs/mujoco/ant_env.py | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 8,108 | 33.952586 | 124 | py |
CSD-locomotion | CSD-locomotion-master/envs/mujoco/half_cheetah_env.py | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 5,456 | 34.435065 | 87 | py |
CSD-locomotion | CSD-locomotion-master/envs/mujoco/humanoid_env.py | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 9,473 | 36.595238 | 139 | py |
CSD-locomotion | CSD-locomotion-master/envs/mujoco/mujoco_utils.py | from collections import OrderedDict
import akro
import numpy as np
from gym import spaces
def convert_observation_to_space(observation):
if isinstance(observation, dict):
space = spaces.Dict(OrderedDict([
(key, convert_observation_to_space(value))
for key, value in observation.ite... | 3,802 | 38.614583 | 102 | py |
CSD-locomotion | CSD-locomotion-master/garaged/.codecov.yml | coverage:
range: 60..100
status:
patch:
default:
target: 90%
codecov:
ci:
- "travis-ci.com"
notify:
wait_for_ci: yes
after_n_builds: 4
| 174 | 11.5 | 21 | yml |
CSD-locomotion | CSD-locomotion-master/garaged/.mergify.yml | pull_request_rules:
- name: Automatic merge queue for master
conditions:
- base=master
- -conflict
- "#approved-reviews-by>=2"
- "approved-reviews-by=@maintainers"
- "#changes-requested-reviews-by=0"
- status-success=Travis CI - Pull Request
- status-success=codecov/patch... | 939 | 26.647059 | 56 | yml |
CSD-locomotion | CSD-locomotion-master/garaged/.pre-commit-config.yaml | fail_fast: false # set to true to have pre-commit stop running hooks after the first failure.
default_stages: [commit, push]
repos:
- repo: local
hooks:
- id: check-commit-message
stages: [commit-msg]
name: Check commit message
language: script
entry: scripts/check_commit_me... | 3,572 | 48.625 | 120 | yaml |
CSD-locomotion | CSD-locomotion-master/garaged/.travis.yml | language: python
python: "3.5"
services:
- docker
addons:
apt:
packages:
- docker-ce
jobs:
include:
- stage: "Build"
if: NOT fork
name: "Build and cache docker container"
before_script: skip
install: skip
script:
- tag="rlworkgroup/garage-ci:${TRAVIS_BUILD_N... | 3,039 | 26.142857 | 151 | yml |
CSD-locomotion | CSD-locomotion-master/garaged/CHANGELOG.md | # Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## 2020.06.3
- Fixed
* PyTorch 1.7 support ([#1934](https://github... | 35,801 | 62.142857 | 207 | md |
CSD-locomotion | CSD-locomotion-master/garaged/CONTRIBUTING.md | # Contributing to garage
We welcome all contributions to garage.
Use this guide to prepare your contribution.
## Pull requests
All contributions to the garage codebase are submitted via a GitHub pull request.
### Review process
To be submitted, a pull request must satisfy the following criteria:
1. Rebases cleanly o... | 14,354 | 44.283912 | 417 | md |
CSD-locomotion | CSD-locomotion-master/garaged/README.md | [](http://garage.readthedocs.org/en/latest/)
[](https://travis-ci.com/rlworkgroup/garage)
[](https://github.com/rlworkgroup/garage... | 6,792 | 62.485981 | 633 | md |
CSD-locomotion | CSD-locomotion-master/garaged/readthedocs.yml | version: 2
sphinx:
configuration: docs/conf.py
python:
version: 3.7
install:
- requirements: docs/requirements.txt
system_packages: true
| 151 | 12.818182 | 41 | yml |
CSD-locomotion | CSD-locomotion-master/garaged/setup.py | """setuptools based setup module."""
import os
from setuptools import find_packages
from setuptools import setup
GARAGE_GH_TOKEN = os.environ.get('GARAGE_GH_TOKEN') or 'git'
GYM_VERSION = '==0.17.2'
# Required dependencies
REQUIRED = [
# Please keep alphabetized
'akro',
'click>=2.0',
'cloudpickle==1.... | 3,211 | 27.678571 | 159 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/README.md | # garage benchmarking
This guide explains how to write garage benchmark scripts.
### How to write a benchmark script?
**0. Install `garage_benchmarks`**
`cd benchmarks && pip install -e .`
**1. Define an experiment function**
Use `@wrap_experiment` to define your experiment. `ctxt` is used for `@wrap_experiment`.
... | 2,499 | 35.764706 | 217 | md |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/setup.py | """Setup script for garage benchmarking scripts.
This package is generally not needed by users of garage.
"""
import os
from setuptools import find_packages, setup
GARAGE_GH_TOKEN = os.environ.get('GARAGE_GH_TOKEN') or 'git'
REQUIRED = [
# Please keep alphabetized
'baselines @ https://{}@api.github.com/repo... | 822 | 28.392857 | 154 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/__init__.py | """garage benchmarks."""
| 25 | 12 | 24 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/benchmark_algos.py | """Benchmarking for algorithms."""
from garage_benchmarks.experiments.algos import ddpg_garage_tf
from garage_benchmarks.experiments.algos import her_garage_tf
from garage_benchmarks.experiments.algos import ppo_garage_pytorch
from garage_benchmarks.experiments.algos import ppo_garage_tf
from garage_benchmarks.experime... | 1,880 | 32.589286 | 74 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/benchmark_auto.py | """Automatic benchmarking."""
from garage_benchmarks.experiments.algos import ddpg_garage_tf
from garage_benchmarks.experiments.algos import ppo_garage_pytorch
from garage_benchmarks.experiments.algos import ppo_garage_tf
from garage_benchmarks.experiments.algos import td3_garage_tf
from garage_benchmarks.experiments.a... | 1,797 | 35.693878 | 71 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/benchmark_baselines.py | """Benchmarking for baselines."""
import random
from garage_benchmarks.experiments.baselines import continuous_mlp_baseline
from garage_benchmarks.experiments.baselines import gaussian_cnn_baseline
from garage_benchmarks.experiments.baselines import gaussian_mlp_baseline
from garage_benchmarks.helper import benchmark,... | 1,149 | 36.096774 | 78 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/benchmark_policies.py | """Benchmarking for policies."""
import random
from garage_benchmarks.experiments.policies import categorical_cnn_policy
from garage_benchmarks.experiments.policies import categorical_gru_policy
from garage_benchmarks.experiments.policies import categorical_lstm_policy
from garage_benchmarks.experiments.policies impor... | 2,621 | 38.727273 | 77 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/benchmark_q_functions.py | """Benchmarking for q-functions."""
import random
from garage_benchmarks.experiments.q_functions import continuous_mlp_q_function
from garage_benchmarks.helper import benchmark, iterate_experiments
from garage_benchmarks.parameters import MuJoCo1M_ENV_SET
_seeds = random.sample(range(100), 5)
@benchmark
def continu... | 572 | 32.705882 | 79 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/helper.py | """Helper functions for benchmarks.
A decorator and a function are provided for benchmarks. They essentially
take care log directory configuration and result plotting.
The decorator can be with or without parameters to specify options for
plotting and JSON exporting used for automatic benchmarking.
If plot is enable... | 7,681 | 30.483607 | 79 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/parameters.py | """Global parameters for benchmarking."""
from baselines.bench import benchmarks
Fetch1M_ENV_SET = [
task['env_id'] for task in benchmarks.get_benchmark('Fetch1M')['tasks']
]
MuJoCo1M_ENV_SET = [
task['env_id'] for task in benchmarks.get_benchmark('Mujoco1M')['tasks']
]
PIXEL_ENV_SET = ['CubeCrash-v0', 'Memo... | 548 | 23.954545 | 76 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/run_benchmarks.py | #!/usr/bin/env python
"""Script for running benchmarking.
Examples:
# List all benchmark options
benchmark show
# Run selected benchmarks
benchmark run b_1 b_2 ...
"""
import inspect
import click
from garage_benchmarks import benchmark_algos
from garage_benchmarks import benchmark_auto
from garage_b... | 2,950 | 23.591667 | 77 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/__init__.py | """Benchmarking experiments."""
| 32 | 15.5 | 31 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/algos/__init__.py | """Benchmarking experiments for algorithms."""
from garage_benchmarks.experiments.algos.ddpg_garage_tf import ddpg_garage_tf
from garage_benchmarks.experiments.algos.her_garage_tf import her_garage_tf
from garage_benchmarks.experiments.algos.ppo_garage_pytorch import (
ppo_garage_pytorch)
from garage_benchmarks.exp... | 985 | 48.3 | 77 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/algos/ddpg_garage_tf.py | """A regression test for automatic benchmarking garage-TensorFlow-DDPG."""
import gym
import tensorflow as tf
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic
from garage.experiment import LocalTFRunner
from garage.np.exploration_policies impor... | 2,951 | 34.566265 | 75 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/algos/her_garage_tf.py | """A regression test for automatic benchmarking garage-TensorFlow-HER."""
import gym
import tensorflow as tf
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic
from garage.experiment import LocalTFRunner
from garage.np.exploration_policies import... | 3,031 | 32.318681 | 78 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/algos/ppo_garage_pytorch.py | """A regression test for automatic benchmarking garage-PyTorch-PPO."""
import gym
import torch
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic, LocalRunner
from garage.torch.algos import PPO as PyTorch_PPO
from garage.torch.optimizers import O... | 2,677 | 36.194444 | 77 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/algos/ppo_garage_tf.py | """A regression test for automatic benchmarking garage-TensorFlow-PPO."""
import gym
import tensorflow as tf
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic
from garage.experiment import LocalTFRunner
from garage.tf.algos import PPO as TF_PPO
... | 2,447 | 31.64 | 74 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/algos/td3_garage_tf.py | """A regression test for automatic benchmarking garage-TensorFlow-TD3."""
import gym
import tensorflow as tf
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic
from garage.experiment import LocalTFRunner
from garage.np.exploration_policies import... | 3,589 | 34.544554 | 75 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/algos/trpo_garage_pytorch.py | """A regression test for automatic benchmarking garage-PyTorch-TRPO."""
import gym
import torch
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic, LocalRunner
from garage.torch.algos import TRPO as PyTorch_TRPO
from garage.torch.policies import ... | 2,125 | 33.852459 | 77 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/algos/trpo_garage_tf.py | """A regression test for automatic benchmarking garage-TensorFlow-TRPO."""
import gym
import tensorflow as tf
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic
from garage.experiment import LocalTFRunner
from garage.np.baselines import LinearFea... | 1,938 | 30.786885 | 74 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/algos/vpg_garage_pytorch.py | """A regression test for automatic benchmarking garage-PyTorch-VPG."""
import gym
import torch
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic, LocalRunner
from garage.torch.algos import VPG as PyTorch_VPG
from garage.torch.optimizers import O... | 2,771 | 36.972603 | 77 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/algos/vpg_garage_tf.py | """A regression test for automatic benchmarking garage-TensorFlow-VPG."""
import gym
import tensorflow as tf
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic
from garage.experiment import LocalTFRunner
from garage.np.baselines import LinearFeat... | 2,023 | 31.645161 | 77 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/baselines/__init__.py | """Benchmarking experiments for baselines."""
from garage_benchmarks.experiments.baselines.continuous_mlp_baseline import (
continuous_mlp_baseline)
from garage_benchmarks.experiments.baselines.gaussian_cnn_baseline import (
gaussian_cnn_baseline)
from garage_benchmarks.experiments.baselines.gaussian_mlp_baseli... | 454 | 36.916667 | 79 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/baselines/continuous_mlp_baseline.py | """Benchmarking experiment of the ContinuousMLPBaseline."""
import gym
import tensorflow as tf
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic
from garage.experiment import LocalTFRunner
from garage.tf.algos import PPO
from garage.tf.baselines... | 2,689 | 32.625 | 74 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/baselines/gaussian_cnn_baseline.py | """Benchmarking experiment of the GaussianCNNBaseline."""
import gym
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic
from garage.experiment import LocalTFRunner
from garage.tf.algos import PPO
from garage.tf.baselines import GaussianCNNBaselin... | 2,605 | 32.410256 | 77 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/baselines/gaussian_mlp_baseline.py | """Benchmarking experiment of the GaussianMLPBaseline."""
import gym
import tensorflow as tf
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic
from garage.experiment import LocalTFRunner
from garage.tf.algos import PPO
from garage.tf.baselines i... | 2,118 | 29.271429 | 66 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/policies/__init__.py | """Benchmarking experiments for baselines."""
from garage_benchmarks.experiments.policies.categorical_cnn_policy import (
categorical_cnn_policy)
from garage_benchmarks.experiments.policies.categorical_gru_policy import (
categorical_gru_policy)
from garage_benchmarks.experiments.policies.categorical_lstm_polic... | 1,092 | 42.72 | 76 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/policies/categorical_cnn_policy.py | """Benchmarking experiment of the CategoricalCNNPolicy."""
import gym
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic
from garage.experiment import LocalTFRunner
from garage.tf.algos import PPO
from garage.tf.baselines import GaussianCNNBaseli... | 2,539 | 30.75 | 67 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/policies/categorical_gru_policy.py | """Benchmarking experiment of the CategoricalGRUPolicy."""
import gym
import tensorflow as tf
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic
from garage.experiment import LocalTFRunner
from garage.np.baselines import LinearFeatureBaseline
fro... | 1,685 | 28.578947 | 66 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/policies/categorical_lstm_policy.py | """Benchmarking experiment of the CategoricalLSTMPolicy."""
import gym
import tensorflow as tf
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic
from garage.experiment import LocalTFRunner
from garage.np.baselines import LinearFeatureBaseline
fr... | 1,690 | 28.666667 | 66 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/policies/categorical_mlp_policy.py | """Benchmarking experiment of the CategoricalMLPPolicy."""
import gym
import tensorflow as tf
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic
from garage.experiment import LocalTFRunner
from garage.np.baselines import LinearFeatureBaseline
fro... | 1,774 | 31.272727 | 66 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/policies/continuous_mlp_policy.py | """Benchmarking experiment of the ContinuousMLPPolicy."""
import gym
import tensorflow as tf
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic
from garage.experiment import LocalTFRunner
from garage.np.exploration_policies import AddOrnsteinUhle... | 3,007 | 34.388235 | 71 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/policies/gaussian_gru_policy.py | """Benchmarking experiment of the GaussianGRUPolicy."""
import gym
import tensorflow as tf
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic
from garage.experiment import LocalTFRunner
from garage.tf.algos import PPO
from garage.tf.baselines imp... | 2,105 | 28.661972 | 66 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/policies/gaussian_lstm_policy.py | """Benchmarking experiment of the GaussianLSTMPolicy."""
import gym
import tensorflow as tf
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic
from garage.experiment import LocalTFRunner
from garage.tf.algos import PPO
from garage.tf.baselines im... | 2,110 | 28.732394 | 66 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/policies/gaussian_mlp_policy.py | """Benchmarking experiment of the GaussianMLPPolicy."""
import gym
import tensorflow as tf
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic
from garage.experiment import LocalTFRunner
from garage.tf.algos import PPO
from garage.tf.baselines imp... | 2,113 | 28.774648 | 66 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/q_functions/__init__.py | """Benchmarking experiments for Q-functions."""
from garage_benchmarks.experiments.q_functions.continuous_mlp_q_function import ( # noqa: E501
continuous_mlp_q_function)
__all__ = ['continuous_mlp_q_function']
| 216 | 35.166667 | 95 | py |
CSD-locomotion | CSD-locomotion-master/garaged/benchmarks/src/garage_benchmarks/experiments/q_functions/continuous_mlp_q_function.py | """Benchmarking experiment of the ContinuousMLPQFunction."""
import gym
import tensorflow as tf
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import deterministic
from garage.experiment import LocalTFRunner
from garage.np.exploration_policies import AddOrnsteinU... | 3,017 | 34.505882 | 71 | py |
CSD-locomotion | CSD-locomotion-master/garaged/docker/README.md | # Using Docker to run garage
Currently there are two types of garage images:
- headless: garage without environment visualization.
- nvidia: garage with environment visualization using an NVIDIA graphics
card.
## Headless image
If you already have a copy of garage, proceed to subsection ["Build and run the
i... | 4,049 | 32.471074 | 108 | md |
CSD-locomotion | CSD-locomotion-master/garaged/docs/conf.py | # -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
#
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
import os
import sys
from recommonmark.parse... | 11,105 | 30.372881 | 94 | py |
CSD-locomotion | CSD-locomotion-master/garaged/docs/_static/theme_overrides.css | /* override table width restrictions*/
@media screen and (min-width: 767px) {
.wy-table-responsive table td {
/* !important prevents the common CSS stylesheets from overriding
this as on RTD they are loaded after this stylesheet */
white-space: normal !important;
}
.wy-table-responsive {... | 364 | 25.071429 | 71 | css |
CSD-locomotion | CSD-locomotion-master/garaged/examples/sim_policy.py | #!/usr/bin/env python3
"""Simulates pre-learned policy."""
import argparse
import sys
import joblib
import tensorflow as tf
from garage.sampler.utils import rollout
def query_yes_no(question, default='yes'):
"""Ask a yes/no question via raw_input() and return their answer.
"question" is a string that is pr... | 2,300 | 31.408451 | 75 | py |
CSD-locomotion | CSD-locomotion-master/garaged/examples/step_dm_control_env.py | #!/usr/bin/env python3
"""Example of how to load, step, and visualize an environment.
This example requires that garage[dm_control] be installed.
"""
import argparse
from garage.envs.dm_control import DmControlEnv
parser = argparse.ArgumentParser()
parser.add_argument('--n_steps',
type=int,
... | 748 | 22.40625 | 62 | py |
CSD-locomotion | CSD-locomotion-master/garaged/examples/step_env.py | #!/usr/bin/env python3
"""Example of how to load, step, and visualize an environment."""
import argparse
import gym
parser = argparse.ArgumentParser()
parser.add_argument('--n_steps',
type=int,
default=1000,
help='Number of steps to run')
args = parser.parse... | 621 | 20.448276 | 65 | py |
CSD-locomotion | CSD-locomotion-master/garaged/examples/np/cem_cartpole.py | #!/usr/bin/env python3
"""This is an example to train a task with Cross Entropy Method.
Here it runs CartPole-v1 environment with 100 epoches.
Results:
AverageReturn: 100
RiseTime: epoch 8
"""
from garage import wrap_experiment
from garage.envs import GarageEnv
from garage.experiment import LocalTFRunner
from... | 1,672 | 29.981481 | 72 | py |
CSD-locomotion | CSD-locomotion-master/garaged/examples/np/cma_es_cartpole.py | #!/usr/bin/env python3
"""This is an example to train a task with CMA-ES.
Here it runs CartPole-v1 environment with 100 epoches.
Results:
AverageReturn: 100
RiseTime: epoch 38 (itr 760),
but regression is observed in the course of training.
"""
from garage import wrap_experiment
from garage.envs... | 1,702 | 30.537037 | 72 | py |
CSD-locomotion | CSD-locomotion-master/garaged/examples/tf/ddpg_pendulum.py | #!/usr/bin/env python3
"""This is an example to train a task with DDPG algorithm.
Here it creates a gym environment InvertedDoublePendulum. And uses a DDPG with
1M steps.
Results:
AverageReturn: 250
RiseTime: epoch 499
"""
import gym
import tensorflow as tf
from garage import wrap_experiment
from garage.envs... | 2,642 | 33.776316 | 78 | py |
CSD-locomotion | CSD-locomotion-master/garaged/examples/tf/dqn_cartpole.py | #!/usr/bin/env python3
"""An example to train a task with DQN algorithm.
Here it creates a gym environment CartPole, and trains a DQN with 50k steps.
"""
import gym
from garage import wrap_experiment
from garage.envs import GarageEnv
from garage.experiment import LocalTFRunner
from garage.experiment.deterministic imp... | 2,479 | 37.153846 | 79 | py |
CSD-locomotion | CSD-locomotion-master/garaged/examples/tf/dqn_pong.py | #!/usr/bin/env python3
"""This is an example to train a task with DQN algorithm in pixel environment.
Here it creates a gym environment Pong, and trains a DQN with 1M steps.
"""
import click
import gym
from garage import wrap_experiment
from garage.envs import GarageEnv
from garage.envs.wrappers.clip_reward import Cl... | 4,193 | 38.942857 | 79 | py |
CSD-locomotion | CSD-locomotion-master/garaged/examples/tf/erwr_cartpole.py | #!/usr/bin/env python3
"""This is an example to train a task with ERWR algorithm.
Here it runs CartpoleEnv on ERWR with 100 iterations.
Results:
AverageReturn: 100
RiseTime: itr 34
"""
from garage import wrap_experiment
from garage.envs import GarageEnv
from garage.experiment import LocalTFRunner
from garage.... | 1,543 | 28.692308 | 72 | py |
CSD-locomotion | CSD-locomotion-master/garaged/examples/tf/her_ddpg_fetchreach.py | #!/usr/bin/env python3
"""This is an example to train a task with DDPG + HER algorithm.
Here it creates a gym environment FetchReach.
"""
import gym
import tensorflow as tf
from garage import wrap_experiment
from garage.envs import GarageEnv
from garage.experiment import LocalTFRunner
from garage.experiment.determini... | 2,700 | 31.542169 | 73 | py |
CSD-locomotion | CSD-locomotion-master/garaged/examples/tf/multi_env_ppo.py | #!/usr/bin/env python3
"""This is an example to train multiple tasks with PPO algorithm."""
import gym
import tensorflow as tf
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.envs.multi_env_wrapper import MultiEnvWrapper
from garage.experiment import LocalTFRunner
from garag... | 1,887 | 31 | 72 | py |
CSD-locomotion | CSD-locomotion-master/garaged/examples/tf/multi_env_trpo.py | #!/usr/bin/env python3
"""This is an example to train multiple tasks with TRPO algorithm."""
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.envs import PointEnv
from garage.envs.multi_env_wrapper import MultiEnvWrapper
from garage.experiment import LocalTFRunner
from garage.... | 1,632 | 32.326531 | 72 | py |
CSD-locomotion | CSD-locomotion-master/garaged/examples/tf/ppo_memorize_digits.py | #!/usr/bin/env python3
"""This is an example to train a task with PPO algorithm.
Here it runs MemorizeDigits-v0 environment with 1000 iterations.
"""
import click
import gym
from garage import wrap_experiment
from garage.envs import GarageEnv, normalize
from garage.experiment import LocalTFRunner
from garage.experime... | 2,918 | 36.423077 | 76 | py |