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 |
|---|---|---|---|---|---|---|
null | mtenv-main/examples/mtenv_bandit.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import numpy as np
from gym import spaces
from mtenv import MTEnv
from mtenv.utils.types import ActionType, ObsType, StepReturnType, TaskStateType
class MTBanditEnv(MTEnv):
def __init__(self, n_arms: int):
super().__init__(
... | 2,186 | 29.802817 | 94 | py |
null | mtenv-main/examples/wrapped_bandit.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import List, Optional
from gym import spaces
from examples.bandit import BanditEnv # type: ignore[import]
from mtenv.utils import seeding
from mtenv.utils.types import TaskObsType, TaskStateType
from mtenv.wrappers.env_to_mtenv import... | 2,051 | 32.096774 | 90 | py |
null | mtenv-main/local_dm_control_suite/README.md | # DeepMind Control Suite.
This submodule contains the domains and tasks described in the
[DeepMind Control Suite tech report](https://arxiv.org/abs/1801.00690).
## Quickstart
```python
from dm_control import suite
import numpy as np
# Load one task:
env = suite.load(domain_name="cartpole", task_name="swingup")
# I... | 1,910 | 32.526316 | 140 | md |
null | mtenv-main/local_dm_control_suite/__init__.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 4,853 | 27.892857 | 86 | py |
null | mtenv-main/local_dm_control_suite/acrobot.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 4,670 | 34.386364 | 85 | py |
null | mtenv-main/local_dm_control_suite/ball_in_cup.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 3,550 | 32.819048 | 80 | py |
null | mtenv-main/local_dm_control_suite/base.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 4,139 | 35.637168 | 84 | py |
null | mtenv-main/local_dm_control_suite/cartpole.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 9,502 | 36.561265 | 85 | py |
null | mtenv-main/local_dm_control_suite/cheetah.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 3,505 | 32.075472 | 80 | py |
null | mtenv-main/local_dm_control_suite/explore.py | # Copyright 2018 The dm_control Authors.
#
# 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 i... | 3,023 | 30.5 | 84 | py |
null | mtenv-main/local_dm_control_suite/finger.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 8,498 | 33.975309 | 86 | py |
null | mtenv-main/local_dm_control_suite/fish.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 6,657 | 34.227513 | 84 | py |
null | mtenv-main/local_dm_control_suite/hopper.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 5,194 | 34.101351 | 87 | py |
null | mtenv-main/local_dm_control_suite/humanoid.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 8,547 | 34.915966 | 85 | py |
null | mtenv-main/local_dm_control_suite/humanoid_CMU.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 7,074 | 35.096939 | 85 | py |
null | mtenv-main/local_dm_control_suite/lqr.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 10,082 | 36.069853 | 87 | py |
null | mtenv-main/local_dm_control_suite/lqr_solver.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 4,910 | 32.408163 | 94 | py |
null | mtenv-main/local_dm_control_suite/manipulator.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 12,051 | 35.521212 | 88 | py |
null | mtenv-main/local_dm_control_suite/pendulum.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 3,748 | 31.6 | 83 | py |
null | mtenv-main/local_dm_control_suite/point_mass.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 5,007 | 36.096296 | 88 | py |
null | mtenv-main/local_dm_control_suite/quadruped.py | # Copyright 2019 The dm_control Authors.
#
# 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 i... | 19,110 | 36.108738 | 87 | py |
null | mtenv-main/local_dm_control_suite/reacher.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 4,543 | 36.553719 | 83 | py |
null | mtenv-main/local_dm_control_suite/stacker.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 8,131 | 35.142222 | 87 | py |
null | mtenv-main/local_dm_control_suite/swimmer.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 8,432 | 36.314159 | 88 | py |
null | mtenv-main/local_dm_control_suite/walker.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 6,162 | 31.267016 | 83 | py |
null | mtenv-main/local_dm_control_suite/common/__init__.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 1,387 | 32.047619 | 78 | py |
null | mtenv-main/local_dm_control_suite/demos/mocap_demo.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 2,633 | 28.266667 | 86 | py |
null | mtenv-main/local_dm_control_suite/tests/domains_test.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 12,919 | 39.375 | 88 | py |
null | mtenv-main/local_dm_control_suite/tests/loader_test.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 1,640 | 30.557692 | 79 | py |
null | mtenv-main/local_dm_control_suite/tests/lqr_test.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 3,097 | 34.204545 | 87 | py |
null | mtenv-main/local_dm_control_suite/utils/__init__.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 718 | 41.294118 | 78 | py |
null | mtenv-main/local_dm_control_suite/utils/parse_amc.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 8,977 | 28.728477 | 83 | py |
null | mtenv-main/local_dm_control_suite/utils/parse_amc_test.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 2,358 | 33.188406 | 79 | py |
null | mtenv-main/local_dm_control_suite/utils/randomizers.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 3,330 | 35.604396 | 82 | py |
null | mtenv-main/local_dm_control_suite/utils/randomizers_test.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 6,331 | 34.573034 | 83 | py |
null | mtenv-main/local_dm_control_suite/wrappers/__init__.py | # Copyright 2018 The dm_control Authors.
#
# 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 i... | 742 | 42.705882 | 78 | py |
null | mtenv-main/local_dm_control_suite/wrappers/action_noise.py | # Copyright 2018 The dm_control Authors.
#
# 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 i... | 2,891 | 36.076923 | 84 | py |
null | mtenv-main/local_dm_control_suite/wrappers/action_noise_test.py | # Copyright 2018 The dm_control Authors.
#
# 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 i... | 5,875 | 39.805556 | 86 | py |
null | mtenv-main/local_dm_control_suite/wrappers/pixels.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 4,704 | 36.943548 | 85 | py |
null | mtenv-main/local_dm_control_suite/wrappers/pixels_test.py | # Copyright 2017 The dm_control Authors.
#
# 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 i... | 4,549 | 32.455882 | 84 | py |
null | mtenv-main/mtenv/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
__version__ = "1.0"
from mtenv.core import MTEnv # noqa: F401
from mtenv.envs.registration import make # noqa: F401
__all__ = ["MTEnv", "make"]
| 219 | 26.5 | 70 | py |
null | mtenv-main/mtenv/core.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""Core API of MultiTask Environments for Reinforcement Learning."""
from abc import ABC, abstractmethod
from typing import List, Optional
from gym.core import Env
from gym.spaces.dict import Dict as DictSpace
from gym.spaces.space import Space
fro... | 7,251 | 33.046948 | 89 | py |
null | mtenv-main/mtenv/envs/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from copy import deepcopy
from mtenv.envs.registration import register
# Control Task
# ----------------------------------------
register(
id="MT-CartPole-v0",
entry_point="mtenv.envs.control.cartpole:MTCartPole",
test_kwargs={
... | 3,190 | 24.528 | 112 | py |
null | mtenv-main/mtenv/envs/registration.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
from typing import Any, Dict, Optional
from gym import error
from gym.core import Env
from gym.envs.registration import EnvRegistry, EnvSpec
class MultitaskEnvSpec(EnvSpec): # type: ignore[misc]
def __init__(
self,
id: st... | 2,823 | 31.45977 | 74 | py |
null | mtenv-main/mtenv/envs/control/README.md | 1 | 0 | 0 | md | |
null | mtenv-main/mtenv/envs/control/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from mtenv.envs.control.cartpole import CartPole, MTCartPole # noqa: F401
| 146 | 48 | 74 | py |
null | mtenv-main/mtenv/envs/control/acrobot.py | # Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.
import numpy as np
from gym import spaces
from numpy import cos, pi, sin
from mtenv import MTEnv
from mtenv.utils import seeding
__copyright__... | 10,088 | 29.480363 | 122 | py |
null | mtenv-main/mtenv/envs/control/cartpole.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import math
import numpy as np
from gym import logger, spaces
from mtenv import MTEnv
from mtenv.utils import seeding
"""
Classic cart-pole system implemented based on Rich Sutton et al.
Copied from http://incompleteideas.net/sutton/book/code/po... | 6,710 | 32.059113 | 218 | py |
null | mtenv-main/mtenv/envs/control/setup.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from pathlib import Path
import setuptools
from mtenv.utils.setup_utils import parse_dependency
env_name = "control"
path = Path(__file__).parent / "requirements.txt"
requirements = parse_dependency(path)
with (Path(__file__).parent / "README.md... | 812 | 27.034483 | 70 | py |
null | mtenv-main/mtenv/envs/hipbmdp/README.md | 0 | 0 | 0 | md | |
null | mtenv-main/mtenv/envs/hipbmdp/__init__.py | 0 | 0 | 0 | py | |
null | mtenv-main/mtenv/envs/hipbmdp/dmc_env.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import Any, Dict
import gym
from gym.core import Env
from gym.envs.registration import register
from mtenv.envs.hipbmdp.wrappers import framestack, sticky_observation
def _build_env(
domain_name: str,
task_name: str,
seed... | 3,821 | 31.948276 | 83 | py |
null | mtenv-main/mtenv/envs/hipbmdp/env.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import Any, Callable, Dict, List
from gym.core import Env
from mtenv import MTEnv
from mtenv.envs.hipbmdp import dmc_env
from mtenv.envs.shared.wrappers.multienv import MultiEnvWrapper
EnvBuilderType = Callable[[], Env]
TaskStateType ... | 2,727 | 32.268293 | 84 | py |
null | mtenv-main/mtenv/envs/hipbmdp/setup.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from pathlib import Path
import setuptools
from mtenv.utils.setup_utils import parse_dependency
env_name = "hipbmdp"
path = Path(__file__).parent / "requirements.txt"
requirements = parse_dependency(path)
with (Path(__file__).parent / "README.m... | 764 | 25.37931 | 70 | py |
null | mtenv-main/mtenv/envs/hipbmdp/wrappers/__init__.py | 0 | 0 | 0 | py | |
null | mtenv-main/mtenv/envs/hipbmdp/wrappers/dmc_wrapper.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import Any, Dict, Optional
import dmc2gym
import numpy as np
from dmc2gym.wrappers import DMCWrapper as BaseDMCWrapper
from gym import spaces
import local_dm_control_suite as local_dmc_suite
class DMCWrapper(BaseDMCWrapper):
def... | 2,634 | 31.530864 | 85 | py |
null | mtenv-main/mtenv/envs/hipbmdp/wrappers/framestack.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""Wrapper to stack observations for single task environments."""
from collections import deque
import gym
import numpy as np
from mtenv.utils.types import ActionType, EnvStepReturnType
class FrameStack(gym.Wrapper): # type: ignore[misc]
#... | 1,554 | 31.395833 | 74 | py |
null | mtenv-main/mtenv/envs/hipbmdp/wrappers/sticky_observation.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""Wrapper to enable sitcky observations for single task environments."""
# type: ignore
import random
from collections import deque
import gym
class StickyObservation(gym.Wrapper):
def __init__(self, env: gym.Env, sticky_probability: float, ... | 2,110 | 36.035088 | 91 | py |
null | mtenv-main/mtenv/envs/metaworld/README.md | 0 | 0 | 0 | md | |
null | mtenv-main/mtenv/envs/metaworld/__init__.py | 0 | 0 | 0 | py | |
null | mtenv-main/mtenv/envs/metaworld/env.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import random
from typing import Any, Callable, Dict, List, Optional, Tuple
import metaworld
from gym import Env
from mtenv import MTEnv
from mtenv.envs.metaworld.wrappers.normalized_env import ( # type: ignore[attr-defined]
NormalizedEnvWrap... | 7,359 | 36.171717 | 100 | py |
null | mtenv-main/mtenv/envs/metaworld/setup.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from pathlib import Path
import setuptools
from mtenv.utils.setup_utils import parse_dependency
env_name = "metaworld"
path = Path(__file__).parent / "requirements.txt"
requirements = parse_dependency(path)
with (Path(__file__).parent / "README... | 766 | 25.448276 | 70 | py |
null | mtenv-main/mtenv/envs/metaworld/wrappers/__init__.py | 0 | 0 | 0 | py | |
null | mtenv-main/mtenv/envs/metaworld/wrappers/normalized_env.py | # This code is taken from: https://raw.githubusercontent.com/rlworkgroup/garage/af57bf9c6b10cd733cb0fa9bfe3abd0ba239fd6e/src/garage/envs/normalized_env.py
#
# """"An environment wrapper that normalizes action, observation and reward."""
# type: ignore
import gym
import gym.spaces
import gym.spaces.utils
import numpy as... | 5,977 | 34.164706 | 154 | py |
null | mtenv-main/mtenv/envs/mpte/README.md | 0 | 0 | 0 | md | |
null | mtenv-main/mtenv/envs/mpte/__init__.py | 0 | 0 | 0 | py | |
null | mtenv-main/mtenv/envs/mpte/setup.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from pathlib import Path
import setuptools
from mtenv.utils.setup_utils import parse_dependency
env_name = "mpte"
path = Path(__file__).parent / "requirements.txt"
requirements = parse_dependency(path)
with (Path(__file__).parent / "README.md").... | 737 | 25.357143 | 70 | py |
null | mtenv-main/mtenv/envs/mpte/two_goal_maze_env.py | # Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.
import copy
import math
from typing import Any, Dict, List, Optional, Tuple, Union
import numpy as np
from gym import spaces
from gym.spaces.box... | 11,245 | 31.69186 | 122 | py |
null | mtenv-main/mtenv/envs/shared/__init__.py | 0 | 0 | 0 | py | |
null | mtenv-main/mtenv/envs/shared/wrappers/__init__.py | 0 | 0 | 0 | py | |
null | mtenv-main/mtenv/envs/shared/wrappers/multienv.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""Wrapper to (lazily) construct a multitask environment from a list of
constructors (list of functions to construct the environments)."""
from typing import Callable, List, Optional
from gym.core import Env
from gym.spaces.discrete import Dis... | 3,850 | 37.89899 | 94 | py |
null | mtenv-main/mtenv/envs/tabular_mdp/__init__.py | 0 | 0 | 0 | py | |
null | mtenv-main/mtenv/envs/tabular_mdp/setup.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from pathlib import Path
import setuptools
from mtenv.utils.setup_utils import parse_dependency
env_name = "tabular_mdp"
path = Path(__file__).parent / "requirements.txt"
requirements = parse_dependency(path)
setuptools.setup(
name=env_name... | 726 | 25.925926 | 70 | py |
null | mtenv-main/mtenv/envs/tabular_mdp/tmdp.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import scipy.special
from gym import spaces
from gym.utils import seeding
from mtenv import MTEnv
clas... | 3,884 | 30.844262 | 155 | py |
null | mtenv-main/mtenv/utils/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
| 71 | 35 | 70 | py |
null | mtenv-main/mtenv/utils/seeding.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import Optional, Tuple
from gym.utils import seeding
from numpy.random import RandomState
def np_random(seed: Optional[int]) -> Tuple[RandomState, int]:
"""Set the seed for numpy's random generator.
Args:
seed (Option... | 521 | 25.1 | 74 | py |
null | mtenv-main/mtenv/utils/setup_utils.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from pathlib import Path
from typing import List
def parse_dependency(filepath: Path) -> List[str]:
"""Parse python dependencies from a file.
The list of dependencies is used by `setup.py` files. Lines starting
with "#" are ingored (u... | 877 | 27.322581 | 72 | py |
null | mtenv-main/mtenv/utils/types.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import Any, Dict, Tuple, Union
import numpy as np
TaskObsType = Union[str, int, float, np.ndarray]
ActionType = Union[str, int, float, np.ndarray]
EnvObsType = Union[np.ndarray]
ObsType = Dict[str, Union[EnvObsType, TaskObsType]]
Rewar... | 530 | 32.1875 | 70 | py |
null | mtenv-main/mtenv/wrappers/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from mtenv.wrappers.ntasks import NTasks # noqa: F401
from mtenv.wrappers.ntasks_id import NTasksId # noqa: F401
from mtenv.wrappers.sample_random_task import SampleRandomTask # noqa: F401
| 263 | 51.8 | 76 | py |
null | mtenv-main/mtenv/wrappers/env_to_mtenv.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""Wrapper to convert an environment into multitask environment."""
from typing import Any, Dict, List, Optional
from gym.core import Env
from gym.spaces.space import Space
from mtenv import MTEnv
from mtenv.utils import seeding
from mtenv.utils.t... | 3,253 | 28.581818 | 78 | py |
null | mtenv-main/mtenv/wrappers/multitask.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""Wrapper to change the behaviour of an existing multitask environment."""
from typing import List, Optional
from numpy.random import RandomState
from mtenv import MTEnv
from mtenv.utils import seeding
from mtenv.utils.types import (
ActionT... | 2,261 | 31.314286 | 81 | py |
null | mtenv-main/mtenv/wrappers/ntasks.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""Wrapper to fix the number of tasks in an existing multitask environment."""
from typing import List
from mtenv import MTEnv
from mtenv.utils.types import TaskStateType
from mtenv.wrappers.multitask import MultiTask
class NTasks(MultiTask):
... | 2,223 | 36.694915 | 94 | py |
null | mtenv-main/mtenv/wrappers/ntasks_id.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""Wrapper to fix the number of tasks in an existing multitask environment
and return the id of the task as part of the observation."""
from gym.spaces import Dict as DictSpace
from gym.spaces import Discrete
from mtenv import MTEnv
from mtenv.uti... | 2,410 | 34.455882 | 94 | py |
null | mtenv-main/mtenv/wrappers/sample_random_task.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""Wrapper that samples a new task everytime the environment is reset."""
from mtenv import MTEnv
from mtenv.utils.types import ObsType
from mtenv.wrappers.multitask import MultiTask
class SampleRandomTask(MultiTask):
def __init__(self, env: ... | 639 | 26.826087 | 73 | py |
null | mtenv-main/tests/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
| 71 | 35 | 70 | py |
null | mtenv-main/tests/envs/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
| 71 | 35 | 70 | py |
null | mtenv-main/tests/envs/registered_env_test.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import os
from copy import deepcopy
from pathlib import Path
from typing import Any, Dict, List, Tuple
import pytest
from mtenv import make
from mtenv.envs.registration import MultitaskEnvSpec, mtenv_registry
from tests.utils.utils import validat... | 2,599 | 33.666667 | 88 | py |
null | mtenv-main/tests/examples/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
| 71 | 35 | 70 | py |
null | mtenv-main/tests/examples/bandit_test.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import List
import pytest
from examples.bandit import BanditEnv # noqa: E402
from tests.utils.utils import validate_single_task_env
def get_valid_n_arms() -> List[int]:
return [1, 10, 100]
def get_invalid_n_arms() -> List[in... | 784 | 22.787879 | 70 | py |
null | mtenv-main/tests/examples/finite_mtenv_bandit_test.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import List
import pytest
from examples.finite_mtenv_bandit import FiniteMTBanditEnv # noqa: E402
from tests.utils.utils import validate_mtenv
def get_valid_n_tasks_and_arms() -> List[int]:
return [(1, 2), (10, 20), (100, 200)]
... | 906 | 30.275862 | 75 | py |
null | mtenv-main/tests/examples/mtenv_bandit_test.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import List
import pytest
from examples.mtenv_bandit import MTBanditEnv # noqa: E402
from tests.utils.utils import validate_mtenv
def get_valid_n_arms() -> List[int]:
return [1, 10, 100]
def get_invalid_n_arms() -> List[int]:
... | 736 | 24.413793 | 70 | py |
null | mtenv-main/tests/examples/wrapped_bandit_test.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import List
import pytest
from gym import spaces
from examples.bandit import BanditEnv # noqa: E402
from examples.wrapped_bandit import MTBanditWrapper # noqa: E402
from tests.utils.utils import validate_mtenv
def get_valid_n_arms(... | 1,043 | 25.769231 | 82 | py |
null | mtenv-main/tests/utils/utils.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import Tuple
import gym
import numpy as np
from mtenv import MTEnv
from mtenv.utils.types import (
DoneType,
EnvObsType,
InfoType,
ObsType,
RewardType,
StepReturnType,
)
StepReturnTypeSingleEnv = Tuple[EnvObsT... | 1,854 | 25.5 | 75 | py |
null | mtenv-main/tests/wrappers/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
| 71 | 35 | 70 | py |
null | mtenv-main/tests/wrappers/ntasks_id_test.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import List
import pytest
from mtenv.envs.control.cartpole import MTCartPole
from mtenv.wrappers.ntasks_id import NTasksId as NTasksIdWrapper
from tests.utils.utils import validate_mtenv
def get_valid_num_tasks() -> List[int]:
... | 882 | 24.970588 | 70 | py |
null | mtenv-main/tests/wrappers/ntasks_test.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import List
import pytest
from mtenv.envs.control.cartpole import MTCartPole
from mtenv.wrappers.ntasks import NTasks as NTasksWrapper
from tests.utils.utils import validate_mtenv
def get_valid_num_tasks() -> List[int]:
return ... | 865 | 24.470588 | 70 | py |
GNOT | GNOT-master/__init__.py | #!/usr/bin/env python
#-*- coding:utf-8 _*-
| 46 | 14.666667 | 23 | py |
GNOT | GNOT-master/args.py | #!/usr/bin/env python
#-*- coding:utf-8 _*-
import argparse
def get_args():
parser = argparse.ArgumentParser(description='GNOT for operator learning')
parser.add_argument('--dataset',type=str,
default='ns2d',
choices = ['heat2d','ns2d','inductor2d','heatsin... | 4,018 | 38.792079 | 119 | py |
GNOT | GNOT-master/data_utils.py | #!/usr/bin/env python
#-*- coding:utf-8 _*-
import os
import torch
import numpy as np
import networkx as nx
import tqdm
import time
import pickle
import gc
import dgl
from sklearn.preprocessing import QuantileTransformer
from dgl.data import DGLDataset
from dgl.nn.pytorch import SumPooling, AvgPooling
from scipy i... | 28,518 | 37.960383 | 410 | py |
GNOT | GNOT-master/gnot_exp.sh | ### an example for training Naiver-Stokes equation on irregular domains
python train.py --gpu 0 --dataset ns2d --use-normalizer unit --normalize_x unit --component all --comment rel2 --loss-name rel2 --epochs 500 --batch-size 4 --model-name CGPT --optimizer AdamW --weight-decay 0.00005 --lr 0.001 --lr-method cycle ... | 402 | 133.333333 | 329 | sh |