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
signal_transformer
signal_transformer-master/training/training.py
import os from argparse import ArgumentParser import tensorflow as tf from tensorflow_addons.optimizers import AdamW import yaml from utils.dataset import load_dataset from utils.experiment import ExperimentHandler, restore_from_checkpoint_latest, ds_tqdm from utils.device import allow_memory_growth from model.signal_...
7,668
38.530928
113
py
signal_transformer
signal_transformer-master/utils/__init__.py
0
0
0
py
signal_transformer
signal_transformer-master/utils/dataset.py
import tensorflow as tf import pickle def tf_dataset(dataset, start_cut=0, cut_length=160): def generator(): for step in dataset: s = step['signal'][start_cut:(start_cut + cut_length)] signal = tf.convert_to_tensor(s, tf.float32) position = tf.convert_to_tensor(step['po...
997
29.242424
83
py
signal_transformer
signal_transformer-master/utils/device.py
import tensorflow as tf def allow_memory_growth(): gpus = tf.config.experimental.list_physical_devices('GPU') if gpus: try: # Currently, memory growth needs to be the same across GPUs for gpu in gpus: tf.config.experimental.set_memory_growth(gpu, True) ...
600
36.5625
81
py
signal_transformer
signal_transformer-master/utils/experiment.py
import io import os import zipfile import requests import tensorflow as tf from tqdm import tqdm class ExperimentHandler(object): def __init__(self, working_path, out_name, max_to_keep=3, **objects_to_save): super(ExperimentHandler, self).__init__() # prepare log writers train_log_path ...
3,291
30.961165
114
py
CSD-manipulation
CSD-manipulation-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 manipulation environments (Fetch and Kitchen). The codebase is based on the implementation of [MUSIC](https://github.com/ru...
3,808
81.804348
589
md
CSD-manipulation
CSD-manipulation-master/save_weight.py
import os import pickle import subprocess import click import tensorflow as tf from baselines.her.util import save_weight @click.command() @click.option('--policy_file', type=str, default=None) @click.option('--run_group', type=str, default=None) @click.option('--epoch', type=int, default=None) def main(policy_file...
1,125
28.631579
90
py
CSD-manipulation
CSD-manipulation-master/train.py
import os import pathlib import sys import time from collections import defaultdict import click import gym import numpy as np import json from mpi4py import MPI from baselines import logger from baselines.common import set_global_seeds from baselines.common.mpi_moments import mpi_moments import baselines.her.experim...
26,726
43.031301
563
py
CSD-manipulation
CSD-manipulation-master/utils.py
from matplotlib import figure import pathlib import numpy as np from matplotlib.patches import Ellipse from baselines import logger from moviepy import editor as mpy class FigManager: def __init__(self, label, epoch, eval_dir): self.label = label self.epoch = epoch self.fig = figure.Figur...
9,494
34.297398
139
py
CSD-manipulation
CSD-manipulation-master/baselines/__init__.py
0
0
0
py
CSD-manipulation
CSD-manipulation-master/baselines/logger.py
import io import os import sys import shutil import os.path as osp import json import time import datetime import tempfile from collections import defaultdict import matplotlib.pyplot as plt import wandb from PIL import Image import numpy as np import tensorflow as tf LOG_OUTPUT_FORMATS = ['stdout', 'log', 'csv', ...
16,175
28.735294
122
py
CSD-manipulation
CSD-manipulation-master/baselines/results_plotter.py
import numpy as np import matplotlib matplotlib.use('TkAgg') # Can change to 'Agg' for non-interactive mode import matplotlib.pyplot as plt plt.rcParams['svg.fonttype'] = 'none' from baselines.bench.monitor import load_results X_TIMESTEPS = 'timesteps' X_EPISODES = 'episodes' X_WALLTIME = 'walltime_hrs' POSSIBLE_X_A...
3,080
34.413793
115
py
CSD-manipulation
CSD-manipulation-master/baselines/common/__init__.py
# flake8: noqa F403 from baselines.common.console_util import * from baselines.common.dataset import Dataset from baselines.common.math_util import * from baselines.common.misc_util import *
191
31
44
py
CSD-manipulation
CSD-manipulation-master/baselines/common/atari_wrappers.py
import numpy as np from collections import deque import gym from gym import spaces import cv2 cv2.ocl.setUseOpenCL(False) class NoopResetEnv(gym.Wrapper): def __init__(self, env, noop_max=30): """Sample initial states by taking random number of no-ops on reset. No-op is assumed to be action 0. ...
8,037
33.059322
112
py
CSD-manipulation
CSD-manipulation-master/baselines/common/cg.py
import numpy as np def cg(f_Ax, b, cg_iters=10, callback=None, verbose=False, residual_tol=1e-10): """ Demmel p 312 """ p = b.copy() r = b.copy() x = np.zeros_like(b) rdotr = r.dot(r) fmtstr = "%10i %10.3g %10.3g" titlestr = "%10s %10s %10s" if verbose: print(titlestr % ("iter...
896
25.382353
88
py
CSD-manipulation
CSD-manipulation-master/baselines/common/cmd_util.py
""" Helpers for scripts like run_atari.py. """ import os import gym from gym.wrappers import FlattenDictWrapper from baselines import logger from baselines.bench import Monitor from baselines.common import set_global_seeds from baselines.common.atari_wrappers import make_atari, wrap_deepmind from baselines.common.vec_...
2,940
32.420455
94
py
CSD-manipulation
CSD-manipulation-master/baselines/common/console_util.py
from __future__ import print_function from contextlib import contextmanager import numpy as np import time # ================================================================ # Misc # ================================================================ def fmt_row(width, row, header=False): out = " | ".join(fmt_item(x...
1,504
24.083333
104
py
CSD-manipulation
CSD-manipulation-master/baselines/common/dataset.py
import numpy as np class Dataset(object): def __init__(self, data_map, deterministic=False, shuffle=True): self.data_map = data_map self.deterministic = deterministic self.enable_shuffle = shuffle self.n = next(iter(data_map.values())).shape[0] self._next_id = 0 self...
2,132
33.967213
110
py
CSD-manipulation
CSD-manipulation-master/baselines/common/distributions.py
import tensorflow as tf import numpy as np import baselines.common.tf_util as U from baselines.a2c.utils import fc from tensorflow.python.ops import math_ops class Pd(object): """ A particular probability distribution """ def flatparam(self): raise NotImplementedError def mode(self): ...
12,186
38.312903
243
py
CSD-manipulation
CSD-manipulation-master/baselines/common/filters.py
from .running_stat import RunningStat from collections import deque import numpy as np class Filter(object): def __call__(self, x, update=True): raise NotImplementedError def reset(self): pass class IdentityFilter(Filter): def __call__(self, x, update=True): return x class Composi...
2,742
26.707071
84
py
CSD-manipulation
CSD-manipulation-master/baselines/common/math_util.py
import numpy as np import scipy.signal def discount(x, gamma): """ computes discounted sums along 0th dimension of x. inputs ------ x: ndarray gamma: float outputs ------- y: ndarray with same shape as x, satisfying y[t] = x[t] + gamma*x[t+1] + gamma^2*x[t+2] + ... + gam...
2,093
23.635294
75
py
CSD-manipulation
CSD-manipulation-master/baselines/common/misc_util.py
import gym import numpy as np import os import pickle import random import tempfile import zipfile def zipsame(*seqs): L = len(seqs[0]) assert all(len(seq) == L for seq in seqs[1:]) return zip(*seqs) def unpack(seq, sizes): """ Unpack 'seq' into a sequence of lists, with lengths specified by 'si...
7,603
28.359073
110
py
CSD-manipulation
CSD-manipulation-master/baselines/common/mpi_adam.py
from mpi4py import MPI import baselines.common.tf_util as U import tensorflow as tf import numpy as np class MpiAdam(object): def __init__(self, var_list, *, beta1=0.9, beta2=0.999, epsilon=1e-08, scale_grad_by_procs=True, comm=None): self.var_list = var_list self.beta1 = beta1 self.beta2 =...
2,882
35.493671
112
py
CSD-manipulation
CSD-manipulation-master/baselines/common/mpi_fork.py
import os, subprocess, sys def mpi_fork(n, bind_to_core=False): """Re-launches the current script with workers Returns "parent" for original parent, "child" for MPI children """ if n<=1: return "child" if os.getenv("IN_MPI") is None: env = os.environ.copy() env.update( ...
687
27.666667
66
py
CSD-manipulation
CSD-manipulation-master/baselines/common/mpi_moments.py
from mpi4py import MPI import numpy as np from baselines.common import zipsame def mpi_mean(x, axis=0, comm=None, keepdims=False): x = np.asarray(x) assert x.ndim > 0 if comm is None: comm = MPI.COMM_WORLD xsum = x.sum(axis=axis, keepdims=keepdims) n = xsum.size localsum = np.zeros(n+1, x.dtyp...
1,963
31.196721
101
py
CSD-manipulation
CSD-manipulation-master/baselines/common/mpi_running_mean_std.py
from mpi4py import MPI import tensorflow as tf, baselines.common.tf_util as U, numpy as np class RunningMeanStd(object): # https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm def __init__(self, epsilon=1e-2, shape=()): self._sum = tf.compat.v1.get_variable( ...
3,777
33.981481
126
py
CSD-manipulation
CSD-manipulation-master/baselines/common/mpi_sgd.py
from mpi4py import MPI import baselines.common.tf_util as U import tensorflow as tf import numpy as np class MpiSgd(object): def __init__(self, var_list, *, scale_grad_by_procs=True, comm=None): self.var_list = var_list self.scale_grad_by_procs = scale_grad_by_procs size = sum(U.numel(v) fo...
1,451
32.767442
75
py
CSD-manipulation
CSD-manipulation-master/baselines/common/runners.py
import numpy as np from abc import ABC, abstractmethod class AbstractEnvRunner(ABC): def __init__(self, *, env, model, nsteps): self.env = env self.model = model nenv = env.num_envs self.batch_ob_shape = (nenv*nsteps,) + env.observation_space.shape self.obs = np.zeros((nenv,...
620
31.684211
104
py
CSD-manipulation
CSD-manipulation-master/baselines/common/running_mean_std.py
import numpy as np class RunningMeanStd(object): # https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm def __init__(self, epsilon=1e-4, shape=()): self.mean = np.zeros(shape, 'float64') self.var = np.ones(shape, 'float64') self.count = epsilon def up...
1,618
33.446809
97
py
CSD-manipulation
CSD-manipulation-master/baselines/common/running_stat.py
import numpy as np # http://www.johndcook.com/blog/standard_deviation/ class RunningStat(object): def __init__(self, shape): self._n = 0 self._M = np.zeros(shape) self._S = np.zeros(shape) def push(self, x): x = np.asarray(x) assert x.shape == self._M.shape self....
1,320
27.106383
78
py
CSD-manipulation
CSD-manipulation-master/baselines/common/schedules.py
"""This file is used for specifying various schedules that evolve over time throughout the execution of the algorithm, such as: - learning rate for the optimizer - exploration epsilon for the epsilon greedy exploration strategy - beta parameter for beta parameter in prioritized replay Each schedule has a function `...
3,812
36.019417
90
py
CSD-manipulation
CSD-manipulation-master/baselines/common/segment_tree.py
import operator class SegmentTree(object): def __init__(self, capacity, operation, neutral_element): """Build a Segment Tree data structure. https://en.wikipedia.org/wiki/Segment_tree Can be used as regular array, but with two important differences: a) setting item's...
4,899
32.561644
109
py
CSD-manipulation
CSD-manipulation-master/baselines/common/tf_util.py
import numpy as np import tensorflow as tf # pylint: ignore-module import copy import os import functools import collections import multiprocessing def switch(condition, then_expression, else_expression): """Switches between two operations depending on a scalar value (int or bool). Note that both `then_expres...
11,046
38.173759
132
py
CSD-manipulation
CSD-manipulation-master/baselines/common/tests/test_schedules.py
import numpy as np from baselines.common.schedules import ConstantSchedule, PiecewiseSchedule def test_piecewise_schedule(): ps = PiecewiseSchedule([(-5, 100), (5, 200), (10, 50), (100, 50), (200, -50)], outside_value=500) assert np.isclose(ps.value(-10), 500) assert np.isclose(ps.value(0), 150) ass...
823
29.518519
101
py
CSD-manipulation
CSD-manipulation-master/baselines/common/tests/test_segment_tree.py
import numpy as np from baselines.common.segment_tree import SumSegmentTree, MinSegmentTree def test_tree_set(): tree = SumSegmentTree(4) tree[2] = 1.0 tree[3] = 3.0 assert np.isclose(tree.sum(), 4.0) assert np.isclose(tree.sum(0, 2), 0.0) assert np.isclose(tree.sum(0, 3), 1.0) assert n...
2,691
24.884615
72
py
CSD-manipulation
CSD-manipulation-master/baselines/common/tests/test_tf_util.py
# tests for tf_util import tensorflow as tf from baselines.common.tf_util import ( function, initialize, single_threaded_session ) def test_function(): with tf.Graph().as_default(): x = tf.compat.v1.placeholder(tf.int32, (), name="x") y = tf.compat.v1.placeholder(tf.int32, (), name="y"...
1,050
24.634146
65
py
CSD-manipulation
CSD-manipulation-master/baselines/common/vec_env/__init__.py
from abc import ABC, abstractmethod from baselines import logger class AlreadySteppingError(Exception): """ Raised when an asynchronous step is running while step_async() is called again. """ def __init__(self): msg = 'already running an async step' Exception.__init__(self, msg) cl...
3,378
25.606299
90
py
CSD-manipulation
CSD-manipulation-master/baselines/common/vec_env/dummy_vec_env.py
import numpy as np from gym import spaces from collections import OrderedDict from . import VecEnv class DummyVecEnv(VecEnv): def __init__(self, env_fns): self.envs = [fn() for fn in env_fns] env = self.envs[0] VecEnv.__init__(self, len(env_fns), env.observation_space, env.action_space) ...
2,294
34.307692
111
py
CSD-manipulation
CSD-manipulation-master/baselines/common/vec_env/subproc_vec_env.py
import numpy as np from multiprocessing import Process, Pipe from baselines.common.vec_env import VecEnv, CloudpickleWrapper def worker(remote, parent_remote, env_fn_wrapper): parent_remote.close() env = env_fn_wrapper.x() while True: cmd, data = remote.recv() if cmd == 'step': ...
2,864
33.107143
97
py
CSD-manipulation
CSD-manipulation-master/baselines/common/vec_env/vec_frame_stack.py
from baselines.common.vec_env import VecEnvWrapper import numpy as np from gym import spaces class VecFrameStack(VecEnvWrapper): """ Vectorized environment base class """ def __init__(self, venv, nstack): self.venv = venv self.nstack = nstack wos = venv.observation_space # wrapp...
1,319
32.846154
94
py
CSD-manipulation
CSD-manipulation-master/baselines/common/vec_env/vec_normalize.py
from baselines.common.vec_env import VecEnvWrapper from baselines.common.running_mean_std import RunningMeanStd import numpy as np class VecNormalize(VecEnvWrapper): """ Vectorized environment base class """ def __init__(self, venv, ob=True, ret=True, clipob=10., cliprew=10., gamma=0.99, epsilon=1e-8):...
1,679
34
120
py
CSD-manipulation
CSD-manipulation-master/baselines/her/__init__.py
0
0
0
py
CSD-manipulation
CSD-manipulation-master/baselines/her/actor_critic.py
import tensorflow as tf from baselines.her.util import store_args, nn import numpy as np EPS = 1e-8 LOG_STD_MAX = 2 LOG_STD_MIN = -5 def gaussian_likelihood(x, mu, log_std): pre_sum = -0.5 * (((x-mu)/(tf.exp(log_std)+EPS))**2 + 2*log_std + np.log(2*np.pi)) return tf.reduce_sum(input_tensor=pre_sum, axis=1) d...
3,727
39.967033
114
py
CSD-manipulation
CSD-manipulation-master/baselines/her/ddpg.py
from collections import OrderedDict, defaultdict import numpy as np import tensorflow as tf # from tensorflow.contrib.staging import StagingArea from tensorflow.python.ops.data_flow_ops import StagingArea from baselines import logger from baselines.her.util import ( import_function, store_args, flatten_grads, trans...
25,444
45.860037
180
py
CSD-manipulation
CSD-manipulation-master/baselines/her/discriminator.py
import tensorflow as tf from baselines.her.normalizer import Normalizer from baselines.her.util import store_args, nn, snn import numpy as np class Discriminator: @store_args def __init__(self, inputs_tf, dimo, dimz, dimg, dimu, max_u, o_stats, g_stats, hidden, layers, env_name, **kwargs): """The dis...
5,880
60.260417
186
py
CSD-manipulation
CSD-manipulation-master/baselines/her/her.py
import numpy as np import random from baselines.common.schedules import PiecewiseSchedule from scipy.stats import rankdata def make_sample_her_transitions(replay_strategy, replay_k, reward_fun, et_w_schedule): if (replay_strategy == 'future') or (replay_strategy == 'final'): future_p = 1 - (1. / (1 + rep...
3,679
38.569892
99
py
CSD-manipulation
CSD-manipulation-master/baselines/her/normalizer.py
import threading import numpy as np from mpi4py import MPI import tensorflow as tf from baselines.her.util import reshape_for_broadcasting class Normalizer: def __init__(self, size, eps=1e-2, default_clip_range=np.inf, sess=None): """A normalizer that ensures that observations are approximately distribu...
5,600
37.895833
103
py
CSD-manipulation
CSD-manipulation-master/baselines/her/replay_buffer.py
import threading import numpy as np class ReplayBuffer: def __init__(self, buffer_shapes, size_in_transitions, T, sample_transitions): """Creates a replay buffer. Args: buffer_shapes (dict of ints): the shape for all buffers that are used in the replay buffer ...
3,789
33.770642
95
py
CSD-manipulation
CSD-manipulation-master/baselines/her/rollout.py
from collections import deque import numpy as np import pickle from mujoco_py import MujocoException from baselines.her.util import convert_episode_to_batch_major, store_args class RolloutWorker: @store_args def __init__(self, make_env, policy, dims, logger, T, rollout_batch_size=1, exploit...
11,198
41.744275
131
py
CSD-manipulation
CSD-manipulation-master/baselines/her/util.py
import os import subprocess import sys import importlib import inspect import functools import tensorflow as tf import numpy as np from baselines.common import tf_util as U import platform import json import math def store_args(method): """Stores provided method args as instance attributes. """ argspec ...
9,069
31.743682
202
py
CSD-manipulation
CSD-manipulation-master/baselines/her/experiment/__init__.py
0
0
0
py
CSD-manipulation
CSD-manipulation-master/baselines/her/experiment/config.py
from copy import deepcopy import numpy as np import json import os import gym from baselines import logger from baselines.her.ddpg import DDPG from baselines.her.her import make_sample_her_transitions DEFAULT_ENV_PARAMS = { 'FetchReach-v0': { 'n_cycles': 10, }, } DEFAULT_PARAMS = { # env 'm...
9,452
36.511905
121
py
CSD-manipulation
CSD-manipulation-master/baselines/her/experiment/play.py
import click import numpy as np import pickle from baselines import logger from baselines.common import set_global_seeds import baselines.her.experiment.config as config from baselines.her.rollout import RolloutWorker from baselines.her.util import save_video import os import json @click.command() @click.argument('p...
3,754
35.456311
120
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/__init__.py
import collections import os import sys import numpy as np import d4rl_alt.locomotion #import d4rl_alt.hand_manipulation_suite import d4rl_alt.pointmaze import d4rl_alt.gym_minigrid import d4rl_alt.gym_mujoco from d4rl_alt.offline_env import get_keys, set_dataset_path SUPPRESS_MESSAGES = bool(os.environ.get("D4RL_SU...
5,046
30.154321
132
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/infos.py
""" This file holds all URLs and reference scores. """ # TODO(Justin): This is duplicated. Make all __init__ file URLs and scores point to this file. DATASET_URLS = { "maze2d-open-v0": "http://rail.eecs.berkeley.edu/datasets/offline_rl/maze2d/maze2d-open-sparse.hdf5", "maze2d-umaze-v1": "http://rail.eecs.berk...
11,967
64.043478
168
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/offline_env.py
import os import urllib.request import gym import h5py def set_dataset_path(path): global DATASET_PATH DATASET_PATH = path os.makedirs(path, exist_ok=True) set_dataset_path( os.environ.get("D4RL_DATASET_DIR", os.path.expanduser("~/.d4rl_alt/datasets")) ) def get_keys(h5file): keys = [] d...
5,386
32.880503
89
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/ope.py
""" Metrics for off-policy evaluation. """ import numpy as np from d4rl_alt import infos UNDISCOUNTED_POLICY_RETURNS = { "halfcheetah-medium": 3985.8150261686337, "halfcheetah-random": -199.26067391425954, "halfcheetah-expert": 12330.945945279545, "hopper-medium": 2260.1983114487352, "hopper-rando...
4,393
28.891156
85
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/carla/__init__.py
from gym.envs.registration import register from .carla_env import CarlaObsDictEnv, CarlaObsEnv register( id="carla-lane-v0", entry_point="d4rl_alt.carla:CarlaObsEnv", max_episode_steps=250, kwargs={ "ref_min_score": -0.8503839912088142, "ref_max_score": 1023.5784385429523, "dat...
3,546
27.376
113
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/carla/carla_env.py
import argparse import datetime import glob import os import random import sys import time import gym import gym.spaces as spaces from gym import Env from PIL import Image from PIL.PngImagePlugin import PngInfo # from . import proxy_env from d4rl_alt.offline_env import OfflineEnv try: sys.path.append( gl...
50,962
36.064
152
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/carla/data_collection_agent_lane.py
# !/usr/bin/env python # Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB). # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. # # Modified by Rowan McAllister on 20 April 2020 import argparse import dat...
17,418
32.757752
138
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/carla/data_collection_town.py
#!/usr/bin/env python # Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB). # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. # # Modified by Rowan McAllister on 20 April 2020 import argparse import date...
48,118
36.859166
152
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/carla/town_agent.py
# A baseline town agent. import numpy as np from agents.navigation.agent import Agent, AgentState from agents.navigation.local_planner import LocalPlanner class RoamingAgent(Agent): """ RoamingAgent implements a basic agent that navigates scenes making random choices when facing an intersection. This...
5,410
34.136364
97
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/flow/__init__.py
import os from copy import deepcopy import flow import flow.envs import gym from flow.controllers import ( RLController, SimCarFollowingController, SimLaneChangeController, ) from flow.controllers.car_following_models import IDMController from flow.controllers.routing_controllers import ContinuousRouter fr...
6,530
27.030043
106
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/flow/bottleneck.py
import flow import flow.envs from flow.controllers import ( RLController, SimCarFollowingController, SimLaneChangeController, ) from flow.controllers.routing_controllers import ContinuousRouter from flow.core.params import ( EnvParams, InFlows, InitialConfig, NetParams, SumoCarFollowingP...
4,745
29.037975
83
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/flow/merge.py
"""Open merge example. Trains a a small percentage of rl vehicles to dissipate shockwaves caused by on-ramp merge to a single lane open highway network. """ from copy import deepcopy from flow.controllers import RLController, SimCarFollowingController from flow.core.params import ( EnvParams, InFlows, Init...
3,824
30.352459
81
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/flow/traffic_light_grid.py
"""Traffic Light Grid example.""" from flow.controllers import GridRouter, SimCarFollowingController from flow.core.params import ( EnvParams, InFlows, InitialConfig, NetParams, SumoCarFollowingParams, SumoParams, VehicleParams, ) from flow.envs import TrafficLightGridBenchmarkEnv from flow....
4,593
34.338462
82
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/gym_minigrid/__init__.py
from gym.envs.registration import register register( id="minigrid-fourrooms-v0", entry_point="d4rl_alt.gym_minigrid.envs.fourrooms:FourRoomsEnv", max_episode_steps=50, kwargs={ "ref_min_score": 0.01442, "ref_max_score": 2.89685, "dataset_url": "http://rail.eecs.berkeley.edu/data...
723
29.166667
111
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/gym_minigrid/fourroom_controller.py
import random import numpy as np from d4rl_alt.pointmaze import q_iteration from d4rl_alt.pointmaze.gridcraft import grid_env, grid_spec MAZE = ( "###################\\" + "#OOOOOOOO#OOOOOOOO#\\" + "#OOOOOOOO#OOOOOOOO#\\" + "#OOOOOOOOOOOOOOOOO#\\" + "#OOOOOOOO#OOOOOOOO#\\" + "#OOOOOOOO#OOOOOO...
2,417
25.571429
88
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/gym_minigrid/minigrid.py
import math from enum import IntEnum import gym import numpy as np from gym import error, spaces, utils from gym.utils import seeding from d4rl_alt import offline_env from d4rl_alt.gym_minigrid.rendering import * # Size in pixels of a tile in the full-scale human view TILE_PIXELS = 32 # Map of color names to RGB va...
36,217
27.540583
112
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/gym_minigrid/register.py
from gym.envs.registration import register as gym_register env_list = [] def register(id, entry_point, reward_threshold=0.95): assert id.startswith("MiniGrid-") assert id not in env_list # Register the environment with OpenAI gym gym_register(id=id, entry_point=entry_point, reward_threshold=reward_t...
392
25.2
83
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/gym_minigrid/rendering.py
import math import numpy as np def downsample(img, factor): """ Downsample an image along both dimensions by some factor """ assert img.shape[0] % factor == 0 assert img.shape[1] % factor == 0 img = img.reshape( [img.shape[0] // factor, factor, img.shape[1] // factor, factor, 3] ...
2,923
21.151515
75
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/gym_minigrid/roomgrid.py
from d4rl_alt.gym_minigrid.minigrid import * def reject_next_to(env, pos): """ Function to filter out object positions that are right next to the agent's starting point """ sx, sy = env.agent_pos x, y = pos d = abs(sx - x) + abs(sy - y) return d < 2 class Room: def __init__(self...
11,471
28.720207
83
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/gym_minigrid/window.py
import sys import numpy as np # Only ask users to install matplotlib if they actually need it try: import matplotlib.pyplot as plt except: print("To display the environment in a window, please install matplotlib, eg:") print("pip3 install --user matplotlib") sys.exit(-1) class Window: """ Wi...
2,251
23.215054
83
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/gym_minigrid/wrappers.py
import math import operator from functools import reduce import gym import numpy as np from gym import error, spaces, utils from d4rl_alt.gym_minigrid.minigrid import COLOR_TO_IDX, OBJECT_TO_IDX, STATE_TO_IDX class ReseedWrapper(gym.core.Wrapper): """ Wrapper to always regenerate an environment with the sam...
9,067
27.515723
88
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/gym_minigrid/envs/__init__.py
from d4rl_alt.gym_minigrid.envs.empty import * from d4rl_alt.gym_minigrid.envs.fourrooms import *
98
32
50
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/gym_minigrid/envs/empty.py
from d4rl_alt.gym_minigrid.minigrid import * from d4rl_alt.gym_minigrid.register import register class EmptyEnv(MiniGridEnv): """ Empty grid environment, no obstacles, sparse reward """ def __init__( self, size=8, agent_start_pos=(1, 1), agent_start_dir=0, ): ...
2,220
24.825581
88
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/gym_minigrid/envs/fourrooms.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from d4rl_alt.gym_minigrid.minigrid import * from d4rl_alt.gym_minigrid.register import register class FourRoomsEnv(MiniGridEnv): """ Classic 4 rooms gridworld environment. Can specify agent and goal position, if not it set at random. """ def __init_...
2,581
30.487805
84
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/gym_mujoco/__init__.py
from gym.envs.registration import register from d4rl_alt.gym_mujoco import gym_envs HOPPER_RANDOM_SCORE = -20.272305 HALFCHEETAH_RANDOM_SCORE = -280.178953 WALKER_RANDOM_SCORE = 1.629008 ANT_RANDOM_SCORE = -325.6 HOPPER_EXPERT_SCORE = 3234.3 HALFCHEETAH_EXPERT_SCORE = 12135.0 WALKER_EXPERT_SCORE = 4592.3 ANT_EXPERT_...
7,873
30.75
117
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/gym_mujoco/gym_envs.py
from gym.envs.mujoco import AntEnv, HalfCheetahEnv, HopperEnv, Walker2dEnv from .. import offline_env from .wrappers import NormalizedBoxEnv class OfflineAntEnv(AntEnv, offline_env.OfflineEnv): def __init__(self, **kwargs): AntEnv.__init__( self, ) offline_env.OfflineEnv.__ini...
1,412
23.362069
74
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/gym_mujoco/wrappers.py
import itertools from collections import deque import numpy as np from gym import Env from gym.spaces import Box, Discrete class ProxyEnv(Env): def __init__(self, wrapped_env): self._wrapped_env = wrapped_env self.action_space = self._wrapped_env.action_space self.observation_space = self...
5,512
31.052326
83
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/hand_manipulation_suite/__init__.py
from gym.envs.registration import register from mjrl.envs.mujoco_env import MujocoEnv from d4rl_alt.hand_manipulation_suite.door_v0 import DoorEnvV0 from d4rl_alt.hand_manipulation_suite.hammer_v0 import HammerEnvV0 from d4rl_alt.hand_manipulation_suite.pen_v0 import PenEnvV0 from d4rl_alt.hand_manipulation_suite.relo...
5,515
29.307692
120
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/hand_manipulation_suite/door_v0.py
import os import numpy as np from gym import spaces, utils from mjrl.envs import mujoco_env from mujoco_py import MjViewer from d4rl_alt import offline_env ADD_BONUS_REWARDS = True class DoorEnvV0(mujoco_env.MujocoEnv, utils.EzPickle, offline_env.OfflineEnv): def __init__(self, **kwargs): offline_env.O...
5,895
31.938547
88
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/hand_manipulation_suite/hammer_v0.py
import os import numpy as np from gym import spaces, utils from mjrl.envs import mujoco_env from mujoco_py import MjViewer from d4rl_alt import offline_env from d4rl_alt.utils.quatmath import quat2euler ADD_BONUS_REWARDS = True class HammerEnvV0(mujoco_env.MujocoEnv, utils.EzPickle, offline_env.OfflineEnv): de...
6,437
35.168539
88
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/hand_manipulation_suite/pen_v0.py
import os import numpy as np from gym import spaces, utils from mjrl.envs import mujoco_env from mujoco_py import MjViewer from d4rl_alt import offline_env from d4rl_alt.utils.quatmath import euler2quat, quat2euler ADD_BONUS_REWARDS = True class PenEnvV0(mujoco_env.MujocoEnv, utils.EzPickle, offline_env.OfflineEnv...
7,119
34.6
88
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/hand_manipulation_suite/relocate_v0.py
import os import numpy as np from gym import spaces, utils from mjrl.envs import mujoco_env from mujoco_py import MjViewer from d4rl_alt import offline_env ADD_BONUS_REWARDS = True class RelocateEnvV0(mujoco_env.MujocoEnv, utils.EzPickle, offline_env.OfflineEnv): def __init__(self, **kwargs): offline_e...
6,435
34.955307
88
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/hand_manipulation_suite/Adroit/README.md
# Adroit Manipulation Platform Adroit manipulation platform is reconfigurable, tendon-driven, pneumatically-actuated platform designed and developed by [Vikash Kumar](https://vikashplus.github.io/) during this Ph.D. ([Thesis: Manipulators and Manipulation in high dimensional spaces](https://digital.lib.washington.edu/...
2,461
81.066667
1,216
md
CSD-manipulation
CSD-manipulation-master/d4rl_alt/kitchen/__init__.py
from gym.envs.registration import register from .kitchen_envs import ( KitchenHingeSlideBottomLeftBurnerLightV0, KitchenMicrowaveKettleLightTopLeftBurnerV0, ) # Smaller dataset with only positive demonstrations. register( id="kitchen-complete-v0", entry_point="d4rl_alt.kitchen:KitchenMicrowaveKettleLi...
1,562
32.978261
135
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/kitchen/env_dict.py
from d4rl_alt.kitchen.kitchen_envs import ( KitchenHingeCabinetV0, KitchenHingeSlideBottomLeftBurnerLightV0, KitchenKettleV0, KitchenLightSwitchV0, KitchenMicrowaveKettleLightTopLeftBurnerV0, KitchenMicrowaveV0, KitchenSlideCabinetV0, KitchenTopLeftBurnerV...
774
34.227273
88
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/kitchen/kitchen_envs.py
"""Environments using kitchen and Franka robot.""" import copy import gym import numpy as np from gym import spaces from gym.spaces.box import Box from d4rl_alt.kitchen.adept_envs.franka.kitchen_multitask_v0 import KitchenTaskRelaxV1 OBS_ELEMENT_INDICES = { "bottom left burner": np.array([11, 12]), "top left...
23,478
32.162429
93
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/kitchen/run_kitchen.py
import gym import d4rl_alt import cv2 from envs.d4rl_envs import KitchenEnv #from d4rl_alt.kitchen.kitchen_envs import KitchenMicrowaveV0 import imageio env = KitchenEnv() env.reset() done = False imgs = [] for i in range(150): o, r, d, i = env.step(env.action_space.sample()) print("microwave", i["microwave di...
522
22.772727
61
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/kitchen/adept_envs/__init__.py
#!/usr/bin/python # # Copyright 2020 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 ag...
711
36.473684
74
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/kitchen/adept_envs/base_robot.py
#!/usr/bin/python # # Copyright 2020 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 ag...
4,458
28.143791
83
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/kitchen/adept_envs/mujoco_env.py
"""Base environment for MuJoCo-based environments.""" #!/usr/bin/python # # Copyright 2020 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/...
7,542
32.977477
87
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/kitchen/adept_envs/robot_env.py
"""Base class for robotics environments.""" #!/usr/bin/python # # Copyright 2020 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....
5,622
30.589888
85
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/kitchen/adept_envs/franka/__init__.py
#!/usr/bin/python # # Copyright 2020 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 ag...
801
31.08
76
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/kitchen/adept_envs/franka/kitchen_multitask_v0.py
""" Kitchen environment for long horizon manipulation """ #!/usr/bin/python # # Copyright 2020 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/licens...
32,746
33.325996
100
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/kitchen/adept_envs/franka/robot/__init__.py
0
0
0
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/kitchen/adept_envs/franka/robot/franka_robot.py
#!/usr/bin/python # # Copyright 2020 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 ag...
12,704
33.808219
109
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/kitchen/adept_envs/simulation/__init__.py
0
0
0
py
CSD-manipulation
CSD-manipulation-master/d4rl_alt/kitchen/adept_envs/simulation/module.py
#!/usr/bin/python # # Copyright 2020 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 ag...
3,644
25.605839
80
py