python_code
stringlengths
0
992k
repo_name
stringlengths
8
46
file_path
stringlengths
5
162
# coding=utf-8 # Copyright (c) Facebook, Inc. and its affiliates. # Copyright (c) HuggingFace Inc. team. # # 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...
transformers-main
src/transformers/models/deprecated/mmbt/configuration_mmbt.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/models/deprecated/mmbt/__init__.py
# coding=utf-8 # Copyright (c) Facebook, Inc. and its affiliates. # Copyright (c) HuggingFace Inc. team. # # 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...
transformers-main
src/transformers/models/deprecated/mmbt/modeling_mmbt.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/models/deprecated/tapex/__init__.py
# coding=utf-8 # Copyright 2022 Microsoft Research and The HuggingFace Inc. team. All rights reserved. # # 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/L...
transformers-main
src/transformers/models/deprecated/tapex/tokenization_tapex.py
# coding=utf-8 # Copyright 2018 The HuggingFace Inc. team. # # 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...
transformers-main
src/transformers/models/deprecated/retribert/tokenization_retribert.py
# coding=utf-8 # Copyright 2018 The HuggingFace Inc. team. # # 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...
transformers-main
src/transformers/models/deprecated/retribert/tokenization_retribert_fast.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/models/deprecated/retribert/__init__.py
# coding=utf-8 # Copyright 2019-present, the HuggingFace Inc. team, The Google AI Language Team and Facebook, Inc. # # 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.or...
transformers-main
src/transformers/models/deprecated/retribert/configuration_retribert.py
# coding=utf-8 # Copyright 2019-present, the HuggingFace Inc. team, The Google AI Language Team and Facebook, Inc. # # 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.or...
transformers-main
src/transformers/models/deprecated/retribert/modeling_retribert.py
# coding=utf-8 # Copyright The HuggingFace Team and The HuggingFace Inc. team. All rights reserved. # # 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/LICE...
transformers-main
src/transformers/models/xglm/tokenization_xglm_fast.py
# coding=utf-8 # Copyright 2021 The Fairseq Authors and The HuggingFace Inc. team. All rights reserved. # # 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/...
transformers-main
src/transformers/models/xglm/modeling_flax_xglm.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/models/xglm/__init__.py
# coding=utf-8 # Copyright 2021 The Fairseq Authors The HuggingFace Inc. team. All rights reserved. # # 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/LICE...
transformers-main
src/transformers/models/xglm/modeling_tf_xglm.py
# coding=utf-8 # Copyright The HuggingFace Inc. team. All rights reserved. # # 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 requir...
transformers-main
src/transformers/models/xglm/configuration_xglm.py
import argparse from argparse import Namespace import torch from torch import nn from transformers import XGLMConfig, XGLMForCausalLM def remove_ignore_keys_(state_dict): ignore_keys = [ "decoder.version", "decoder.output_projection.weight", "_float_tensor", "decoder.embed_positi...
transformers-main
src/transformers/models/xglm/convert_xglm_original_ckpt_to_trfms.py
# coding=utf-8 # Copyright The HuggingFace Team and The HuggingFace Inc. team. All rights reserved. # # 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/LICE...
transformers-main
src/transformers/models/xglm/tokenization_xglm.py
# coding=utf-8 # Copyright 2021 The Fairseq Authors The HuggingFace Inc. team. All rights reserved. # # 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/LICE...
transformers-main
src/transformers/models/xglm/modeling_xglm.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/commands/user.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/commands/run.py
# Copyright 2021 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/commands/add_new_model_like.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/commands/env.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/commands/serving.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/commands/add_new_model.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/commands/download.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/commands/convert.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/commands/__init__.py
""" Implementation of a custom transfer agent for the transfer type "multipart" for git-lfs. Inspired by: github.com/cbartz/git-lfs-swift-transfer-agent/blob/master/git_lfs_swift_transfer.py Spec is: github.com/git-lfs/git-lfs/blob/master/docs/custom-transfers.md To launch debugger while developing: ``` [lfs "cust...
transformers-main
src/transformers/commands/lfs.py
#!/usr/bin/env python # Copyright 2020 The HuggingFace Team. All rights reserved. # # 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...
transformers-main
src/transformers/commands/transformers_cli.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/commands/train.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/commands/pt_to_tf.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/data/__init__.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/data/data_collator.py
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
transformers-main
src/transformers/data/metrics/__init__.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/data/metrics/squad_metrics.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/data/datasets/language_modeling.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/data/datasets/__init__.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/data/datasets/squad.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/data/datasets/glue.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # 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 cop...
transformers-main
src/transformers/data/processors/xnli.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/data/processors/__init__.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/data/processors/squad.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # 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 cop...
transformers-main
src/transformers/data/processors/glue.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # 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 cop...
transformers-main
src/transformers/data/processors/utils.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # # 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...
transformers-main
src/transformers/generation/configuration_utils.py
# coding=utf-8 # Copyright 2021 The Google AI Flax Team Authors, and The HuggingFace Inc. team. # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # 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 o...
transformers-main
src/transformers/generation/flax_utils.py
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team # # 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 ...
transformers-main
src/transformers/generation/logits_process.py
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team # # 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 ...
transformers-main
src/transformers/generation/tf_logits_process.py
import time import warnings from abc import ABC from copy import deepcopy from typing import Optional import torch from ..utils import add_start_docstrings, logging logger = logging.get_logger(__name__) STOPPING_CRITERIA_INPUTS_DOCSTRING = r""" Args: input_ids (`torch.LongTensor` of shape `(batch_size...
transformers-main
src/transformers/generation/stopping_criteria.py
# Copyright 2022 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/generation/__init__.py
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team # # 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 ...
transformers-main
src/transformers/generation/beam_search.py
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # 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...
transformers-main
src/transformers/generation/streamers.py
# coding=utf-8 # Copyright 2020 The Google AI Language Team Authors, Facebook AI Research authors and The HuggingFace Inc. team. # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the L...
transformers-main
src/transformers/generation/utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # 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 cop...
transformers-main
src/transformers/generation/tf_utils.py
# coding=utf-8 # Copyright 2021 The HuggingFace Inc. team # # 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 ...
transformers-main
src/transformers/generation/flax_logits_process.py
from abc import ABC, abstractmethod from typing import List, Optional class Constraint(ABC): r"""Abstract base class for all constraints that can be applied during generation. It must define how the constraint can be satisfied. All classes that inherit Constraint must follow the requirement that ```...
transformers-main
src/transformers/generation/beam_constraints.py
# Copyright 2021 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/sagemaker/trainer_sm.py
# Copyright 2021 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/sagemaker/training_args_sm.py
# Copyright 2021 The HuggingFace Team. All rights reserved. # # 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 applicabl...
transformers-main
src/transformers/sagemaker/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python3 import os import random from datetime import datetime import habitat import hydra import...
eai-vc-main
cortexbench/habitat_vc/run_habitat_vc.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. import setuptools setuptools.setup()
eai-vc-main
cortexbench/habitat_vc/setup.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. import argparse import glob import os import imageio import numpy as np import tqdm from PIL import Image def ...
eai-vc-main
cortexbench/habitat_vc/tools/verify-shortest-path-data.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python import argparse import glob import multiprocessing import os import habitat_sim import num...
eai-vc-main
cortexbench/habitat_vc/tools/collect-shortest-path-data.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. import pytest def pytest_addoption(parser): parser.addoption( "--nocluster", action="store_...
eai-vc-main
cortexbench/habitat_vc/tests/conftest.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. import pytest from hydra import initialize, compose from omegaconf import OmegaConf import habitat import torc...
eai-vc-main
cortexbench/habitat_vc/tests/test_visual_encoder.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. from typing import Optional import hydra import numpy as np import torch from torch import nn as nn from torch.n...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/visual_encoder.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. import warnings from typing import List, Optional, Union from habitat.config.default import _C as _HABITAT_CONFI...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/config.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. from habitat_vc.il import * # noqa from habitat_vc.rl import * # noqa
eai-vc-main
cortexbench/habitat_vc/habitat_vc/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. import glob import json import os from typing import ( Dict, List, Optional, Union, ) import num...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/utils.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. import torch def convert_frozen_batchnorm(module): r"""Helper function to convert all :attr:`BatchNorm*D` l...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/models/freeze_batchnorm.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree.
eai-vc-main
cortexbench/habitat_vc/habitat_vc/models/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # 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 List, Optional, Type, Union, cast from torch import Tensor from torch import nn as nn from torch.n...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/models/resnet.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. from typing import Dict import numpy as np import math import torch import torch.nn as nn import torch.nn.functi...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/models/resnet_encoders.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. from habitat_vc.il.objectnav import * # noqa
eai-vc-main
cortexbench/habitat_vc/habitat_vc/il/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn as nn from gym import Space from habitat import Config, logger from habitat.tasks.n...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/il/objectnav/visual_policy.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict from gym import spaces from habitat.config import Config from habitat.core.embodie...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/il/objectnav/sensors.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # 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 time import wandb from collections import defaultdict, deque from typing import Any, DefaultDict, Di...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/il/objectnav/il_trainer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and 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 torch import nn as nn from habitat_baselines.utils.common import CategoricalNet class ILPolicy(nn.Mo...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/il/objectnav/policy.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. import torch from torch import nn as nn class RNNStateEncoder(nn.Module): def __init__( self, ...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/il/objectnav/rnn_state_encoder.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. from habitat_vc.il.objectnav import custom_baseline_registry # noqa from habitat_vc.il.objectnav import dataset ...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/il/objectnav/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import os from typing import Any, Dict, List, Optional, Sequence from habitat.config import Config from h...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/il/objectnav/dataset.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. from typing import Optional from habitat_baselines.common.baseline_registry import BaselineRegistry from habitat...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/il/objectnav/custom_baseline_registry.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import contextlib import os import random import time import numpy as np import torch import wandb from collections i...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/il/objectnav/il_ddp_trainer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. from typing import Optional, List import attr import os from habitat.tasks.nav.nav import NavigationTask, Navig...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/il/objectnav/object_nav_task.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. import argparse import habitat import os from PIL import Image from habitat.utils.visualizations.utils import ( ...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/il/objectnav/objectnav_replay.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from collections import defaultdict class RolloutStorage: r"""Class for storing rollout informatio...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/il/objectnav/rollout_storage.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree.
eai-vc-main
cortexbench/habitat_vc/habitat_vc/il/objectnav/algos/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # 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 Optional, Tuple import torch from torch import Tensor from torch import nn as nn from torch import...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/il/objectnav/algos/agent.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. from typing import Dict, Optional, Tuple import torch from gym import spaces from habitat.config import Config f...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/rl/policy.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. from habitat_vc.rl.imagenav import * # noqa from habitat_vc.rl import environment # noqa from habitat_vc.rl imp...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/rl/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. from typing import Any import numpy as np import quaternion from habitat.config import Config from habitat.core....
eai-vc-main
cortexbench/habitat_vc/habitat_vc/rl/measures.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. import os import time import tqdm from typing import Any, Dict, List import torch from torch import nn import wa...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/rl/ppo_trainer.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. from typing import Optional import habitat import numpy as np from habitat import Config, Dataset from habitat_b...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/rl/environment.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. from typing import Optional from habitat_baselines.rl.ddppo.algo.ddppo import DecentralizedDistributedMixin from...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/rl/ppo.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Optional import numpy as np from habitat.config import Config from habitat.core.embodied...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/rl/reward.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Optional import numpy as np from habitat.config import Config from habitat.core.registry...
eai-vc-main
cortexbench/habitat_vc/habitat_vc/rl/imagenav/sensors.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. from habitat_vc.rl.imagenav import sensors # noqa
eai-vc-main
cortexbench/habitat_vc/habitat_vc/rl/imagenav/__init__.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. from setuptools import setup from setuptools import find_packages install_requires = [ "hydra-core", "w...
eai-vc-main
cortexbench/mujoco_vc/setup.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. import pytest def pytest_addoption(parser): parser.addoption( "--nocluster", action="store_...
eai-vc-main
cortexbench/mujoco_vc/tests/conftest.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # This source code is licensed under the CC-BY-NC license found in the # LICENSE file in the root directory of this source tree. import pytest from mujoco_vc.gym_wrapper import env_constructor from vc_models import vc_model_zoo # Full Env l...
eai-vc-main
cortexbench/mujoco_vc/tests/test_eaif_mujoco.py