python_code
stringlengths
0
187k
repo_name
stringlengths
8
46
file_path
stringlengths
6
135
import abc from typing import Any, Union, Callable, TypeVar, Dict, Optional, cast from collections import OrderedDict import torch import torch.nn as nn from torch.distributions.utils import lazy_property import gym from allenact.base_abstractions.sensor import AbstractExpertActionSensor as Expert from allenact.utils...
ask4help-main
allenact/base_abstractions/distributions.py
ask4help-main
allenact/algorithms/__init__.py
"""Defines the reinforcement learning `OnPolicyRunner`.""" import copy import glob import itertools import json import math import os import pathlib import queue import random import signal import subprocess import sys import time import traceback from collections import defaultdict from multiprocessing.context import ...
ask4help-main
allenact/algorithms/onpolicy_sync/runner.py
#!/usr/bin/env python3 # 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 abc from collections import OrderedDict from typing import TypeVar, Generic, Tuple, Optional, Union, Dict, List, A...
ask4help-main
allenact/algorithms/onpolicy_sync/policy.py
ask4help-main
allenact/algorithms/onpolicy_sync/__init__.py
"""Defines the reinforcement learning `OnPolicyRLEngine`.""" import datetime import itertools import logging import os import random import time import traceback from collections import defaultdict from multiprocessing.context import BaseContext from typing import ( Optional, Any, Dict, Union, List,...
ask4help-main
allenact/algorithms/onpolicy_sync/engine.py
# Original work Copyright (c) Facebook, Inc. and its affiliates. # Modified work Copyright (c) Allen Institute for AI # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import signal import time import traceback from multiprocessing.conn...
ask4help-main
allenact/algorithms/onpolicy_sync/vector_sampled_tasks.py
# Original work Copyright (c) Facebook, Inc. and its affiliates. # Modified work Copyright (c) Allen Institute for AI # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import random from collections import defaultdict from typing import Union, Li...
ask4help-main
allenact/algorithms/onpolicy_sync/storage.py
import functools from typing import Dict, cast, Sequence, Set import torch from allenact.algorithms.onpolicy_sync.losses.abstract_loss import ( AbstractActorCriticLoss, ) from allenact.algorithms.onpolicy_sync.policy import ObservationType from allenact.base_abstractions.distributions import CategoricalDistr from...
ask4help-main
allenact/algorithms/onpolicy_sync/losses/grouped_action_imitation.py
from .a2cacktr import A2C, ACKTR, A2CACKTR from .ppo import PPO
ask4help-main
allenact/algorithms/onpolicy_sync/losses/__init__.py
"""Defining imitation losses for actor critic type models.""" from typing import Dict, cast, Optional from collections import OrderedDict import torch from allenact.algorithms.onpolicy_sync.losses.abstract_loss import ( AbstractActorCriticLoss, ObservationType, ) from allenact.base_abstractions.distributions...
ask4help-main
allenact/algorithms/onpolicy_sync/losses/imitation.py
"""Defining abstract loss classes for actor critic models.""" import abc from typing import Dict, Tuple, Union import torch from allenact.algorithms.onpolicy_sync.policy import ObservationType from allenact.base_abstractions.distributions import CategoricalDistr from allenact.base_abstractions.misc import Loss, Acto...
ask4help-main
allenact/algorithms/onpolicy_sync/losses/abstract_loss.py
"""Defining the PPO loss for actor critic type models.""" from typing import Dict, Optional, Callable, cast, Tuple import torch from allenact.algorithms.onpolicy_sync.losses.abstract_loss import ( AbstractActorCriticLoss, ObservationType, ) from allenact.base_abstractions.distributions import CategoricalDist...
ask4help-main
allenact/algorithms/onpolicy_sync/losses/ppo.py
"""Implementation of the KFAC optimizer. TODO: this code is not supported as it currently lacks an implementation for recurrent models. """ import math import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from allenact.base_abstractions.distributions import AddBias # TODO:...
ask4help-main
allenact/algorithms/onpolicy_sync/losses/kfac.py
"""Implementation of A2C and ACKTR losses.""" from typing import cast, Tuple, Dict, Optional import torch from allenact.algorithms.onpolicy_sync.losses.abstract_loss import ( AbstractActorCriticLoss, ObservationType, ) from allenact.base_abstractions.distributions import CategoricalDistr from allenact.base_ab...
ask4help-main
allenact/algorithms/onpolicy_sync/losses/a2cacktr.py
ask4help-main
allenact/algorithms/offpolicy_sync/__init__.py
"""Defining abstract loss classes for actor critic models.""" import abc from typing import Dict, Tuple, TypeVar, Generic import torch from allenact.algorithms.onpolicy_sync.policy import ObservationType from allenact.base_abstractions.misc import Loss, Memory ModelType = TypeVar("ModelType") class AbstractOffPol...
ask4help-main
allenact/algorithms/offpolicy_sync/losses/abstract_offpolicy_loss.py
ask4help-main
allenact/algorithms/offpolicy_sync/losses/__init__.py
"""Functions used to initialize and manipulate pytorch models.""" import hashlib from collections import Callable from typing import Sequence, Tuple, Union, Optional, Dict, Any import numpy as np import torch import torch.nn as nn from allenact.utils.misc_utils import md5_hash_str_as_int def md5_hash_of_state_dict(...
ask4help-main
allenact/utils/model_utils.py
"""Utility classes and functions for running and designing experiments.""" import abc import collections.abc import copy import random from collections import OrderedDict, defaultdict from typing import ( Callable, NamedTuple, Dict, Any, Union, Iterator, Optional, List, cast, Seq...
ask4help-main
allenact/utils/experiment_utils.py
# Original work Copyright (c) 2016 OpenAI (https://openai.com). # Modified work Copyright (c) Allen Institute for AI # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Union, Tuple, List, cast, Iterable, Callable from collectio...
ask4help-main
allenact/utils/spaces_utils.py
import io import logging import os import socket import sys from contextlib import closing from typing import cast, Optional, Tuple from torch import multiprocessing as mp from allenact._constants import ALLENACT_INSTALL_DIR HUMAN_LOG_LEVELS: Tuple[str, ...] = ("debug", "info", "warning", "error", "none") """ Availa...
ask4help-main
allenact/utils/system.py
from typing import List, Any import torch from torchvision.models.detection.backbone_utils import resnet_fpn_backbone from torchvision.models.detection.faster_rcnn import FasterRCNN # noinspection PyProtectedMember from torchvision.models.detection.faster_rcnn import model_urls from torchvision.models.detection.rpn i...
ask4help-main
allenact/utils/cacheless_frcnn.py
ask4help-main
allenact/utils/__init__.py
import copy import functools import hashlib import inspect import json import math import os import random import subprocess import urllib import urllib.request from collections import Counter from contextlib import contextmanager from typing import Sequence, List, Optional, Tuple, Hashable import filelock import nump...
ask4help-main
allenact/utils/misc_utils.py
from typing import Sequence, Any import numpy as np from matplotlib import pyplot as plt, markers from matplotlib.collections import LineCollection from allenact.utils.viz_utils import TrajectoryViz class MultiTrajectoryViz(TrajectoryViz): def __init__( self, path_to_trajectory_prefix: Sequence[...
ask4help-main
allenact/utils/multi_agent_viz_utils.py
import os from collections import defaultdict import abc import json from typing import ( Dict, Any, Union, Optional, List, Tuple, Sequence, Callable, cast, Set, ) import sys import numpy as np from allenact.utils.experiment_utils import Builder from allenact.utils.tensor_utils...
ask4help-main
allenact/utils/viz_utils.py
"""Functions used to manipulate pytorch tensors and numpy arrays.""" import numbers import os import tempfile from collections import defaultdict from typing import List, Dict, Optional, DefaultDict, Union, Any, cast import PIL import numpy as np import torch from PIL import Image from moviepy import editor as mpy fr...
ask4help-main
allenact/utils/tensor_utils.py
import math from typing import Dict, Any, Union, Callable, Optional from allenact.utils.system import get_logger def pos_to_str_for_cache(pos: Dict[str, float]) -> str: return "_".join([str(pos["x"]), str(pos["y"]), str(pos["z"])]) def str_to_pos_for_cache(s: str) -> Dict[str, float]: split = s.split("_") ...
ask4help-main
allenact/utils/cache_utils.py
import os import sys from pathlib import Path from subprocess import getoutput def make_package(name, verbose=False): """Prepares sdist for allenact or allenact_plugins.""" orig_dir = os.getcwd() base_dir = os.path.join(os.path.abspath(os.path.dirname(Path(__file__))), "..") os.chdir(base_dir) w...
ask4help-main
scripts/release.py
#!/usr/bin/env python3 """Tool to run command on multiple nodes through SSH.""" import os import argparse import glob def get_argument_parser(): """Creates the argument parser.""" # noinspection PyTypeChecker parser = argparse.ArgumentParser( description="dcommand", formatter_class=argparse.Arg...
ask4help-main
scripts/dcommand.py
import glob import os import shutil import sys from pathlib import Path from subprocess import check_output from threading import Thread from typing import Dict, Union, Optional, Set, List, Sequence, Mapping from git import Git from ruamel.yaml import YAML # type: ignore from constants import ABS_PATH_OF_TOP_LEVEL_D...
ask4help-main
scripts/build_docs.py
#!/usr/bin/env python3 import os import argparse def get_argument_parser(): """Creates the argument parser.""" # noinspection PyTypeChecker parser = argparse.ArgumentParser( description="dconfig", formatter_class=argparse.ArgumentDefaultsHelpFormatter, ) parser.add_argument( "--...
ask4help-main
scripts/dconfig.py
#!/usr/bin/env python3 """Tool to terminate multi-node (distributed) training.""" import os import argparse import glob def get_argument_parser(): """Creates the argument parser.""" # noinspection PyTypeChecker parser = argparse.ArgumentParser( description="dkill", formatter_class=argparse.Argu...
ask4help-main
scripts/dkill.py
"""Helper functions used to create literate documentation from python files.""" import importlib import inspect import os from typing import Optional, Sequence, List, cast from typing.io import TextIO from constants import ABS_PATH_OF_DOCS_DIR, ABS_PATH_OF_TOP_LEVEL_DIR def get_literate_output_path(file: TextIO) ->...
ask4help-main
scripts/literate.py
import atexit import os import platform import re import shlex import subprocess import tempfile # Turning off automatic black formatting for this script as it breaks quotes. # fmt: off def pci_records(): records = [] command = shlex.split("lspci -vmm") output = subprocess.check_output(command).decode()...
ask4help-main
scripts/startx.py
#!/usr/bin/env python3 """Entry point to multi-node (distributed) training for a user given experiment name.""" import sys import os import time import random import string from pathlib import Path from typing import Optional import subprocess # Add to PYTHONPATH the path of the parent directory of the current file'...
ask4help-main
scripts/dmain.py
try: from allenact_plugins._version import __version__ except ModuleNotFoundError: __version__ = None
ask4help-main
allenact_plugins/__init__.py
import glob import os from pathlib import Path from setuptools import find_packages, setup def parse_req_file(fname, initial=None): """Reads requires.txt file generated by setuptools and outputs a new/updated dict of extras as keys and corresponding lists of dependencies as values. The input file's ...
ask4help-main
allenact_plugins/setup.py
import os if os.path.exists(os.path.join(os.getcwd(), "habitat", "habitat-lab")): # Old directory structure (not recommended) HABITAT_DATA_BASE = os.path.join(os.getcwd(), "habitat/habitat-lab/data") else: # New directory structure HABITAT_DATA_BASE = os.path.join(os.getcwd(), "datasets", "habitat",) ...
ask4help-main
allenact_plugins/habitat_plugin/habitat_constants.py
from abc import ABC from typing import Tuple, List, Dict, Any, Optional, Union, Sequence, cast import gym import numpy as np from habitat.sims.habitat_simulator.actions import HabitatSimActions from habitat.sims.habitat_simulator.habitat_simulator import HabitatSim from habitat.tasks.nav.shortest_path_follower import ...
ask4help-main
allenact_plugins/habitat_plugin/habitat_tasks.py
from allenact.utils.system import ImportChecker with ImportChecker( "\n\nPlease install habitat following\n\n" "https://allenact.org/installation/installation-framework/#installation-of-habitat\n\n" ): import habitat import habitat_sim
ask4help-main
allenact_plugins/habitat_plugin/__init__.py
from typing import Any, Optional, Tuple import gym import numpy as np from pyquaternion import Quaternion from allenact.base_abstractions.sensor import Sensor from allenact.embodiedai.sensors.vision_sensors import RGBSensor, DepthSensor from allenact.base_abstractions.task import Task from allenact.utils.misc_utils i...
ask4help-main
allenact_plugins/habitat_plugin/habitat_sensors.py
"""A wrapper for interacting with the Habitat environment.""" from typing import Dict, Union, List, Optional import habitat import numpy as np from habitat.config import Config from habitat.core.dataset import Dataset from habitat.core.simulator import Observations, AgentState, ShortestPathPoint from habitat.tasks.na...
ask4help-main
allenact_plugins/habitat_plugin/habitat_environment.py
from typing import Any from allenact.embodiedai.preprocessors.resnet import ResNetPreprocessor from allenact.utils.system import get_logger class ResnetPreProcessorHabitat(ResNetPreprocessor): """Preprocess RGB or depth image using a ResNet model.""" def __init__(self, *args, **kwargs: Any): super()...
ask4help-main
allenact_plugins/habitat_plugin/habitat_preprocessors.py
from typing import List, Optional, Union, Callable import gym import habitat from habitat.config import Config from allenact.base_abstractions.sensor import Sensor from allenact.base_abstractions.task import TaskSampler from allenact_plugins.habitat_plugin.habitat_environment import HabitatEnvironment from allenact_p...
ask4help-main
allenact_plugins/habitat_plugin/habitat_task_samplers.py
import glob import os import shutil from typing import List import habitat from habitat import Config from allenact.utils.system import get_logger from allenact_plugins.habitat_plugin.habitat_constants import ( HABITAT_DATA_BASE, HABITAT_CONFIGS_DIR, ) def construct_env_configs( config: Config, allow_sc...
ask4help-main
allenact_plugins/habitat_plugin/habitat_utils.py
ask4help-main
allenact_plugins/habitat_plugin/configs/__init__.py
import os import cv2 import habitat from pyquaternion import Quaternion from allenact_plugins.habitat_plugin.habitat_constants import ( HABITAT_CONFIGS_DIR, HABITAT_DATASETS_DIR, HABITAT_SCENE_DATASETS_DIR, ) from allenact_plugins.habitat_plugin.habitat_utils import get_habitat_config FORWARD_KEY = "w" L...
ask4help-main
allenact_plugins/habitat_plugin/scripts/agent_demo.py
ask4help-main
allenact_plugins/habitat_plugin/scripts/__init__.py
import os import habitat import numpy as np from tqdm import tqdm from allenact_plugins.habitat_plugin.habitat_constants import ( HABITAT_CONFIGS_DIR, HABITAT_DATA_BASE, HABITAT_SCENE_DATASETS_DIR, HABITAT_DATASETS_DIR, ) from allenact_plugins.habitat_plugin.habitat_utils import get_habitat_config ma...
ask4help-main
allenact_plugins/habitat_plugin/scripts/make_map.py
ask4help-main
allenact_plugins/habitat_plugin/data/__init__.py
from typing import Optional, Tuple, cast import gym import torch import torch.nn as nn from gym.spaces.dict import Dict as SpaceDict from allenact.algorithms.onpolicy_sync.policy import ( ActorCriticModel, Memory, ObservationType, ) from allenact.base_abstractions.distributions import CategoricalDistr fro...
ask4help-main
allenact_plugins/lighthouse_plugin/lighthouse_models.py
import copy import curses import itertools import time from functools import lru_cache from typing import Optional, Tuple, Any, List, Union, cast import numpy as np from gym.utils import seeding from gym_minigrid import minigrid EMPTY = 0 GOAL = 1 WRONG_CORNER = 2 WALL = 3 @lru_cache(1000) def _get_world_corners(wo...
ask4help-main
allenact_plugins/lighthouse_plugin/lighthouse_environment.py
import abc import string from typing import List, Dict, Any, Optional, Tuple, Union, Sequence, cast import gym import numpy as np from gym.utils import seeding from allenact.base_abstractions.misc import RLStepResult from allenact.base_abstractions.sensor import Sensor, SensorSuite from allenact.base_abstractions.tas...
ask4help-main
allenact_plugins/lighthouse_plugin/lighthouse_tasks.py
ask4help-main
allenact_plugins/lighthouse_plugin/__init__.py
import itertools from typing import Any, Dict, Optional, Tuple, Sequence import gym import numpy as np import pandas as pd import patsy from allenact.base_abstractions.sensor import Sensor, prepare_locals_for_super from allenact.base_abstractions.task import Task from allenact_plugins.lighthouse_plugin.lighthouse_env...
ask4help-main
allenact_plugins/lighthouse_plugin/lighthouse_sensors.py
import numpy as np from allenact.utils.experiment_utils import EarlyStoppingCriterion, ScalarMeanTracker class StopIfNearOptimal(EarlyStoppingCriterion): def __init__(self, optimal: float, deviation: float, min_memory_size: int = 100): self.optimal = optimal self.deviation = deviation se...
ask4help-main
allenact_plugins/lighthouse_plugin/lighthouse_util.py
ask4help-main
allenact_plugins/lighthouse_plugin/configs/__init__.py
ask4help-main
allenact_plugins/lighthouse_plugin/scripts/__init__.py
ask4help-main
allenact_plugins/lighthouse_plugin/data/__init__.py
import os from pathlib import Path BABYAI_EXPERT_TRAJECTORIES_DIR = os.path.abspath( os.path.join(os.path.dirname(Path(__file__)), "data", "demos") )
ask4help-main
allenact_plugins/babyai_plugin/babyai_constants.py
from allenact.utils.system import ImportChecker with ImportChecker( "\n\nPlease install babyai with:\n\n" "pip install -e git+https://github.com/Lucaweihs/babyai.git@0b450eeb3a2dc7116c67900d51391986bdbb84cd#egg=babyai\n", ): import babyai
ask4help-main
allenact_plugins/babyai_plugin/__init__.py
from typing import Dict, Optional, List, cast, Tuple, Any import babyai.model import babyai.rl import gym import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from gym.spaces.dict import Dict as SpaceDict from allenact.algorithms.onpolicy_sync.policy import ( ActorCriticModel, ...
ask4help-main
allenact_plugins/babyai_plugin/babyai_models.py
import random import signal from typing import Tuple, Any, List, Dict, Optional, Union, Callable import babyai import babyai.bot import gym import numpy as np from gym.utils import seeding from gym_minigrid.minigrid import MiniGridEnv from allenact.base_abstractions.misc import RLStepResult from allenact.base_abstrac...
ask4help-main
allenact_plugins/babyai_plugin/babyai_tasks.py
ask4help-main
allenact_plugins/babyai_plugin/configs/__init__.py
import glob import os import babyai from allenact_plugins.babyai_plugin.babyai_constants import ( BABYAI_EXPERT_TRAJECTORIES_DIR, ) def make_small_demos(dir: str): for file_path in glob.glob(os.path.join(dir, "*.pkl")): if "valid" not in file_path and "small" not in file_path: new_file_p...
ask4help-main
allenact_plugins/babyai_plugin/scripts/truncate_expert_demos.py
ask4help-main
allenact_plugins/babyai_plugin/scripts/__init__.py
import glob import os import babyai import numpy as np from allenact_plugins.babyai_plugin.babyai_constants import ( BABYAI_EXPERT_TRAJECTORIES_DIR, ) # Boss level # [(50, 11.0), (90, 22.0), (99, 32.0), (99.9, 38.0), (99.99, 43.0)] if __name__ == "__main__": # level = "BossLevel" level = "GoToLocal" ...
ask4help-main
allenact_plugins/babyai_plugin/scripts/get_instr_length_percentiles.py
import argparse import os import platform from allenact_plugins.babyai_plugin.babyai_constants import ( BABYAI_EXPERT_TRAJECTORIES_DIR, ) LEVEL_TO_TRAIN_VALID_IDS = { "BossLevel": ( "1DkVVpIEVtpyo1LxOXQL_bVyjFCTO3cHD", "1ccEFA_n5RT4SWD0Wa_qO65z2HACJBace", ), "GoToObjMaze": ( "1...
ask4help-main
allenact_plugins/babyai_plugin/scripts/download_babyai_expert_demos.py
ask4help-main
allenact_plugins/babyai_plugin/data/__init__.py
import random from typing import Dict, Tuple, List, Any, Optional, Union, Sequence, cast import gym import numpy as np from allenact.base_abstractions.misc import RLStepResult from allenact.base_abstractions.sensor import Sensor from allenact.base_abstractions.task import Task from allenact.utils.system import get_lo...
ask4help-main
allenact_plugins/ithor_plugin/ithor_tasks.py
"""A wrapper for engaging with the THOR environment.""" import copy import functools import math import random from typing import Tuple, Dict, List, Set, Union, Any, Optional, Mapping, cast import ai2thor.server import networkx as nx import numpy as np from ai2thor.controller import Controller from scipy.spatial.tran...
ask4help-main
allenact_plugins/ithor_plugin/ithor_environment.py
ask4help-main
allenact_plugins/ithor_plugin/__init__.py
"""Common constants used when training agents to complete tasks in iTHOR, the interactive version of AI2-THOR.""" from collections import OrderedDict from typing import Set, Dict MOVE_AHEAD = "MoveAhead" ROTATE_LEFT = "RotateLeft" ROTATE_RIGHT = "RotateRight" LOOK_DOWN = "LookDown" LOOK_UP = "LookUp" END = "End" VIS...
ask4help-main
allenact_plugins/ithor_plugin/ithor_constants.py
import glob import math import os import platform from contextlib import contextmanager from typing import Sequence import Xlib import Xlib.display import ai2thor.controller @contextmanager def include_object_data(controller: ai2thor.controller.Controller): needs_reset = len(controller.last_event.metadata["objec...
ask4help-main
allenact_plugins/ithor_plugin/ithor_util.py
import copy from typing import Any, Dict, Optional, Union, Sequence import ai2thor.controller import gym import gym.spaces import numpy as np import torch from allenact.base_abstractions.sensor import Sensor from allenact.embodiedai.sensors.vision_sensors import RGBSensor from allenact.base_abstractions.task import T...
ask4help-main
allenact_plugins/ithor_plugin/ithor_sensors.py
import copy import json import math import os from typing import Tuple, Sequence, Union, Dict, Optional, Any, cast, Generator, List import cv2 import numpy as np from PIL import Image, ImageDraw from ai2thor.controller import Controller from matplotlib import pyplot as plt from matplotlib.figure import Figure import c...
ask4help-main
allenact_plugins/ithor_plugin/ithor_viz.py
import copy import random from typing import List, Dict, Optional, Any, Union, cast import gym from allenact.base_abstractions.sensor import Sensor from allenact.base_abstractions.task import TaskSampler from allenact.utils.experiment_utils import set_deterministic_cudnn, set_seed from allenact.utils.system import ge...
ask4help-main
allenact_plugins/ithor_plugin/ithor_task_samplers.py
import os from allenact_plugins.robothor_plugin.scripts.make_objectnav_debug_dataset import ( create_debug_dataset_from_train_dataset, ) if __name__ == "__main__": CURRENT_PATH = os.getcwd() SCENE = "FloorPlan1" TARGET = "Apple" EPISODES = [0, 7, 11, 12] BASE_OUT = os.path.join(CURRENT_PATH, ...
ask4help-main
allenact_plugins/ithor_plugin/scripts/make_objectnav_debug_dataset.py
ask4help-main
allenact_plugins/ithor_plugin/scripts/__init__.py
import os from allenact_plugins.robothor_plugin.scripts.make_objectnav_debug_dataset import ( create_debug_dataset_from_train_dataset, ) if __name__ == "__main__": CURRENT_PATH = os.getcwd() SCENE = "FloorPlan1" EPISODES = [0, 7, 11, 12] BASE_OUT = os.path.join(CURRENT_PATH, "datasets", "ithor-poi...
ask4help-main
allenact_plugins/ithor_plugin/scripts/make_pointnav_debug_dataset.py
from collections import OrderedDict from typing import Dict, Any, Optional, List, cast import gym import numpy as np import torch from gym.spaces.dict import Dict as SpaceDict from allenact.base_abstractions.preprocessor import Preprocessor from allenact.utils.cacheless_frcnn import fasterrcnn_resnet50_fpn from allen...
ask4help-main
allenact_plugins/robothor_plugin/robothor_preprocessors.py
import copy import gzip import json import random import itertools from typing import List, Optional, Union, Dict, Any, cast, Tuple import gym import numpy as np from allenact.base_abstractions.sensor import Sensor from allenact.base_abstractions.task import TaskSampler from allenact.utils.cache_utils import str_to_p...
ask4help-main
allenact_plugins/robothor_plugin/robothor_task_samplers.py
import copy import glob import math import pickle import random import warnings from typing import Any, Optional, Dict, List, Union, Tuple, Collection from ai2thor.fifo_server import FifoServer import ai2thor.server import numpy as np from ai2thor.controller import Controller from ai2thor.util import metrics from all...
ask4help-main
allenact_plugins/robothor_plugin/robothor_environment.py
MOVE_AHEAD = "MoveAhead" ROTATE_LEFT = "RotateLeft" ROTATE_RIGHT = "RotateRight" LOOK_DOWN = "LookDown" LOOK_UP = "LookUp" END = "End" PASS = "Pass"
ask4help-main
allenact_plugins/robothor_plugin/robothor_constants.py
from typing import Tuple import torch from allenact.base_abstractions.distributions import CategoricalDistr, Distr class TupleCategoricalDistr(Distr): def __init__(self, probs=None, logits=None, validate_args=None): self.dists = CategoricalDistr( probs=probs, logits=logits, validate_args=val...
ask4help-main
allenact_plugins/robothor_plugin/robothor_distributions.py
from typing import Tuple, Dict, Union, Sequence, Optional, cast import gym import torch import torch.nn as nn from gym.spaces import Dict as SpaceDict from allenact.algorithms.onpolicy_sync.policy import ( ActorCriticModel, LinearActorCriticHead, DistributionType, Memory, ObservationType, ) from a...
ask4help-main
allenact_plugins/robothor_plugin/robothor_models.py
ask4help-main
allenact_plugins/robothor_plugin/__init__.py
import math from typing import Tuple, List, Dict, Any, Optional, Union, Sequence, cast import gym import numpy as np from allenact.base_abstractions.misc import RLStepResult from allenact.base_abstractions.sensor import Sensor from allenact.base_abstractions.task import Task from allenact.utils.system import get_logg...
ask4help-main
allenact_plugins/robothor_plugin/robothor_tasks.py
from typing import Any, Tuple, Optional, Union import gym import numpy as np import quaternion # noqa # pylint: disable=unused-import from allenact.base_abstractions.sensor import Sensor from allenact.embodiedai.sensors.vision_sensors import RGBSensor, DepthSensor from allenact.base_abstractions.task import Task fro...
ask4help-main
allenact_plugins/robothor_plugin/robothor_sensors.py
import copy import json import math import os from typing import Tuple, Sequence, Union, Dict, Optional, Any, cast, Generator, List import cv2 import numpy as np from PIL import Image, ImageDraw from ai2thor.controller import Controller from matplotlib import pyplot as plt from matplotlib.figure import Figure import c...
ask4help-main
allenact_plugins/robothor_plugin/robothor_viz.py
ask4help-main
allenact_plugins/robothor_plugin/configs/__init__.py
import gzip import json import os from typing import Sequence, Optional from allenact_plugins.robothor_plugin.robothor_task_samplers import ( ObjectNavDatasetTaskSampler, ) def create_debug_dataset_from_train_dataset( scene: str, target_object_type: Optional[str], episodes_subset: Sequence[int], ...
ask4help-main
allenact_plugins/robothor_plugin/scripts/make_objectnav_debug_dataset.py
ask4help-main
allenact_plugins/robothor_plugin/scripts/__init__.py
import os from allenact_plugins.robothor_plugin.scripts.make_objectnav_debug_dataset import ( create_debug_dataset_from_train_dataset, ) if __name__ == "__main__": CURRENT_PATH = os.getcwd() SCENE = "FloorPlan_Train1_1" EPISODES = [3, 4, 5, 6] BASE_OUT = os.path.join(CURRENT_PATH, "datasets", "rob...
ask4help-main
allenact_plugins/robothor_plugin/scripts/make_pointnav_debug_dataset.py
import random from typing import Tuple, Any, List, Dict, Optional, Union, Callable, Sequence, cast import gym import networkx as nx import numpy as np from gym.utils import seeding from gym_minigrid.envs import CrossingEnv from gym_minigrid.minigrid import ( DIR_TO_VEC, IDX_TO_OBJECT, MiniGridEnv, OBJE...
ask4help-main
allenact_plugins/minigrid_plugin/minigrid_tasks.py
import copy from typing import Optional, Set import numpy as np from gym import register from gym_minigrid.envs import CrossingEnv from gym_minigrid.minigrid import Lava, Wall class FastCrossing(CrossingEnv): """Similar to `CrossingEnv`, but to support faster task sampling as per `repeat_failed_task_for_min_...
ask4help-main
allenact_plugins/minigrid_plugin/minigrid_environments.py
from allenact.utils.system import ImportChecker with ImportChecker( "\n\nPlease install babyai with:\n\n" "pip install -e git+https://github.com/Lucaweihs/babyai.git@0b450eeb3a2dc7116c67900d51391986bdbb84cd#egg=babyai\n", ): import babyai
ask4help-main
allenact_plugins/minigrid_plugin/__init__.py
import os import queue import random from collections import defaultdict from typing import Dict, Tuple, Any, cast, Iterator, List, Union, Optional import babyai import blosc import numpy as np import pickle5 as pickle import torch from gym_minigrid.minigrid import MiniGridEnv from allenact.algorithms.offpolicy_sync....
ask4help-main
allenact_plugins/minigrid_plugin/minigrid_offpolicy.py