repo stringlengths 1 99 | file stringlengths 13 215 | code stringlengths 12 59.2M | file_length int64 12 59.2M | avg_line_length float64 3.82 1.48M | max_line_length int64 12 2.51M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
AIRR | AIRR-main/train.py | import torch
import numpy as np
from torch.utils.data import DataLoader
from PIL import Image
import torch.nn.functional as F
import torch.autograd as autograd
import matplotlib.pyplot as plt
import torchvision
import argparse
import os
#options: synthesis, attr, celeba, celebahq
DATASET='celebahq'
#deepfashion synt... | 17,322 | 44.348168 | 153 | py |
AIRR | AIRR-main/dataloader_attr.py | import numpy as np
import os
import torch
from torch.utils.data import DataLoader
import torchvision.transforms as transforms
from PIL import Image
import scipy.io as scio
import h5py
import pickle
import copy
import random
import matplotlib.pyplot as plt
LABEL=['Background', 'Hat', 'Hair', 'Glove', 'Sunglasses', 'Upp... | 3,873 | 39.778947 | 319 | py |
AIRR | AIRR-main/model_synthesis.py | import torch
import torch.nn as nn
import functools
import numpy as np
import torch.nn.functional as F
class residual_block(nn.Module):
def __init__(self,dim):
super(residual_block,self).__init__()
self.block= nn.Sequential(nn.ReflectionPad2d(1),#tf.pad(h, [[0, 0], [1, 1], [1, 1], [0, 0]]... | 8,128 | 34.497817 | 147 | py |
SDCN | SDCN-master/utils.py | import numpy as np
import scipy.sparse as sp
import h5py
import torch
from torch.utils.data import Dataset
def load_graph(dataset, k):
if k:
path = 'graph/{}{}_graph.txt'.format(dataset, k)
else:
path = 'graph/{}_graph.txt'.format(dataset)
data = np.loadtxt('data/{}.txt'.format(dataset)... | 2,139 | 30.014493 | 78 | py |
SDCN | SDCN-master/GNN.py | import math
import torch
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
class GNNLayer(Module):
def __init__(self, in_features, out_features):
super(GNNLayer, self).__init__()
self.in_features = in_features
self.out_featu... | 690 | 29.043478 | 77 | py |
SDCN | SDCN-master/sdcn.py | from __future__ import print_function, division
import argparse
import random
import numpy as np
from sklearn.cluster import KMeans
from sklearn.metrics.cluster import normalized_mutual_info_score as nmi_score
from sklearn.metrics import adjusted_rand_score as ari_score
import torch
import torch.nn as nn
import torch.n... | 6,521 | 29.194444 | 98 | py |
SDCN | SDCN-master/data/pretrain.py | import numpy as np
import h5py
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.utils.data import DataLoader
from torch.optim import Adam, SGD
from torch.nn import Linear
from torch.utils.data import Dataset
from sklearn.cluster import KMeans
from ev... | 2,955 | 27.152381 | 78 | py |
UDIT | UDIT-master/arguments.py | # coding=utf-8
"""argparser configuration"""
import argparse
import os
import torch
import deepspeed
def add_model_config_args(parser: argparse.ArgumentParser):
"""Model arguments"""
group = parser.add_argument_group("model", "model configuration")
group.add_argument("--model-config", type=str, defau... | 14,989 | 47.199357 | 126 | py |
UDIT | UDIT-master/learning_rates.py | # coding=utf-8
"""PyTorch DataLoader for TFRecords"""
import torch
from torch.optim.lr_scheduler import _LRScheduler
import math
class AnnealingLR(_LRScheduler):
"""Anneals the learning rate from start to zero along a cosine curve."""
DECAY_STYLES = ['linear', 'cosine', 'exponential', 'constant', 'None', 'n... | 2,974 | 40.901408 | 176 | py |
UDIT | UDIT-master/utils.py | # coding=utf-8
"""Utilities for logging and serialization"""
import os
import random
import numpy as np
import torch
from fp16 import FP16_Optimizer
import mpu
import deepspeed
from apex.optimizers import FusedAdam as Adam
from fp16 import FP16_Module
from fp16 import FP16_Optimizer
from learning_rates import Annea... | 13,650 | 35.209549 | 126 | py |
UDIT | UDIT-master/generation_utils.py | # coding=utf-8
import os
import torch
import torch.nn.functional as F
from collections import defaultdict
from tokenization_t5 import EncDecTokenizer
class BeamHypotheses(object):
def __init__(self, num_beams, max_length, length_penalty, early_stopping, tokenizer=None):
"""
Initialize n-best li... | 24,337 | 41.924162 | 146 | py |
UDIT | UDIT-master/train_t0.py | # coding=utf-8
"""Training Enc-Dec"""
import os
import torch
import json
import numpy as np
from arguments import get_args
from data_utils.T0Datasets import T0Dataset
from data_utils.data_config import DATA_GROUP_CONFIG, DATA_NO_EVAL, DATA_NO_VALID, DATA_NO_TRAIN, DATA_EVAL_GEN
from data_utils import ANSWER_POST_FN... | 26,064 | 43.103215 | 202 | py |
UDIT | UDIT-master/samplers.py | # coding=utf-8
"""Batch samplers that work with either random or sequential data samplers."""
import torch
from torch.utils import data
class RandomSampler(data.sampler.Sampler):
"""Based off of pytorch RandomSampler and DistributedSampler. Essentially
a RandomSampler, but this class lets the user set an e... | 5,911 | 38.677852 | 91 | py |
UDIT | UDIT-master/tools/ds_fix/engine.py | '''
Copyright 2019 The Microsoft DeepSpeed Team
'''
import os
import time
import torch
import warnings
import torch.distributed as dist
from torch.nn.modules import Module
from torch.distributed.distributed_c10d import _get_global_rank
from tensorboardX import SummaryWriter
from deepspeed.runtime.zero.stage2 import ... | 62,693 | 40.740346 | 227 | py |
UDIT | UDIT-master/tools/ds_fix/stage1.py | import math
import torch
import torch.distributed as dist
from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
from collections import defaultdict
from deepspeed.runtime.zero.utils import _initialize_parameter_parallel_groups
from deepspeed.runtime.fp16.loss_scaler import LossScaler, DynamicLossSc... | 52,782 | 45.79344 | 155 | py |
UDIT | UDIT-master/tools/model/transform.py | #coding:utf-8
import torch
import argparse
import os
import tqdm
import copy
def transform_new_model(model_hf):
model_new = {}
cnt = 0
for i in range(24):
# encoder
target_k = 'encoder.blocks.{}.self_attn.self_attn.project.weight'.format(i)
source = ['encoder.block.{}.layer.0.Sel... | 9,374 | 36.5 | 200 | py |
UDIT | UDIT-master/tools/pseudo_data/mcqa/natural_question.py | import argparse
import multiprocessing
import os
import sys
import re
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
os.path.pardir)))
import time
import torch
import random
import numpy as np
import json
class Encoder(object):
def __init__(se... | 7,402 | 30.772532 | 145 | py |
UDIT | UDIT-master/tools/pseudo_data/mcqa/keyword_mask.py | import OpenHowNet
import argparse
import multiprocessing
import os
import sys
import re
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
os.path.pardir)))
import time
import torch
import random
import numpy as np
from collections import Counter
import... | 6,716 | 32.753769 | 141 | py |
UDIT | UDIT-master/tools/pseudo_data/s2t/keyword2sentence.py | import argparse
import multiprocessing
import os
import sys
import re
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
os.path.pardir)))
import time
import torch
import random
import numpy as np
import json
import nltk
from nltk.corpus import wordnet
... | 4,812 | 31.741497 | 141 | py |
UDIT | UDIT-master/tools/pseudo_data/sum/lead.py | import argparse
import multiprocessing
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
os.path.pardir)))
import time
import torch
import random
import numpy as np
import json
from nltk.tokenize import sent_tokenize
class Encode... | 3,318 | 27.367521 | 107 | py |
UDIT | UDIT-master/tools/pseudo_data/sum/gsg.py | import argparse
import multiprocessing
import os
import sys
import re
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
os.path.pardir)))
import time
import torch
import random
import numpy as np
from t5.evaluation import metrics as t5_metrics
import j... | 4,219 | 29.57971 | 141 | py |
UDIT | UDIT-master/tools/pseudo_data/para/para.py | import argparse
import multiprocessing
import os
import sys
import re
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
os.path.pardir)))
import time
import torch
import random
import numpy as np
import copy
import json
import nltk
from nltk.corpus imp... | 5,258 | 30.872727 | 141 | py |
UDIT | UDIT-master/tools/pseudo_data/para/question.py | import argparse
import multiprocessing
import os
import sys
import re
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
os.path.pardir)))
import time
import torch
import random
import numpy as np
import string
import copy
import json
import nltk
from n... | 5,680 | 30.043716 | 141 | py |
UDIT | UDIT-master/tools/pseudo_data/para/back_trans.py | import torch
import json
import time
import sys
import random
from tqdm import tqdm
from transformers import MarianMTModel, MarianTokenizer
def translate(texts, model, tokenizer, language="fr", device="cpu"):
# Prepare the text data into appropriate format for the model
template = lambda text: f"{text}" if l... | 3,439 | 34.833333 | 148 | py |
UDIT | UDIT-master/tools/pseudo_data/exqa/distant_supervision/constants.py | NUM_OF_SENTENCES_ULIM = 5
NUM_ENTITIES_PER_ARTICLE_TO_CONSIDER = 30 # only in v2
NUM_ENTITIES_PER_ARTICLE_TO_KEEP = 5
NUM_WORDS_IN_QUERY_SENTENCE_ULIM = 100
NUM_ARTICLES_PER_ENTITY_LLIM = 2
NUM_ARTICLES_PER_ENTITY_ULIM = 30 # limit number of backfill articles
# NOTE that this is using naive split() rather than th... | 865 | 38.363636 | 87 | py |
UDIT | UDIT-master/tools/pseudo_data/sent/imdb.py | import argparse
import multiprocessing
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
os.path.pardir)))
import time
import torch
import random
import numpy as np
import json
from nltk.tokenize.treebank import TreebankWordDetoken... | 3,404 | 28.608696 | 108 | py |
UDIT | UDIT-master/tools/seflsup/nsg.py | import argparse
import multiprocessing
import os
import sys
import string
sys.path.append(os.path.abspath(os.path.join(os.path.join(os.path.dirname(__file__), os.path.pardir), os.path.pardir)))
import time
import torch
import random
import numpy as np
import pickle
import random
from nltk.tokenize import sent_tokenize
... | 7,256 | 36.407216 | 150 | py |
UDIT | UDIT-master/tools/seflsup/get_selfsup.py | import argparse
import multiprocessing
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.join(os.path.dirname(__file__), os.path.pardir), os.path.pardir)))
import time
import torch
import random
import numpy as np
import pickle
import random
from tokenization_t5 import EncDecTokenizer
from nsg ... | 3,033 | 34.694118 | 128 | py |
UDIT | UDIT-master/tools/seflsup/lpp_gen.py | import argparse
import multiprocessing
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.join(os.path.dirname(__file__), os.path.pardir), os.path.pardir)))
import time
import torch
import random
import numpy as np
import pickle
import random
from nltk.tokenize import sent_tokenize
from tokeniza... | 8,580 | 38.182648 | 153 | py |
UDIT | UDIT-master/tools/seflsup/lpp_cls.py | import argparse
import multiprocessing
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.join(os.path.dirname(__file__), os.path.pardir), os.path.pardir)))
import time
import torch
import random
import numpy as np
import pickle
import random
from nltk.tokenize import sent_tokenize
from tokeniza... | 10,798 | 41.34902 | 169 | py |
UDIT | UDIT-master/tools/seflsup/mwp.py | import argparse
import multiprocessing
import os
import string
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.join(os.path.dirname(__file__), os.path.pardir), os.path.pardir)))
import time
import torch
import random
import numpy as np
import pickle
import random
from nltk.tokenize import sent_tokenize
... | 7,443 | 36.979592 | 150 | py |
UDIT | UDIT-master/tools/seflsup/lpp_pool.py | import argparse
import multiprocessing
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.join(os.path.dirname(__file__), os.path.pardir), os.path.pardir)))
import time
import torch
import random
import numpy as np
import pickle
import random
from nltk.tokenize import sent_tokenize
from tokeniza... | 5,459 | 34.454545 | 128 | py |
UDIT | UDIT-master/fp16/fp16util.py | # coding=utf-8
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
import mpu
class tofp16(nn.Module):
"""
Utility module that implements::
def forward(self, input):
return input.half()
"""... | 7,072 | 35.647668 | 337 | py |
UDIT | UDIT-master/fp16/loss_scaler.py | import torch
import mpu
# item() is a recent addition, so this helps with backward compatibility.
def to_python_float(t):
if hasattr(t, 'item'):
return t.item()
else:
return t[0]
class LossScaler:
"""
Class that manages a static loss scale. This class is intended to interact with
... | 9,150 | 40.035874 | 326 | py |
UDIT | UDIT-master/fp16/fp16.py | # coding=utf-8
"""Stable version of apex FP16 Optimizer"""
import torch
from torch import nn
from torch.autograd import Variable
from torch.nn.parameter import Parameter
from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
from .loss_scaler import DynamicLossScaler, LossScaler
from .fp16util impo... | 31,108 | 49.338188 | 437 | py |
UDIT | UDIT-master/mpu/mappings.py | # coding=utf-8
import torch
from .initialize import get_model_parallel_group
from .utils import split_tensor_along_last_dim
def _reduce(input_):
"""All-reduce the the input tensor across model parallel group."""
group = get_model_parallel_group()
# Bypass the function if we are using only 1 GPU.
i... | 3,527 | 26.138462 | 76 | py |
UDIT | UDIT-master/mpu/initialize.py | # coding=utf-8
"""Model and data parallel groups."""
import torch
from .utils import ensure_divisibility
# Model parallel group that the current rank belongs to.
_MODEL_PARALLEL_GROUP = None
# Data parallel group that the current rank belongs to.
_DATA_PARALLEL_GROUP = None
def initialize_model_parallel(model_... | 4,274 | 33.475806 | 77 | py |
UDIT | UDIT-master/mpu/cross_entropy.py | # coding=utf-8
import torch
from .initialize import get_model_parallel_group
from .initialize import get_model_parallel_rank
from .initialize import get_model_parallel_world_size
from .utils import VocabUtility
class _VocabParallelCrossEntropy(torch.autograd.Function):
@staticmethod
def forward(ctx, voca... | 9,078 | 41.425234 | 101 | py |
UDIT | UDIT-master/mpu/utils.py | # coding=utf-8
import torch
def ensure_divisibility(numerator, denominator):
"""Ensure that numerator is divisible by the denominator."""
assert numerator % denominator == 0, '{} is not divisible by {}'.format(
numerator, denominator)
def divide(numerator, denominator):
"""Ensure that numerat... | 2,102 | 34.644068 | 80 | py |
UDIT | UDIT-master/mpu/data.py | # coding=utf-8
import torch
from .initialize import get_model_parallel_group
from .initialize import get_model_parallel_rank
from .initialize import get_model_parallel_src_rank
_MAX_DATA_DIM = 4
def _check_data_types(keys, data, target_dtype):
"""Check that all the keys have the same target data type."""
... | 3,409 | 31.47619 | 80 | py |
UDIT | UDIT-master/mpu/grads.py | # coding=utf-8
# Parts of the code here are adapted from PyTorch
# repo: https://github.com/pytorch/pytorch
import torch
from torch._six import inf
from .initialize import get_model_parallel_group
from .initialize import get_model_parallel_rank
def clip_grad_norm(parameters, max_norm, norm_type=2):
"""Clips... | 2,406 | 37.206349 | 79 | py |
UDIT | UDIT-master/mpu/layers.py | # coding=utf-8
# Parts of the code here are adapted from PyTorch
# repo: https://github.com/pytorch/pytorch
import math
import torch
import torch.nn.functional as F
import torch.nn.init as init
from torch.nn.parameter import Parameter
from apex.normalization.fused_layer_norm import FusedLayerNorm as LayerNorm
f... | 12,967 | 39.652038 | 80 | py |
UDIT | UDIT-master/mpu/random.py | # coding=utf-8
#Modified by Samyam Rajbhandari
#Used to partition the activations stored for backward propagation
#Therefore reduces the memory consumption
# Parts of the code here are adapted from PyTorch
# repo: https://github.com/pytorch/pytorch
import contextlib
import torch.distributed as dist
import torch
fro... | 14,040 | 36.442667 | 151 | py |
UDIT | UDIT-master/mpu/transformer_enc_dec.py | from audioop import cross
import math
from numpy.lib.function_base import insert
import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
# from apex.normalization.fused_layer_norm import FusedLayerNorm as LayerNorm
from .initialize import get_model_parallel_world_size
from .lay... | 35,569 | 41.395709 | 186 | py |
UDIT | UDIT-master/model/enc_dec_modeling.py | import copy
import torch
import torch.nn as nn
import torch.nn.functional as F
import mpu
from .configuration_enc_dec import EncDecConfig
def init_method_normal(std):
"""Init method based on normal distribution.
This is only used for embeddings. The transformer has its
own initializer.
"""
def ... | 6,137 | 34.479769 | 186 | py |
UDIT | UDIT-master/model/distributed.py | # coding=utf-8
import torch
from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
import torch.distributed as dist
from torch.nn.modules import Module
from torch.autograd import Variable
import mpu
class DistributedDataParallel(Module):
def __init__(self, module):
super(DistributedD... | 4,286 | 42.30303 | 103 | py |
UDIT | UDIT-master/data_utils/T0Datasets.py | import json
import re
import os
import torch
import math
import numpy as np
import pickle
from torch.utils.data import Dataset
from utils import print_rank_0, save_rank_0
from tokenization_t5 import EncDecTokenizer
from .data_config import DATA_GROUP_CONFIG, DATA_CONFIG
import datasets
from promptsource.templates impor... | 15,176 | 42.991304 | 176 | py |
mbuild | mbuild-main/docs/conf.py | # -*- coding: utf-8 -*-
#
# mbuild documentation build configuration file, created by
# sphinx-quickstart on Wed Oct 1 08:59:12 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# Al... | 11,005 | 29.319559 | 211 | py |
mos-finetune-ssl | mos-finetune-ssl-main/run_inference.py | # ==============================================================================
# Copyright (c) 2023, Yamagishi Laboratory, National Institute of Informatics
# Author: Erica Cooper
# All rights reserved.
# ==============================================================================
## Get a pretrained model and run... | 1,657 | 41.512821 | 175 | py |
mos-finetune-ssl | mos-finetune-ssl-main/mos_fairseq.py | # ==============================================================================
# Copyright (c) 2021, Yamagishi Laboratory, National Institute of Informatics
# Author: Erica Cooper
# All rights reserved.
# ==============================================================================
import os
import argparse
import ... | 6,419 | 34.274725 | 138 | py |
mos-finetune-ssl | mos-finetune-ssl-main/run_inference_for_challenge.py | # ==============================================================================
# Copyright (c) 2021, Yamagishi Laboratory, National Institute of Informatics
# Author: Erica Cooper
# All rights reserved.
# ==============================================================================
## Get a pretrained model and run... | 1,627 | 40.74359 | 175 | py |
mos-finetune-ssl | mos-finetune-ssl-main/predict.py | # ==============================================================================
# Copyright (c) 2021, Yamagishi Laboratory, National Institute of Informatics
# Author: Erica Cooper
# All rights reserved.
# ==============================================================================
import os
import argparse
import ... | 5,509 | 32.803681 | 176 | py |
mos-finetune-ssl | mos-finetune-ssl-main/predict_noGT.py | # ==============================================================================
# Copyright (c) 2021, Yamagishi Laboratory, National Institute of Informatics
# Author: Erica Cooper
# All rights reserved.
# ==============================================================================
## run inference without requirin... | 3,454 | 32.221154 | 176 | py |
Minsight-sensor | Minsight-sensor-main/minsight_sensor/speed_test.py | import os
import time
import cv2
import numpy as np
import torch
import torchvision.transforms.functional as TF
from torch.autograd import Variable
from torch.profiler import ProfilerActivity, profile, record_function
from training.dataset import resize
from training.model import get_model
from training.utils import L... | 3,272 | 26.974359 | 130 | py |
Minsight-sensor | Minsight-sensor-main/minsight_sensor/error_plotting.py | import argparse
import os
import time
import cv2
import matplotlib as mtp
import matplotlib.pyplot as plt
import matplotlib.tri as tri
import numpy as np
import torch
from tqdm import tqdm
from training.dataset import Postprocessor, inference
from training.model import get_model
from training.utils import (LocalParams... | 12,696 | 39.695513 | 200 | py |
Minsight-sensor | Minsight-sensor-main/minsight_sensor/training/main.py | #! /usr/bin/python3
import argparse
import sys
import torch
from torch import nn
sys.path.append('.')
from dataset import ForceDataloaders, Postprocessor
from model import get_model
from train import test_model, train_model
from utils import LocalParams, read_json
if __name__ == '__main__':
parser = argparse.A... | 2,484 | 32.133333 | 86 | py |
Minsight-sensor | Minsight-sensor-main/minsight_sensor/training/utils.py | import torch
import numpy as np
import json
def read_json(path):
with open(path) as f:
data = json.load(f)
return data
def write_json(path, dict):
with open(path, "w") as outfile:
json.dump(dict, outfile)
def calc_errors_torch(prediction, ground_truth):
error_pt = torch.linalg.norm(pr... | 1,659 | 29.740741 | 76 | py |
Minsight-sensor | Minsight-sensor-main/minsight_sensor/training/model.py | from typing import Callable, Optional
import numpy as np
import torch.nn as nn
from efficientnet_pytorch import EfficientNet
from efficientnet_pytorch.utils import Conv2dStaticSamePadding
from sympy import symbols
from sympy.solvers.diophantine import diophantine
from torch import optim
from torch.optim import lr_sche... | 7,815 | 40.796791 | 128 | py |
Minsight-sensor | Minsight-sensor-main/minsight_sensor/training/dataset.py | import io
import os
import cv2
import matplotlib.pyplot as plt
import numpy as np
import torch
import torchvision.transforms.functional as TF
from matplotlib.font_manager import FontProperties
from PIL import Image
from torch.autograd import Variable
from torch.utils.data import DataLoader, Dataset
def resize(img, s... | 10,708 | 37.246429 | 203 | py |
Minsight-sensor | Minsight-sensor-main/minsight_sensor/training/train.py |
from __future__ import division, print_function
import numpy as np
from torch.autograd import Variable
from utils import calc_errors_torch
def train_model(params, model, criterion, optimizer, scheduler, dataloaders, dataset_sizes, postprocessor, use_gpu):
for epoch in range(params.total_epochs):
val_l... | 4,686 | 38.386555 | 179 | py |
Minsight-sensor | Minsight-sensor-main/lump_classification/lump_classification_binary.py | import glob
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from sklearn.metrics import confusion_matrix
from torch.utils.data import DataLoader, Dataset
from torchsum... | 5,515 | 28.031579 | 110 | py |
Minsight-sensor | Minsight-sensor-main/lump_classification/lump_classification_multi_class.py | import glob
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from sklearn.metrics import confusion_matrix
from torch.utils.data import DataLoader, Dataset
from torchsumm... | 5,944 | 28.874372 | 185 | py |
MOC_CoRL22 | MOC_CoRL22-main/train_causal_world.py | '''
Author: Jikun Kang
Date: 2021-11-24 09:24:48
LastEditTime: 2022-10-13 17:19:19
LastEditors: Jikun Kang
FilePath: /Learning-Multi-Objective-Curricula-for-Robotic-Policy-Learning/train_causal_world.py
'''
import argparse
import json
import os
import warnings
from pathlib import Path
import gym
import torch
from caus... | 15,291 | 43.453488 | 118 | py |
MOC_CoRL22 | MOC_CoRL22-main/core/custom_policy.py | '''
Author: Jikun Kang
Date: 2021-11-24 09:24:48
LastEditTime: 2022-10-13 17:11:33
LastEditors: Jikun Kang
FilePath: /Learning-Multi-Objective-Curricula-for-Robotic-Policy-Learning/core/custom_policy.py
'''
import collections
from abc import ABC, abstractmethod
from functools import partial
from typing import Any, Ca... | 36,509 | 40.161218 | 121 | py |
MOC_CoRL22 | MOC_CoRL22-main/core/custom_ppo.py | '''
Author: Jikun Kang
Date: 2021-11-24 09:24:48
LastEditTime: 2022-10-13 17:18:11
LastEditors: Jikun Kang
FilePath: /Learning-Multi-Objective-Curricula-for-Robotic-Policy-Learning/core/custom_ppo.py
'''
from typing import Any, Callable, Dict, Optional, Type, Union
import higher
import numpy as np
import torch as th
f... | 25,114 | 46.747148 | 123 | py |
MOC_CoRL22 | MOC_CoRL22-main/core/custom_buffers.py | '''
Author: Jikun Kang
Date: 2021-11-24 09:24:48
LastEditTime: 2022-10-13 17:16:02
LastEditors: Jikun Kang
FilePath: /Learning-Multi-Objective-Curricula-for-Robotic-Policy-Learning/core/custom_buffers.py
'''
import warnings
from abc import ABC, abstractmethod
from typing import Dict, Generator, Optional, Union
import ... | 17,712 | 38.626398 | 111 | py |
MOC_CoRL22 | MOC_CoRL22-main/core/custom_type_aliases.py | '''
Author: Jikun Kang
Date: 2021-11-24 09:24:48
LastEditTime: 2022-10-13 17:18:16
LastEditors: Jikun Kang
FilePath: /Learning-Multi-Objective-Curricula-for-Robotic-Policy-Learning/core/custom_type_aliases.py
'''
"""Common aliases for type hints"""
from typing import Any, Callable, Dict, List, NamedTuple, Tuple, Union... | 1,397 | 24.888889 | 101 | py |
MOC_CoRL22 | MOC_CoRL22-main/core/custom_on_policy_algorithm.py | '''
Author: Jikun Kang
Date: 2021-11-24 09:24:48
LastEditTime: 2022-10-13 17:17:50
LastEditors: Jikun Kang
FilePath: /Learning-Multi-Objective-Curricula-for-Robotic-Policy-Learning/core/custom_on_policy_algorithm.py
'''
import time
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
import gym
i... | 21,101 | 46.634312 | 112 | py |
MOC_CoRL22 | MOC_CoRL22-main/core/custom_no_meta_ppo.py | '''
Author: Jikun Kang
Date: 2021-11-24 09:24:48
LastEditTime: 2022-10-13 17:17:37
LastEditors: Jikun Kang
FilePath: /Learning-Multi-Objective-Curricula-for-Robotic-Policy-Learning/core/custom_no_meta_ppo.py
'''
from typing import Any, Callable, Dict, Optional, Type, Union
import higher
import numpy as np
import torch... | 12,917 | 42.789831 | 123 | py |
MOC_CoRL22 | MOC_CoRL22-main/core/custom_policies.py | '''
Author: Jikun Kang
Date: 2021-11-24 09:24:48
LastEditTime: 2022-10-13 17:12:48
LastEditors: Jikun Kang
FilePath: /Learning-Multi-Objective-Curricula-for-Robotic-Policy-Learning/core/custom_policies.py
'''
import collections
from abc import ABC, abstractmethod
from functools import partial
from typing import Any, Ca... | 22,173 | 43.615694 | 188 | py |
MOC_CoRL22 | MOC_CoRL22-main/core/custom_intervention.py | '''
Author: Jikun Kang
Date: 2021-11-24 09:24:48
LastEditTime: 2022-10-13 17:13:56
LastEditors: Jikun Kang
FilePath: /Learning-Multi-Objective-Curricula-for-Robotic-Policy-Learning/core/custom_intervention.py
'''
import numpy as np
import torch
from causal_world.intervention_actors.base_actor import \
BaseIntervent... | 26,591 | 59.436364 | 120 | py |
MOC_CoRL22 | MOC_CoRL22-main/curriculum_module/ppo_model.py | '''
Author: Jikun Kang
Date: 2021-11-24 09:24:48
LastEditTime: 2022-10-13 17:18:35
LastEditors: Jikun Kang
FilePath: /Learning-Multi-Objective-Curricula-for-Robotic-Policy-Learning/curriculum_module/ppo_model.py
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import optim
from torch.di... | 11,695 | 40.328622 | 111 | py |
MOC_CoRL22 | MOC_CoRL22-main/curriculum_module/models.py | '''
Author: Jikun Kang
Date: 2021-11-24 09:24:48
LastEditTime: 2022-10-13 17:14:03
LastEditors: Jikun Kang
FilePath: /Learning-Multi-Objective-Curricula-for-Robotic-Policy-Learning/curriculum_module/models.py
'''
import math
import numpy
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional ... | 16,944 | 34.824524 | 118 | py |
MOC_CoRL22 | MOC_CoRL22-main/utils/util.py | '''
Author: Jikun Kang
Date: 2021-11-24 09:24:48
LastEditTime: 2022-10-13 17:19:12
LastEditors: Jikun Kang
FilePath: /Learning-Multi-Objective-Curricula-for-Robotic-Policy-Learning/utils/util.py
'''
from collections import namedtuple
from typing import Callable, List
import numpy as np
import torch
import torch.nn as ... | 5,364 | 33.612903 | 119 | py |
genesis | genesis-master/train.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 24,540 | 40.245378 | 86 | py |
genesis | genesis-master/modules/unet.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 3,391 | 36.274725 | 78 | py |
genesis | genesis-master/modules/attention.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 9,263 | 39.810573 | 78 | py |
genesis | genesis-master/modules/decoders.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 1,296 | 35.027778 | 79 | py |
genesis | genesis-master/modules/component_vae.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 3,240 | 32.412371 | 78 | py |
genesis | genesis-master/modules/encoders.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 1,562 | 37.121951 | 78 | py |
genesis | genesis-master/modules/blocks.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 6,236 | 33.843575 | 79 | py |
genesis | genesis-master/third_party/sylvester/VAE.py | ################################################################################
# Adapted from https://github.com/riannevdberg/sylvester-flows
#
# Modified by Martin Engelcke
################################################################################
from attrdict import AttrDict
import torch
import torch.nn as... | 5,555 | 31.87574 | 99 | py |
genesis | genesis-master/third_party/sylvester/layers.py | ################################################################################
# Adapted from https://github.com/riannevdberg/sylvester-flows
#
# Modified by Martin Engelcke
################################################################################
import torch
import torch.nn as nn
class GatedConv2d(nn.Modu... | 3,648 | 34.77451 | 80 | py |
genesis | genesis-master/third_party/pytorch_fid/inception.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import models
try:
from torchvision.models.utils import load_state_dict_from_url
except ImportError:
from torch.utils.model_zoo import load_url as load_state_dict_from_url
# Inception weights ported to Pytorch from
# http://do... | 11,623 | 36.376206 | 126 | py |
genesis | genesis-master/third_party/pytorch_fid/fid_score.py | #!/usr/bin/env python3
"""Calculates the Frechet Inception Distance (FID) to evalulate GANs
The FID metric calculates the distance between two distributions of images.
Typically, we have summary statistics (mean & covariance matrix) of one
of these distributions, while the 2nd distribution is given by a GAN.
When run... | 9,899 | 36.218045 | 79 | py |
genesis | genesis-master/models/monet_config.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 7,789 | 38.145729 | 81 | py |
genesis | genesis-master/models/genesisv2_config.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 10,360 | 39.315175 | 80 | py |
genesis | genesis-master/models/vae_config.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 3,579 | 34.098039 | 78 | py |
genesis | genesis-master/models/genesis_config.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 18,289 | 40.853547 | 84 | py |
genesis | genesis-master/scripts/visualise_data.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 3,401 | 34.810526 | 78 | py |
genesis | genesis-master/scripts/compute_seg_metrics.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 4,999 | 35.764706 | 80 | py |
genesis | genesis-master/scripts/visualise_generation.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 4,596 | 36.680328 | 80 | py |
genesis | genesis-master/scripts/visualise_reconstruction.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 4,823 | 35.545455 | 80 | py |
genesis | genesis-master/scripts/generate_multid.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 5,039 | 34.244755 | 94 | py |
genesis | genesis-master/scripts/sketchy_preparation.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 3,374 | 41.1875 | 91 | py |
genesis | genesis-master/scripts/compute_fid.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 5,335 | 33.205128 | 80 | py |
genesis | genesis-master/datasets/gqn_config.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 5,152 | 32.679739 | 79 | py |
genesis | genesis-master/datasets/apc_config.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 6,251 | 34.931034 | 82 | py |
genesis | genesis-master/datasets/multi_object_config.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 8,286 | 37.906103 | 80 | py |
genesis | genesis-master/datasets/shapestacks_config.py | # =========================== A2I Copyright Header ===========================
#
# Copyright (c) 2003-2021 University of Oxford. All rights reserved.
# Authors: Applied AI Lab, Oxford Robotics Institute, University of Oxford
# https://ori.ox.ac.uk/labs/a2i/
#
# This file is the property of the University of Ox... | 6,296 | 36.933735 | 83 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.