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 |
|---|---|---|---|---|---|---|
FusedChat | FusedChat-main/prepare_classification_data.py | from pytorch_pretrained_bert import BertTokenizer
import numpy as np
from tqdm import tqdm
import json
from bert_input_utils import *
import numpy as np
from argparse import ArgumentParser
import os
parser = ArgumentParser()
parser.add_argument("--bert_model_type", type=str, required=False,
defaul... | 2,633 | 32.769231 | 108 | py |
FusedChat | FusedChat-main/conversation_mode_classification.py | import torch.nn as nn
import numpy as np
import torch
from pytorch_pretrained_bert import BertTokenizer, BertModel
import math
from tqdm import tqdm
from sklearn import metrics
from bert_input_utils import *
class BertEncoder(nn.Module):
def __init__(self, embd_dim, num_classes, device='cuda'):
super(Ber... | 5,678 | 37.114094 | 116 | py |
FusedChat | FusedChat-main/Generator.py | import random
import torch
import copy
import torch.nn.functional as F
import logging
import sys
import conversation_mode_classification as cmc
from pytorch_transformers import GPT2DoubleHeadsModel, GPT2Tokenizer
from dbquery import query_fuzzy_and_normalized
from util import build_input_from_segments, SPECIAL_TOKENS_... | 39,787 | 43.856821 | 133 | py |
FusedChat | FusedChat-main/dbquery.py | """
"""
import json
import os
import random
from fuzzywuzzy import fuzz
from nltk.stem.porter import *
stemmer = PorterStemmer()
# loading databases
domains = ['restaurant', 'hotel', 'attraction', 'train', 'hospital', 'taxi', 'police']
dbs = {}
for domain in domains:
dbs[domain] = json.load(open('multiwoz/db/{}_d... | 13,060 | 39.436533 | 141 | py |
FusedChat | FusedChat-main/util.py | # Copyright (c) 2019-present, HuggingFace Inc.
# All rights reserved. This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import json
import logging
import os
import random
import torch
import copy
from itertools import chain
from tqdm import t... | 26,304 | 48.168224 | 146 | py |
FusedChat | FusedChat-main/evaluate_ppl.py | '''
Evaluate perplexity on the test set. The model can be either fused or classification-based.
In the case of fused, use_classifier is set to False. In the case of classification-based, use_classifier is set to True.
In the case of classification-based, cls_model_checkpoint is specified.
And model_che... | 8,711 | 46.347826 | 125 | py |
FusedChat | FusedChat-main/context_classification.py | import numpy as np
import torch
from pytorch_pretrained_bert import BertTokenizer
from cross_base import BertEncoder
from argparse import ArgumentParser
import os
parser = ArgumentParser()
parser.add_argument("--bert_model_type", type=str, required=False,
default="bert-base-uncased", help="the ty... | 4,822 | 48.214286 | 114 | py |
FusedChat | FusedChat-main/train.py | import os
import math
import logging
import sys
from pprint import pformat
from argparse import ArgumentParser
from collections import defaultdict
from itertools import chain
from tokenize import String
import numpy
import torch
from torch.nn.parallel import DistributedDataParallel
from torch.utils.data import DataLoad... | 24,165 | 58.085575 | 175 | py |
FusedChat | FusedChat-main/evaluate_slot_accuracy.py | '''Evaluate slot accuracy, joint slot accuracy, inform rate, success rate, and BLEU'''
'''
Slot accuracy: how often are slot values correctly predicted
Joint slot accuracy: how often are all slot values in a turn correctly predicted
Inform rate: whether an appropriate entity is provided in the dialogue
Success rate: a... | 17,187 | 46.877437 | 134 | py |
FusedChat | FusedChat-main/pytorch_transformers/gpt2_for_dialogue_selection.py | # from modeling_gpt2 import GPT2Config
# from convlab.modules.e2e.multiwoz.Transformer.pytorch_transformers
from modeling_gpt2 import GPT2DoubleHeadsModel, GPT2Tokenizer
from . import GPT2Tokenizer
GPT2Config
config = GPT2Config.from_pretrained('gpt2')
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
model = GPT2Dou... | 733 | 44.875 | 104 | py |
FusedChat | FusedChat-main/pytorch_transformers/optimization.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and 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/LICEN... | 8,335 | 44.304348 | 130 | py |
FusedChat | FusedChat-main/pytorch_transformers/__main__.py | # coding: utf8
def main():
import sys
if (len(sys.argv) < 4 or len(sys.argv) > 6) or sys.argv[1] not in ["bert", "gpt", "transfo_xl", "gpt2", "xlnet", "xlm"]:
print(
"Should be used as one of: \n"
">> pytorch_transformers bert TF_CHECKPOINT TF_CONFIG PYTORCH_DUMP_OUTPUT, \n"
">> ... | 7,021 | 53.434109 | 143 | py |
FusedChat | FusedChat-main/pytorch_transformers/convert_gpt2_checkpoint_to_pytorch.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... | 3,078 | 39.513158 | 111 | py |
FusedChat | FusedChat-main/pytorch_transformers/convert_openai_checkpoint_to_pytorch.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... | 3,167 | 40.684211 | 118 | py |
FusedChat | FusedChat-main/pytorch_transformers/modeling_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... | 42,620 | 48.387022 | 157 | py |
FusedChat | FusedChat-main/pytorch_transformers/github_relay_classifier.py | from github import Github
import sys
sys.path.append('/home/tomyoung/NeuralPipeline_DSTC8/ConvLab/convlab/modules/e2e/multiwoz/Transformer/')
import conversation_mode_classification as cmc
import numpy as np
import torch
from tqdm import tqdm
import json
import time
from datetime import datetime
def post_dialogue(rep... | 5,193 | 34.333333 | 122 | py |
FusedChat | FusedChat-main/pytorch_transformers/modeling_bert.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... | 66,429 | 52.186549 | 187 | py |
FusedChat | FusedChat-main/pytorch_transformers/modeling_gpt2.py | # coding=utf-8
# Copyright 2018 The OpenAI Team Authors and 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 copy of the License... | 52,864 | 49.978785 | 136 | py |
FusedChat | FusedChat-main/pytorch_transformers/modeling_openai.py | # coding=utf-8
# Copyright 2018 The OpenAI Team Authors and 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 copy of the License... | 34,865 | 47.49235 | 140 | py |
FusedChat | FusedChat-main/pytorch_transformers/tokenization_bert.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and 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/LICEN... | 19,369 | 43.324943 | 183 | py |
FusedChat | FusedChat-main/pytorch_transformers/convert_xlnet_checkpoint_to_pytorch.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... | 4,354 | 40.47619 | 126 | py |
FusedChat | FusedChat-main/pytorch_transformers/convert_xlm_checkpoint_to_pytorch.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... | 2,950 | 37.828947 | 117 | py |
FusedChat | FusedChat-main/pytorch_transformers/convert_transfo_xl_checkpoint_to_pytorch.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... | 5,696 | 46.87395 | 121 | py |
FusedChat | FusedChat-main/pytorch_transformers/file_utils.py | """
Utilities for working with the local dataset cache.
This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp
Copyright by the AllenNLP authors.
"""
from __future__ import (absolute_import, division, print_function, unicode_literals)
import sys
import json
import logging
import os
impor... | 8,887 | 33.05364 | 98 | py |
FusedChat | FusedChat-main/pytorch_transformers/convert_tf_checkpoint_to_pytorch.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... | 2,596 | 38.348485 | 102 | py |
FusedChat | FusedChat-main/pytorch_transformers/modeling_transfo_xl.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University 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 Lice... | 58,595 | 41.770803 | 157 | py |
FusedChat | FusedChat-main/pytorch_transformers/modeling_xlnet.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University 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 Lice... | 63,793 | 48.414407 | 169 | py |
FusedChat | FusedChat-main/pytorch_transformers/modeling_xlm.py | # coding=utf-8
# Copyright 2019-present, Facebook, Inc and 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
#
# Un... | 45,103 | 47.91974 | 151 | py |
FusedChat | FusedChat-main/pytorch_transformers/tokenization_transfo_xl.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University 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 Lice... | 21,482 | 36.623468 | 110 | py |
FusedChat | FusedChat-main/pytorch_transformers/convert_pytorch_checkpoint_to_tf.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... | 4,343 | 32.160305 | 87 | py |
FusedChat | FusedChat-main/pytorch_transformers/modeling_transfo_xl_utilities.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University 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 Lice... | 13,558 | 39.717718 | 132 | py |
FusedChat | FusedChat-main/pytorch_transformers/caire_adapter.py | from transformers import GPT2Model, GPT2Tokenizer, GPT2PreTrainedModel
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import CrossEntropyLoss
torch.manual_seed(100)
torch.cuda.manual_seed(100)
class Adapter(nn.Module):
def __init__(self, config, bottleneck):
super(Adapte... | 9,714 | 41.986726 | 119 | py |
DMWeeds | DMWeeds-main/compute_sim.py | # modified from https://github.com/Derekabc/CottonWeeds/tree/master/Image_Similarity
from __future__ import print_function, division
import os
from os import walk
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
import argparse
import os
from pathlib import Path
from PIL import I... | 7,226 | 39.374302 | 144 | py |
DMWeeds | DMWeeds-main/inception.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
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://download.tenso... | 12,193 | 36.06383 | 140 | py |
DMWeeds | DMWeeds-main/improved_precision_recall.py | # modified from https://github.com/youngjung/improved-precision-and-recall-metric-pytorch
from __future__ import print_function, division
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
from functools import partial
from collections import namedtuple
from glob import ... | 14,658 | 36.017677 | 165 | py |
DMWeeds | DMWeeds-main/inception_score.py | # modified from https://github.com/sbarratt/inception-score-pytorch
from __future__ import print_function, division
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
import torch
from torch import nn
from torch.autograd import Variable
from torch.nn import functional as ... | 3,362 | 30.726415 | 136 | py |
DMWeeds | DMWeeds-main/fid_score.py | """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 as a stand-alone progr... | 10,636 | 35.806228 | 79 | py |
DMWeeds | DMWeeds-main/dataset/prepare_dataset.py | """
Partition dataset of images into training, validation and testing sets
Dong Chen (chendon9@msu.edu, 2022-07-23)
"""
import os
from shutil import copyfile
import argparse
import math
import random
from os import walk
def iterate_dir(source, dest, ratio_list):
for item in os.listdir(source):
# generate... | 2,871 | 34.45679 | 110 | py |
DMWeeds | DMWeeds-main/train_classifier/TL_eval.py | import argparse
import os, csv
def parse_args():
parser = argparse.ArgumentParser(description='Test CottonWeed Classifier')
parser.add_argument('--model_name', type=str, required=False, default='densenet121',
help="choose a deep learning model")
parser.add_argument('--EVAL_DIR', ty... | 6,263 | 35.631579 | 126 | py |
DMWeeds | DMWeeds-main/train_classifier/TL_training.py | """
Training weed classification models with transfer learning
Dong Chen (chendon9@msu.edu, 2022-07-23)
"""
import csv
import argparse
from efficientnet_pytorch import EfficientNet
import pretrainedmodels # for inception-v4 and xception
def parse_args():
parser = argparse.ArgumentParser(description='Train Cotton... | 13,275 | 37.149425 | 126 | py |
cgae-invar | cgae-invar-master/cgae.py | """
Created on April 13, 2018
@author: Stefan Lattner
Sony CSL Paris, France
Institute for Computational Perception, Johannes Kepler University, Linz
Austrian Research Institute for Artificial Intelligence, Vienna
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from util import to_numpy, cud... | 3,358 | 38.05814 | 79 | py |
cgae-invar | cgae-invar-master/util.py | """
Created on April 13, 2018
@author: Gaetan Hadjeres & Stefan Lattner
Sony CSL Paris, France
"""
import torch
from torch.autograd import Variable
def cuda_tensor(data):
if torch.cuda.is_available():
return torch.FloatTensor(data).cuda()
else:
return torch.FloatTensor(data)
def cuda_variab... | 721 | 20.235294 | 57 | py |
cgae-invar | cgae-invar-master/convert.py | #!/usr/bin/env python
"""
Created on April 13, 2018
@author: Stefan Lattner
Sony CSL Paris, France
Institute for Computational Perception, Johannes Kepler University, Linz
Austrian Research Institute for Artificial Intelligence, Vienna
"""
import argparse
import sys
import torch
import torch.nn.functional as F
f... | 3,460 | 31.650943 | 77 | py |
cgae-invar | cgae-invar-master/cqt.py | """
Created on April 13, 2018
@author: Stefan Lattner & Maarten Grachten
Sony CSL Paris, France
Institute for Computational Perception, Johannes Kepler University, Linz
Austrian Research Institute for Artificial Intelligence, Vienna
"""
import bz2
import logging
import os
import pickle
from functools import partial... | 9,602 | 31.333333 | 86 | py |
cgae-invar | cgae-invar-master/train.py | #!/usr/bin/env python
"""
Created on April 13, 2018
@author: Stefan Lattner
Sony CSL Paris, France
Institute for Computational Perception, Johannes Kepler University, Linz
Austrian Research Institute for Artificial Intelligence, Vienna
"""
import argparse
from random import randint
import torch
import torch.nn.fu... | 7,349 | 34.167464 | 79 | py |
cgae-invar | cgae-invar-master/regularize.py | """
Created on April 13, 2018
@author: Stefan Lattner
Sony CSL Paris, France
Institute for Computational Perception, Johannes Kepler University, Linz
Austrian Research Institute for Artificial Intelligence, Vienna
"""
import torch
def lee_loss(act):
"""
Lee sparsity and selectivity regularization on hidde... | 731 | 21.181818 | 72 | py |
AutoInitialization | AutoInitialization-master/scene_classifier.py | import os
import torch
import torchvision
import torchvision.transforms as transforms
from torch.utils.data import DataLoader
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
from skimage import io, transform
import pdb
import csv
class SceneClassificationDataset:
... | 3,704 | 28.404762 | 85 | py |
keras-vggface | keras-vggface-master/test.py | import numpy as np
from keras_vggface import VGGFace
from keras.preprocessing import image
from keras_vggface import utils
import keras
import unittest
class VGGFaceTests(unittest.TestCase):
def testVGG16(self):
keras.backend.image_data_format()
model = VGGFace(model='vgg16')
img = image.... | 2,164 | 37.660714 | 94 | py |
keras-vggface | keras-vggface-master/setup.py | from setuptools import setup, find_packages
exec(open('keras_vggface/version.py').read())
setup(
name='keras_vggface',
version=__version__,
description='VGGFace implementation with Keras framework',
url='https://github.com/rcmalli/keras-vggface',
author='Refik Can MALLI',
author_email="mallir@it... | 766 | 33.863636 | 121 | py |
keras-vggface | keras-vggface-master/tools/draw_networks.py | from keras.utils import plot_model
from keras_vggface import VGGFace
model = VGGFace(model='vgg16')
plot_model(model, to_file='vgg16.png', show_shapes=True)
model = VGGFace(model='resnet50')
plot_model(model, to_file='resnet50.png', show_shapes=True)
model = VGGFace(model='senet50')
plot_model(model, to_file='senet5... | 345 | 30.454545 | 59 | py |
keras-vggface | keras-vggface-master/keras_vggface/vggface.py | '''VGGFace models for Keras.
# Reference:
- [Deep Face Recognition](http://www.robots.ox.ac.uk/~vgg/publications/2015/Parkhi15/parkhi15.pdf)
- [VGGFace2: A dataset for recognising faces across pose and age](http://www.robots.ox.ac.uk/~vgg/data/vgg_face2/vggface2.pdf)
'''
from __future__ import print_function
from ker... | 4,683 | 40.821429 | 126 | py |
keras-vggface | keras-vggface-master/keras_vggface/utils.py | '''VGGFace models for Keras.
# Notes:
- Utility functions are modified versions of Keras functions [Keras](https://keras.io)
'''
import numpy as np
from keras import backend as K
from keras.utils.data_utils import get_file
V1_LABELS_PATH = 'https://github.com/rcmalli/keras-vggface/releases/download/v2.0/rcmalli_v... | 3,829 | 38.081633 | 133 | py |
keras-vggface | keras-vggface-master/keras_vggface/version.py | __version__ = '0.6'
def pretty_versions():
import keras
import tensorflow as tf
k_version = keras.__version__
t_version = tf.__version__
return "keras-vggface : {}, keras : {} , tensorflow : {} ".format(__version__,k_version,t_version) | 256 | 31.125 | 102 | py |
keras-vggface | keras-vggface-master/keras_vggface/models.py | '''VGGFace models for Keras.
# Notes:
- Resnet50 and VGG16 are modified architectures from Keras Application folder. [Keras](https://keras.io)
- Squeeze and excitation block is taken from [Squeeze and Excitation Networks in
Keras](https://github.com/titu1994/keras-squeeze-excite-network) and modified.
'''
from ... | 20,952 | 39.528046 | 105 | py |
keras-vggface | keras-vggface-master/keras_vggface/__init__.py | from keras_vggface.vggface import VGGFace
from keras_vggface.version import __version__ | 87 | 43 | 45 | py |
compression | compression-master/models/bmshj2018.py | # Copyright 2019 Google LLC. 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 or a... | 21,060 | 38.219739 | 80 | py |
compression | compression-master/models/ms2020.py | # Copyright 2020 Google LLC. 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 or a... | 28,489 | 38.459834 | 80 | py |
compression | compression-master/models/bls2017.py | # Copyright 2018 Google LLC. 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 or a... | 17,094 | 36.820796 | 80 | py |
compression | compression-master/models/hific/archs.py | # Copyright 2020 Google LLC. 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 or a... | 22,459 | 31.645349 | 80 | py |
compression | compression-master/models/hific/model.py | # Copyright 2020 Google LLC. 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 or a... | 33,890 | 36.740535 | 80 | py |
compression | compression-master/models/toy_sources/compression_model.py | # Copyright 2020 Google LLC. 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 or a... | 7,806 | 34.648402 | 80 | py |
compression | compression-master/tensorflow_compression/python/layers/initializers.py | # Copyright 2018 Google LLC. 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 or a... | 1,900 | 32.946429 | 80 | py |
compression | compression-master/tensorflow_compression/python/layers/gdn_test.py | # Copyright 2018 Google LLC. 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 or a... | 8,662 | 39.293023 | 80 | py |
compression | compression-master/tensorflow_compression/python/layers/parameters_test.py | # Copyright 2018 Google LLC. 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 or a... | 3,541 | 37.923077 | 80 | py |
compression | compression-master/tensorflow_compression/python/layers/soft_round.py | # Copyright 2020 Google LLC. 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 or a... | 1,739 | 29.526316 | 80 | py |
compression | compression-master/tensorflow_compression/python/layers/gdn.py | # Copyright 2018 Google LLC. 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 or a... | 18,268 | 37.787686 | 80 | py |
compression | compression-master/tensorflow_compression/python/layers/signal_conv_test.py | # Copyright 2018 Google LLC. 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 or a... | 27,779 | 36.59134 | 80 | py |
compression | compression-master/tensorflow_compression/python/layers/parameters.py | # Copyright 2018 Google LLC. 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 or a... | 10,281 | 37.081481 | 80 | py |
compression | compression-master/tensorflow_compression/python/layers/signal_conv.py | # Copyright 2018 Google LLC. 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 or a... | 42,415 | 39.473282 | 81 | py |
compression | compression-master/tensorflow_compression/python/layers/__init__.py | # Copyright 2022 Google LLC. 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 or a... | 1,032 | 45.954545 | 80 | py |
compression | compression-master/tensorflow_compression/python/entropy_models/power_law_test.py | # Copyright 2022 Google LLC. 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 or a... | 4,947 | 39.227642 | 87 | py |
compression | compression-master/tensorflow_compression/python/entropy_models/continuous_base.py | # Copyright 2020 Google LLC. 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 or a... | 15,033 | 39.522911 | 80 | py |
compression | compression-master/tensorflow_compression/python/entropy_models/continuous_indexed.py | # Copyright 2020 Google LLC. 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 or a... | 28,876 | 44.547319 | 80 | py |
compression | compression-master/tensorflow_compression/python/entropy_models/power_law.py | # Copyright 2022 Google LLC. 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 or a... | 7,853 | 36.4 | 80 | py |
compression | compression-master/tensorflow_compression/python/entropy_models/continuous_batched_test.py | # Copyright 2020 Google LLC. 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 or a... | 12,456 | 43.809353 | 105 | py |
compression | compression-master/tensorflow_compression/python/entropy_models/universal.py | # Copyright 2020 Google LLC. 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 or a... | 26,818 | 43.402318 | 80 | py |
compression | compression-master/tensorflow_compression/python/entropy_models/continuous_indexed_test.py | # Copyright 2020 Google LLC. 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 or a... | 11,471 | 42.290566 | 80 | py |
compression | compression-master/tensorflow_compression/python/entropy_models/continuous_batched.py | # Copyright 2020 Google LLC. 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 or a... | 20,869 | 46.757437 | 80 | py |
LASER | LASER-main/source/mine_bitexts.py | #!/usr/bin/python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
# LASER Language-Agnostic SEntence Representations
# is a toolkit to calculate multilingual ... | 11,568 | 37.181518 | 105 | py |
LASER | LASER-main/source/embed.py | #!/usr/bin/python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
# LASER Language-Agnostic SEntence Representations
# is a toolkit to calculate multilingual ... | 20,681 | 31.724684 | 96 | py |
LASER | LASER-main/source/sent_classif.py | #!/usr/bin/python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
# LASER Language-Agnostic SEntence Representations
# is a toolkit to calculate multilingual s... | 9,353 | 33.138686 | 87 | py |
LASER | LASER-main/source/nli.py | #!/usr/bin/python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
# LASER Language-Agnostic SEntence Representations
# is a toolkit to calculate multilingual s... | 13,628 | 35.637097 | 108 | py |
CoReSeg | CoReSeg-main/CoReSeg.py | import torch
import torch.nn.functional as F
from torch import nn
def model_unique_name(net, separator=';'):
if type(net.hidden_classes) == str:
hidden_name = net.hidden_classes
else:
hidden_name= '_'.join([str(i) for i in net.hidden_classes])
parts_list= [net.name, str(net.input_... | 22,871 | 45.112903 | 276 | py |
CoReSeg | CoReSeg-main/base.py | from os import listdir
from os.path import isfile, join
import os
from skimage import io
from skimage import util
from skimage import transform
from sklearn import metrics
from torch.utils import data
from torch import nn
from torch.utils.data import DataLoader
import torch.nn.functional as F
from argparse import Argum... | 74,829 | 44.406553 | 463 | py |
PGML | PGML-main/airfoil_dnn_allmodels.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 3 10:01:23 2020
@author: suraj
"""
# import all necessary libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from panel_allairfoil import panel
import tensorflow as tf
from tensorflow.keras.models import Model
from t... | 22,434 | 33.621914 | 221 | py |
PGML | PGML-main/PGML-BL/OpenFoam_Laminar/laminarFlatPlate/Different_Reynolds_Number/ml_v2.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 9 15:26:04 2021
@author: suraj
"""
import pyvista as pv
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, Dense, ... | 4,247 | 22.213115 | 91 | py |
PGML | PGML-main/PGML-BL/OpenFoam_Laminar/laminarFlatPlate/Different_Reynolds_Number/ml.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 9 15:26:04 2021
@author: suraj
"""
import pyvista as pv
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, Dense, ... | 3,648 | 22.849673 | 91 | py |
PGML | PGML-main/PGML-BL/OpenFoam_Laminar/laminarFlatPlate/Different_Reynolds_Number/deep_ensemble_regressor.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 14 13:54:36 2021
@author: suraj
"""
import numpy as np
import keras
from numpy.random import seed
seed(10)
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Dense, Input
import tensorflow.keras.b... | 6,467 | 25.617284 | 123 | py |
PGML | PGML-main/PGML-BL/OpenFoam_Laminar/laminarFlatPlate/Different_Reynolds_Number/deep_ensemble_regressor_pg.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 14 13:54:36 2021
@author: suraj
"""
import numpy as np
import keras
from numpy.random import seed
seed(10)
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Dense, Input
from tensorflow.keras.lay... | 7,768 | 25.246622 | 123 | py |
isbiased | isbiased-main/setup.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
from setuptools import setup, find_packages
with open("README.md", "r", encoding="utf-8") as fh:
readme = fh.read()
setup(
name="isbiased",
version='0.0.1',
description="IsBiased: A library to measure known biases of Question answering models.",
long_d... | 1,305 | 25.12 | 92 | py |
isbiased | isbiased-main/scripts/evaluate_model.py | import torch.cuda
from datasets import load_metric, load_dataset
from tqdm import tqdm
from transformers import AutoModelForQuestionAnswering, AutoTokenizer
model_path = "/Users/xstefan3/PycharmProjects/isbiased/models/biased/distances/bert-base-cased"
split = "validation"
# dataset = load_dataset("adversarial_qa", "... | 1,302 | 39.71875 | 109 | py |
isbiased | isbiased-main/debiasing_methods/confidenceRegularization/train_and_predict_parent.py | import argparse
import os
from datasets import load_dataset
from transformers import AutoTokenizer, AutoModelForQuestionAnswering, DefaultDataCollator, TrainingArguments, Trainer, \
EarlyStoppingCallback
import torch
import pandas as pd
from debiasing_methods.confidenceRegularization.utils import prepare_train_... | 7,760 | 41.642857 | 140 | py |
isbiased | isbiased-main/debiasing_methods/confidenceRegularization/train_creg.py | import argparse
import pandas as pd
from datasets import load_dataset, Dataset
from pandas import DataFrame
from tqdm import tqdm
from transformers import AutoTokenizer, AutoModelForQuestionAnswering, DefaultDataCollator, TrainingArguments, \
PreTrainedModel, EarlyStoppingCallback
from debiasing_methods.confidenc... | 10,591 | 44.655172 | 119 | py |
isbiased | isbiased-main/debiasing_methods/confidenceRegularization/train_and_predict_biased.py | import argparse
import os
from datasets import load_dataset, load_from_disk
from transformers import AutoTokenizer, AutoModelForQuestionAnswering, DefaultDataCollator, TrainingArguments, Trainer,\
EarlyStoppingCallback
import torch
import pandas as pd
from debiasing_methods.confidenceRegularization.utils import... | 10,840 | 43.797521 | 120 | py |
isbiased | isbiased-main/debiasing_methods/confidenceRegularization/overrides/trainers.py | import math
from typing import Optional, List, Union, Callable, Dict, Tuple
import torch
from datasets import Dataset
from torch import nn
from transformers import Trainer, PreTrainedModel, TrainingArguments, DataCollator, PreTrainedTokenizerBase, \
TrainerCallback
from transformers.trainer_utils import Prediction... | 3,287 | 41.153846 | 110 | py |
isbiased | isbiased-main/debiasing_methods/confidenceRegularization/overrides/loss.py | import torch
from torch import nn
from torch.nn import functional as F
from torch.nn import CrossEntropyLoss
import numpy as np
import math
from torch.nn.functional import log_softmax, softmax
class ClfDistillLossFunction(nn.Module):
"""Torch classification debiasing loss function"""
def forward(self, logit... | 1,717 | 34.061224 | 111 | py |
isbiased | isbiased-main/debiasing_methods/confidenceRegularization/overrides/models.py | from typing import Optional, Union, Tuple
import torch
from torch import nn
from torch.nn import CrossEntropyLoss
from transformers import BertModel, BertPreTrainedModel, RobertaPreTrainedModel, RobertaModel, ElectraPreTrainedModel, \
ElectraConfig, ElectraModel, BertForQuestionAnswering
from transformers.modelin... | 15,193 | 44.220238 | 120 | py |
isbiased | isbiased-main/debiasing_methods/learnedMixinH/loss.py | import torch
from torch import nn
class ClfDistillLossFunction(nn.Module):
"""Torch classification debiasing loss function"""
def forward(self, logits, bias, teach_probs, labels):
"""
:param logits: [batch, n_classes] logit score for each class
:param bias: [batch, n_classes] log-prob... | 1,811 | 35.979592 | 98 | py |
isbiased | isbiased-main/debiasing_methods/learnedMixinH/model.py | from typing import Callable, Optional, Tuple, Union
import torch
from torch import nn
from transformers import BertForQuestionAnswering, BertModel
from transformers.modeling_outputs import QuestionAnsweringModelOutput
class LMixBertForQuestionAnswering(BertForQuestionAnswering):
"""
Pre-trained Distilled Ber... | 5,238 | 44.163793 | 118 | py |
isbiased | isbiased-main/debiasing_methods/learnedMixinH/train_lmix.py | import argparse
from typing import Tuple
import torch
from datasets import load_dataset, Dataset
import evaluate
from tqdm import tqdm
from transformers import AutoTokenizer, AutoModelForQuestionAnswering, DefaultDataCollator, TrainingArguments, \
PreTrainedModel, Trainer, EvalPrediction
from learnedMixinH.loss i... | 9,609 | 42.484163 | 117 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.