python_code
stringlengths
0
679k
repo_name
stringlengths
9
41
file_path
stringlengths
6
149
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/visualize/__init__.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/visualize/standard_fields.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/visualize/vis_utils.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/visualize/static_shape.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/model/optimizer_builder.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/model/normalization_builder.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/model/iou_utils.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/model/label_util.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/model/fpn_configs.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/model/nms_np.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/model/postprocess.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/model/learning_rate.py
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/model/__init__.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/model/callback_builder.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/model/efficientdet_keras.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/model/anchors.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/model/inference.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/model/dataloader.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/model/activation_builder.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/model/coco_metric.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/object_detection/target_assigner.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/object_detection/matcher.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/object_detection/faster_rcnn_box_coder.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/object_detection/shape_utils.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/object_detection/box_coder.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/object_detection/__init__.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/object_detection/preprocessor.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/object_detection/box_list.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/object_detection/region_similarity_calculator.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/object_detection/tf_example_decoder.py
# Copyright 2020 Google Research. 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 applicable law...
DeepLearningExamples-master
TensorFlow2/Detection/Efficientdet/object_detection/argmax_matcher.py
# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without res...
cuOpt-Resources-branch-22.12
notebooks/routing/python/notebook_utils/notebook_helpers.py
# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without res...
cuOpt-Resources-branch-22.12
notebooks/routing/service/notebook_utils/notebook_helpers.py
#!/usr/bin/env python3 # SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in ...
open-gpu-kernel-modules-main
nouveau/extract-firmware-nouveau.py
""" This file is from https://github.com/mlpen/Nystromformer """ import torch import torch.nn as nn import math import json from torch.utils.checkpoint import checkpoint import pdb class SoftmaxAttention(nn.Module): def __init__(self, config): super().__init__() self.drop_attn = torch.nn.Dropout(p...
transformer-ls-master
lra/attention.py
""" This file is from https://github.com/mlpen/Nystromformer """ import torch import torch.nn as nn import math class NystromAttention(nn.Module): def __init__(self, config): super().__init__() self.head_dim = config.head_dim self.num_head = config.num_head self.num_landmarks = c...
transformer-ls-master
lra/attention_nystrom.py
""" This file is from https://github.com/mlpen/Nystromformer """ import torch import torch.nn as nn import math from performer_pytorch import FastAttention class PerformerAttention(nn.Module): def __init__(self, config): super().__init__() self.head_dim = config.head_dim self.rp_dim = con...
transformer-ls-master
lra/attention_performer.py
""" This file is from https://github.com/mlpen/Nystromformer """ import torch import torch.nn as nn import numpy as np import math from torch.utils.checkpoint import checkpoint from attention import Attention from attention_transformer_ls import AttentionLS import pdb class Embeddings(nn.Module): def __init__(sel...
transformer-ls-master
lra/model.py
""" This file is from https://github.com/mlpen/Nystromformer """ import torch import torch.nn as nn import math from model import Model def pooling(inp, mode): # pdb.set_trace() if mode.lower() == "cls": pooled = inp[:, 0, :] elif mode.lower() == "mean": pooled = inp.mean(dim=1) else:...
transformer-ls-master
lra/model_wrapper.py
""" This file is from https://github.com/mlpen/Nystromformer """ import torch import torch.nn as nn import math from torch.utils.data.dataset import Dataset import sys import os import random import json import pickle import numpy as np import pdb class LRADataset(Dataset): def __init__(self, file_path, endless):...
transformer-ls-master
lra/dataset.py
""" This file is from https://github.com/mlpen/Nystromformer """ import torch import torch.nn as nn from transformers.models.reformer.modeling_reformer import LSHSelfAttention, ReformerConfig class LSHAttention(LSHSelfAttention): def __init__(self, config, query, key, value): self.num_hash = config.num_ha...
transformer-ls-master
lra/attention_reformer.py
""" Adapted from https://github.com/mlpen/Nystromformer """ from fvcore.nn import FlopCountAnalysis from model_wrapper import ModelForSC, ModelForSCDual, ModelForSCProbing, ModelForSCDualProbing from dataset import LRADataset import torch import random import torch.backends.cudnn as cudnn from torch.utils.data import ...
transformer-ls-master
lra/run_tasks.py
# Copyright (c) 2021 NVIDIA CORPORATION. Licensed under the MIT license. # Written by Chen Zhu during an internship at NVIDIA, zhuchen.eric@gmail.com import torch import torch.nn as nn import torch.nn.functional as F import math class AttentionLS(nn.Module): """The long-short term attention for bidirectional lan...
transformer-ls-master
lra/attention_transformer_ls.py
""" Adapted from https://github.com/mlpen/Nystromformer Add dynamic convolution which is not included in Linformer. """ import torch import torch.nn as nn import math import pdb class LinformerAttention(nn.Module): projection_matrix = None def __init__(self, config): super().__init__() self....
transformer-ls-master
lra/attention_linformer.py
""" This file is from https://github.com/mlpen/Nystromformer """ import sys sys.path.append("./long-range-arena/lra_benchmarks/listops/") import input_pipeline import numpy as np import pickle train_ds, eval_ds, test_ds, encoder = input_pipeline.get_datasets( n_devices = 1, task_name = "basic", data_dir = "./lra_...
transformer-ls-master
lra/datasets/listops.py
""" This file is from https://github.com/mlpen/Nystromformer """ import sys sys.path.append("./long-range-arena/lra_benchmarks/text_classification/") import input_pipeline import numpy as np import pickle train_ds, eval_ds, test_ds, encoder = input_pipeline.get_tc_datasets( n_devices = 1, task_name = "imdb_review...
transformer-ls-master
lra/datasets/text.py
""" This file is from https://github.com/mlpen/Nystromformer """ import sys sys.path.append("./long-range-arena/lra_benchmarks/matching/") import input_pipeline import numpy as np import pickle datapath = './datasets' train_ds, eval_ds, test_ds, encoder = input_pipeline.get_matching_datasets( n_devices = 1, task...
transformer-ls-master
lra/datasets/retrieval.py
transformer-ls-master
lra/datasets/long-range-arena/__init__.py
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/__init__.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/matching/build_vocab.py
# Copyright 2020 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/matching/input_pipeline.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/matching/train.py
# Copyright 2020 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/matching/configs/base_match_config.py
# Copyright 2020 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/matching/configs/transformer_base.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/utils/train_utils.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/utils/data_utils.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/task_registry.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/input_pipeline.py
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/__init__.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/train.py
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/configs/__init__.py
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/configs/pathfinder128/__init__.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/configs/pathfinder128/transformer_base.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/configs/pathfinder128/base_pathfinder128_config.py
"""Base Configuration.""" # Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/configs/pathfinder256/base_pathfinder256_config.py
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/configs/pathfinder256/__init__.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/configs/pathfinder256/transformer_base.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/configs/pathfinder64/base_pathfinder64_config.py
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/configs/pathfinder64/__init__.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/configs/pathfinder64/transformer_base.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/configs/pathfinder32/base_pathfinder32_config.py
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/configs/pathfinder32/__init__.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/configs/pathfinder32/transformer_base.py
# Copyright 2020 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/configs/cifar10/base_cifar10_config.py
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/configs/cifar10/__init__.py
# Copyright 2020 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/image/configs/cifar10/transformer_base.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/text_classification/input_pipeline.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/text_classification/train.py
# Copyright 2020 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/text_classification/configs/transformer_base.py
# Copyright 2020 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/text_classification/configs/base_tc_config.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/data/pathfinder.py
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/data/__init__.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/data/listops.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/listops/input_pipeline.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/listops/train.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/listops/configs/base_listops_config.py
# Copyright 2021 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
transformer-ls-master
lra/datasets/long-range-arena/lra_benchmarks/listops/configs/transformer_base.py
from .model_wrapper import * from .truncated_bptt_lm_task import * from .loss import *
transformer-ls-master
autoregressive/model_lib/__init__.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 math import torch import torch.nn as nn import torch.nn.functional as F from fairseq.modules.layer_norm import Lay...
transformer-ls-master
autoregressive/model_lib/model.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 logging from dataclasses import dataclass from typing import Dict, List, Optional import torch from fairseq.dataclass import FairseqDa...
transformer-ls-master
autoregressive/model_lib/model_wrapper.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 math from dataclasses import dataclass import torch.nn.functional as F from fairseq import metrics, utils from fairseq.criterions impo...
transformer-ls-master
autoregressive/model_lib/loss.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. """Forked from https://github.com/pytorch/fairseq/blob/master/examples/truncated_bptt/truncated_bptt_lm_task.py """ import logging import os f...
transformer-ls-master
autoregressive/model_lib/truncated_bptt_lm_task.py
# Copyright (c) 2021 NVIDIA CORPORATION. Licensed under the MIT license. import math import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.checkpoint as cp from fairseq.modules.layer_norm import LayerNorm import pdb class ChunkedLSAttention(nn.Module): def __init__(self, d_mode...
transformer-ls-master
autoregressive/model_lib/layer.py
#!/usr/bin/env python # coding=utf-8 """Copied rom https://github.com/kimiyoung/transformer-xl/blob/master/prep_text8.py""" import os import sys import zipfile from io import open if os.path.exists('train.txt'): print('Tokenized text8 already exists - skipping processing') sys.exit() data = zipfile.ZipFile(...
transformer-ls-master
autoregressive/data_prepro/prep_text8.py
"""Unified script for classification problems, with distributed training support. Adapted from https://github.com/microsoft/vision-longformer """ import wandb import argparse import logging import os import os.path as op import sys import torch import torch.utils.data.distributed from timm.data import Mixup from mod...
transformer-ls-master
imagenet/run_experiment_distributed.py
""" This file is from https://github.com/microsoft/vision-longformer """ import torch as th import torch.nn as nn import torch.nn.functional as F import numpy as np def linear_combination(x, y, epsilon): return epsilon*x + (1-epsilon)*y def reduce_loss(loss, reduction='mean'): return loss.mean() if re...
transformer-ls-master
imagenet/loss.py
""" This file is from https://github.com/microsoft/vision-longformer """ import time import logging import torch import os import json from torch.cuda.amp import autocast from utils.comm import _accumulate_predictions_from_multiple_gpus, \ is_main_process ONLY_OVERLAP_CLASSES = True def compute_accuracy(output...
transformer-ls-master
imagenet/engine.py
# Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license. from .defaults import _C as cfg
transformer-ls-master
imagenet/config/__init__.py
# Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license. # Written by Pengchuan Zhang, penzhan@microsoft.com import os from yacs.config import CfgNode as CN # ----------------------------------------------------------------------------- # Config definition # ----------------------------------------...
transformer-ls-master
imagenet/config/defaults.py
transformer-ls-master
imagenet/dat/__init__.py