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 |
|---|---|---|---|---|---|---|
ZenNAS | ZenNAS-main/global_utils.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import os
import distutils.dir_util
import pprint, ast, argparse, logging
import numpy as np
import torch
def load_py_module_from_path(module_path, module_name=None):
if module_path.find(':') > 0:
split_path = module_path.split(':')
m... | 12,853 | 42.721088 | 161 | py |
ZenNAS | ZenNAS-main/hotfix/vision.py | import os
import torch
import torch.utils.data as data
class VisionDataset(data.Dataset):
_repr_indent = 4
def __init__(self, root, transforms=None, transform=None, target_transform=None):
if isinstance(root, torch._six.string_classes):
root = os.path.expanduser(root)
self.root = ... | 2,918 | 35.037037 | 86 | py |
ZenNAS | ZenNAS-main/hotfix/folder.py | from .vision import VisionDataset
from PIL import Image
import os
import os.path
import sys
def has_file_allowed_extension(filename, extensions):
"""Checks if a file is an allowed extension.
Args:
filename (string): path to a file
extensions (tuple of strings): extensions to consider (lower... | 7,417 | 34.156398 | 113 | py |
ZenNAS | ZenNAS-main/hotfix/transforms.py | import torch
import math
import sys
import random
from PIL import Image
import numpy as np
import numbers
import types
import collections
import warnings
def erase(img, i, j, h, w, v, inplace=False):
""" Erase the input Tensor Image with given value.
Args:
img (Tensor Image): Tensor image of size (C,... | 4,596 | 35.776 | 102 | py |
ZenNAS | ZenNAS-main/ModelLoader/__init__.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
The geffnet module is modified from:
https://github.com/rwightman/gen-efficientnet-pytorch
'''
import os,sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from . impo... | 3,081 | 36.585366 | 113 | py |
ZenNAS | ZenNAS-main/ModelLoader/myresnet.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
This file is modified from:
https://pytorch.org/vision/0.8/_modules/torchvision/models/resnet.html
'''
import argparse
import torch
import torch.nn as nn
# from .utils import load_state_dict_from_url
from torch.nn import functional as F
__all__ = ['ResN... | 20,184 | 36.799625 | 107 | py |
ZenNAS | ZenNAS-main/ModelLoader/geffnet/efficientnet_builder.py | """ EfficientNet / MobileNetV3 Blocks and Builder
Copyright 2020 Ross Wightman
"""
import re
from copy import deepcopy
from .conv2d_layers import *
from geffnet.activations import *
__all__ = ['get_bn_args_tf', 'resolve_bn_args', 'resolve_se_args', 'resolve_act_layer', 'make_divisible',
'round_channels', ... | 26,514 | 37.76462 | 124 | py |
ZenNAS | ZenNAS-main/ModelLoader/geffnet/conv2d_layers.py | """ Conv2D w/ SAME padding, CondConv, MixedConv
A collection of conv layers and padding helpers needed by EfficientNet, MixNet, and
MobileNetV3 models that maintain weight compatibility with original Tensorflow models.
Copyright 2020 Ross Wightman
"""
import torch
import torch.nn as nn
import torch.nn.functional as F... | 12,105 | 38.822368 | 119 | py |
ZenNAS | ZenNAS-main/ModelLoader/geffnet/gen_efficientnet.py | """ Generic Efficient Networks
A generic MobileNet class with building blocks to support a variety of models:
* EfficientNet (B0-B8, L2 + Tensorflow pretrained AutoAug/RandAug/AdvProp/NoisyStudent ports)
- EfficientNet: Rethinking Model Scaling for CNNs - https://arxiv.org/abs/1905.11946
- CondConv: Conditionally... | 60,852 | 40.033715 | 144 | py |
ZenNAS | ZenNAS-main/ModelLoader/geffnet/mobilenetv3.py | """ MobileNet-V3
A PyTorch impl of MobileNet-V3, compatible with TF weights from official impl.
Paper: Searching for MobileNetV3 - https://arxiv.org/abs/1905.02244
Hacked together by / Copyright 2020 Ross Wightman
"""
import torch.nn as nn
import torch.nn.functional as F
from .activations import get_act_fn, get_act... | 15,009 | 40.123288 | 137 | py |
ZenNAS | ZenNAS-main/ModelLoader/geffnet/config.py | """ Global layer config state
"""
from typing import Any, Optional
__all__ = [
'is_exportable', 'is_scriptable', 'is_no_jit', 'layer_config_kwargs',
'set_exportable', 'set_scriptable', 'set_no_jit', 'set_layer_config'
]
# Set to True if prefer to have layers with no jit optimization (includes activations)
_NO... | 3,350 | 26.024194 | 102 | py |
ZenNAS | ZenNAS-main/ModelLoader/geffnet/__init__.py | '''
The geffnet module is modified from:
https://github.com/rwightman/gen-efficientnet-pytorch
'''
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from .gen_efficientnet import *
from .mobilenetv3 import *
from .model_factory import create_model
from .confi... | 416 | 31.076923 | 93 | py |
ZenNAS | ZenNAS-main/ModelLoader/geffnet/helpers.py | """ Checkpoint loading / state_dict helpers
Copyright 2020 Ross Wightman
"""
import torch
import os
from collections import OrderedDict
try:
from torch.hub import load_state_dict_from_url
except ImportError:
from torch.utils.model_zoo import load_url as load_state_dict_from_url
def load_checkpoint(model, chec... | 2,833 | 38.361111 | 107 | py |
ZenNAS | ZenNAS-main/ModelLoader/geffnet/activations/activations_jit.py | """ Activations (jit)
A collection of jit-scripted activations fn and modules with a common interface so that they can
easily be swapped. All have an `inplace` arg even if not used.
All jit scripted activations are lacking in-place variations on purpose, scripted kernel fusion does not
currently work across in-place ... | 2,294 | 27.6875 | 107 | py |
ZenNAS | ZenNAS-main/ModelLoader/geffnet/activations/activations_me.py | """ Activations (memory-efficient w/ custom autograd)
A collection of activations fn and modules with a common interface so that they can
easily be swapped. All have an `inplace` arg even if not used.
These activations are not compatible with jit scripting or ONNX export of the model, please use either
the JIT or bas... | 4,549 | 25 | 108 | py |
ZenNAS | ZenNAS-main/ModelLoader/geffnet/activations/activations.py | """ Activations
A collection of activations fn and modules with a common interface so that they can
easily be swapped. All have an `inplace` arg even if not used.
Copyright 2020 Ross Wightman
"""
from torch import nn as nn
from torch.nn import functional as F
def swish(x, inplace: bool = False):
"""Swish - Desc... | 2,690 | 25.126214 | 107 | py |
ZenNAS | ZenNAS-main/ModelLoader/geffnet/activations/__init__.py | from geffnet import config
from geffnet.activations.activations_me import *
from geffnet.activations.activations_jit import *
from geffnet.activations.activations import *
_ACT_FN_DEFAULT = dict(
swish=swish,
mish=mish,
relu=F.relu,
relu6=F.relu6,
sigmoid=sigmoid,
tanh=tanh,
hard_sigmoid=h... | 3,275 | 25.634146 | 104 | py |
ZenNAS | ZenNAS-main/DataLoader/__init__.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import torch
import torch.utils.data
import torch.utils.data.distributed
import torchvision.transforms as transforms
import torchvision.datasets as datasets
import... | 12,961 | 40.149206 | 137 | py |
ZenNAS | ZenNAS-main/ZenNet/__init__.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import os, sys
this_script_dir = os.path.dirname(os.path.abspath(__file__))
from . import masternet
import global_utils
import torch
import urllib.request
pretrain_model_pth_dir = os.path.expanduser('~/.cache/pytorch/checkpoints/zennet_pretrained')
zen... | 9,437 | 45.492611 | 181 | py |
ZenNAS | ZenNAS-main/ZenNet/masternet.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import numpy as np
import torch, argparse
from torch import nn
import torch.nn.functional as F
import PlainNet
from PlainNet import parse_cmd_options, basic_block... | 7,674 | 36.622549 | 128 | py |
ZenNAS | ZenNAS-main/ZeroShotProxy/compute_zen_score.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import torch
from torch import nn
import numpy as np
import global_utils, argparse, ModelLoader, time
def network_weight_gaussian_init(net: nn.Module):
with ... | 3,997 | 37.07619 | 128 | py |
ZenNAS | ZenNAS-main/ZeroShotProxy/compute_syncflow_score.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
This file is modified from
https://github.com/SamsungLabs/zero-cost-nas
'''
# Copyright 2021 Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#... | 4,110 | 28.57554 | 81 | py |
ZenNAS | ZenNAS-main/ZeroShotProxy/compute_NASWOT_score.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
The implementation of NASWOT score is modified from:
https://github.com/BayesWatch/nas-without-training
'''
import os, sys, time
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import torch
from torch import nn
import numpy as n... | 4,059 | 31.48 | 108 | py |
ZenNAS | ZenNAS-main/ZeroShotProxy/compute_gradnorm_score.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import os, sys, time
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import torch
from torch import nn
import numpy as np
def network_weight_gaussian_init(net: nn.Module):
with torch.no_grad():
for m in net.module... | 2,261 | 28.376623 | 113 | py |
ZenNAS | ZenNAS-main/ZeroShotProxy/compute_te_nas_score.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
This file is modified from:
https://github.com/VITA-Group/TENAS
'''
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import torch
from torch import nn
import global_utils, argparse, ModelLoader, time
class LinearRe... | 11,065 | 37.82807 | 176 | py |
ZenNAS | ZenNAS-main/PlainNet/basic_blocks.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import torch
from torch import nn
import torch.nn.functional as F
import numpy as np
import uuid
from PlainNet import _get_right_parentheses_index_, _create_netb... | 55,317 | 35.780585 | 147 | py |
ZenNAS | ZenNAS-main/PlainNet/SuperResIDWEXKX.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import uuid
import PlainNet
from PlainNet import _get_right_parentheses_index_
from PlainNet.super_blocks import PlainNetSuperBlockClass
from torch import nn
impo... | 14,751 | 53.03663 | 143 | py |
ZenNAS | ZenNAS-main/PlainNet/SuperResK1KXK1.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import uuid
import PlainNet
from PlainNet import _get_right_parentheses_index_
from PlainNet.super_blocks import PlainNetSuperBlockClass
from torch import nn
impo... | 9,365 | 46.065327 | 143 | py |
ZenNAS | ZenNAS-main/PlainNet/super_blocks.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import torch
from torch import nn
import torch.nn.functional as F
import numpy as np
import uuid
import global_utils
import PlainNet
from PlainNet import _get_ri... | 9,413 | 41.405405 | 130 | py |
ZenNAS | ZenNAS-main/PlainNet/SuperResKXKX.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import uuid
import PlainNet
from PlainNet import _get_right_parentheses_index_
from PlainNet.super_blocks import PlainNetSuperBlockClass
from torch import nn
impo... | 7,891 | 44.097143 | 143 | py |
ZenNAS | ZenNAS-main/PlainNet/__init__.py | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import torch, argparse
from torch import nn
_all_netblocks_dict_ = {}
def parse_cmd_options(argv, opt=None):
parser = argparse.ArgumentParser()
parser.a... | 10,163 | 34.16955 | 109 | py |
GPflow | GPflow-master/tests/gpflow/utilities/test_traversal.py | # Copyright 2018 the GPflow authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | 21,264 | 47.550228 | 126 | py |
GPflow | GPflow-master/doc/sphinx/conf.py | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
from pathlib import Path
from typing import Sequence
# -- Path setup ------------------... | 3,109 | 32.085106 | 97 | py |
GPflow | GPflow-master/doc/sphinx/notebooks/advanced/natural_gradients.pct.py | # ---
# jupyter:
# jupytext:
# formats: ipynb,.pct.py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.3.3
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown]
... | 12,256 | 27.307159 | 246 | py |
GPflow | GPflow-master/doc/sphinx/notebooks/tailor/gp_nn.pct.py | # ---
# jupyter:
# jupytext:
# formats: ipynb,.pct.py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.3.3
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown]
... | 6,136 | 28.363636 | 134 | py |
GPflow | GPflow-master/doc/sphinx/notebooks/tailor/mixture_density_network.pct.py | # ---
# jupyter:
# jupytext:
# formats: ipynb,.pct.py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.14.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown]... | 11,234 | 41.718631 | 626 | py |
GPflow | GPflow-master/doc/sphinx/notebooks/tailor/external-mean-function.pct.py | # -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: ipynb,.pct.py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.3.3
# kernelspec:
# display_name: Python 3
# language: python
# name: python3... | 10,648 | 35.098305 | 434 | py |
GPflow | GPflow-master/doc/sphinx/notebooks/getting_started/monitoring.pct.py | # ---
# jupyter:
# jupytext:
# formats: py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.14.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %%
# remove-cell
# pylin... | 7,902 | 28.822642 | 390 | py |
GPflow | GPflow-master/doc/sphinx/notebooks/getting_started/parameters_and_their_optimisation.pct.py | # ---
# jupyter:
# jupytext:
# formats: py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.14.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %%
# remove-cell
# pylin... | 19,452 | 36.337812 | 667 | py |
GPflow | GPflow-master/gpflow/utilities/traversal.py | # Copyright 2017-2021 The GPflow Contributors. 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 appli... | 13,979 | 37.512397 | 151 | py |
GPflow | GPflow-master/gpflow/utilities/misc.py | # Copyright 2017-2021 The GPflow Contributors. 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 appli... | 3,724 | 33.490741 | 99 | py |
datasketch | datasketch-master/docs/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# datasketch documentation build configuration file, created by
# sphinx-quickstart on Mon Mar 6 17:33:33 2017.
#
# 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
#... | 10,948 | 27.365285 | 80 | py |
lr-identify | lr-identify-main/tensorflow/Layers/layers.py | import timeit
import numpy as np
import tensorflow as tf
import operations as op
import math
from tensorflow.python.keras import activations
from tensorflow.python.keras import initializers
from tensorflow.python.keras import regularizers
from tensorflow.python.keras.utils import conv_utils
from Metrics import function... | 8,025 | 34.201754 | 78 | py |
lr-identify | lr-identify-main/tensorflow/Models/knet.py | import numpy as np
import tensorflow as tf
from model_utils import batch_norm_relu
from Layers import layers as custom_layers
from collections import OrderedDict
from Metrics import observables_config as ocfg
def knet(inputs,
num_classes,
train=True,
weight_decay=1e-5,
norm=True,
... | 7,696 | 42.732955 | 150 | py |
RECCON | RECCON-main/simpletransformers/language_modeling/language_modeling_model.py | #!/usr/bin/env python
# coding: utf-8
from __future__ import absolute_import, division, print_function
import json
import logging
import math
import os
import random
import warnings
from dataclasses import asdict
from multiprocessing import cpu_count
from typing import Dict, List
import numpy as np
import pandas as... | 53,499 | 44.962199 | 194 | py |
RECCON | RECCON-main/simpletransformers/language_modeling/language_modeling_utils.py | import logging
import os
import pickle
from multiprocessing import Pool
from typing import Tuple
import torch
from tokenizers.processors import BertProcessing
from torch.utils.data import Dataset
from tqdm.auto import tqdm
from transformers import PreTrainedTokenizer
logger = logging.getLogger(__name__)
def encode(... | 7,564 | 42.728324 | 119 | py |
RECCON | RECCON-main/simpletransformers/classification/classification_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... | 23,925 | 34.710448 | 136 | py |
RECCON | RECCON-main/simpletransformers/classification/classification_model.py | #!/usr/bin/env python
# coding: utf-8
from __future__ import absolute_import, division, print_function
import json
import logging
import math
import os
import random
import warnings
from dataclasses import asdict
from multiprocessing import cpu_count
import tempfile
from pathlib import Path
import numpy as np
impor... | 72,293 | 45.13529 | 214 | py |
RECCON | RECCON-main/simpletransformers/classification/multi_label_classification_model.py | import logging
import os
import random
import warnings
from multiprocessing import cpu_count
import numpy as np
import torch
from transformers import (
WEIGHTS_NAME,
AlbertConfig,
AlbertTokenizer,
BertConfig,
BertTokenizer,
CamembertConfig,
CamembertTokenizer,
DistilBertConfig,
Dist... | 9,635 | 38.983402 | 194 | py |
RECCON | RECCON-main/simpletransformers/classification/multi_modal_classification_model.py | #!/usr/bin/env python
# coding: utf-8
from __future__ import absolute_import, division, print_function
import json
import logging
import math
import os
import random
import warnings
from dataclasses import asdict
from multiprocessing import cpu_count
import numpy as np
import pandas as pd
import torch
from scipy.st... | 52,112 | 42.211443 | 194 | py |
RECCON | RECCON-main/simpletransformers/classification/transformer_models/xlm_model.py | import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.models.xlm.modeling_xlm import SequenceSummary, XLMModel, XLMPreTrainedModel
class XLMForSequenceClassification(XLMPreTrainedModel):
r"""
**labels**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size... | 3,855 | 44.364706 | 134 | py |
RECCON | RECCON-main/simpletransformers/classification/transformer_models/mmbt_model.py | import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.models.mmbt.modeling_mmbt import MMBTModel
class MMBTForClassification(nn.Module):
r"""
**labels**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size,)``:
Labels for computing the sequenc... | 4,073 | 43.769231 | 134 | py |
RECCON | RECCON-main/simpletransformers/classification/transformer_models/bert_model.py | import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.models.bert.modeling_bert import BertModel, BertPreTrainedModel
class BertForSequenceClassification(BertPreTrainedModel):
r"""
**labels**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size,)``:
... | 3,892 | 45.345238 | 134 | py |
RECCON | RECCON-main/simpletransformers/classification/transformer_models/camembert_model.py | from transformers.models.camembert.configuration_camembert import CamembertConfig
from transformers.models.camembert.modeling_camembert import CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST
from simpletransformers.classification.transformer_models.roberta_model import RobertaForSequenceClassification
class CamembertForSequ... | 2,544 | 69.694444 | 134 | py |
RECCON | RECCON-main/simpletransformers/classification/transformer_models/electra_model.py | import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.models.electra.modeling_electra import (
ElectraModel,
ElectraPreTrainedModel,
ElectraClassificationHead,
)
class ElectraForSequenceClassification(ElectraPreTrainedModel):
r"""
**labels**: (`opt... | 3,653 | 45.846154 | 134 | py |
RECCON | RECCON-main/simpletransformers/classification/transformer_models/xlnet_model.py | import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.models.xlnet.modeling_xlnet import SequenceSummary, XLNetModel, XLNetPreTrainedModel
class XLNetForSequenceClassification(XLNetPreTrainedModel):
r"""
**labels**: (`optional`) ``torch.LongTensor`` of shape `... | 4,526 | 48.206522 | 134 | py |
RECCON | RECCON-main/simpletransformers/classification/transformer_models/albert_model.py | import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.models.albert.modeling_albert import AlbertConfig, AlbertModel, AlbertPreTrainedModel
class AlbertForSequenceClassification(AlbertPreTrainedModel):
"""
**labels**: (`optional`) ``torch.LongTensor`` of shape... | 3,929 | 46.349398 | 134 | py |
RECCON | RECCON-main/simpletransformers/classification/transformer_models/distilbert_model.py | import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.models.distilbert.modeling_distilbert import DistilBertModel, DistilBertPreTrainedModel
class DistilBertForSequenceClassification(DistilBertPreTrainedModel):
r"""
**labels**: (`optional`) ``torch.LongTensor`` of shape `... | 3,929 | 56.794118 | 134 | py |
RECCON | RECCON-main/simpletransformers/classification/transformer_models/roberta_model.py | import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.models.roberta.modeling_roberta import (
ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
RobertaClassificationHead,
RobertaConfig,
RobertaModel,
)
from transformers import BertPreTrainedModel
class RobertaForSe... | 3,916 | 45.082353 | 134 | py |
RECCON | RECCON-main/simpletransformers/classification/transformer_models/flaubert_model.py | import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.models.flaubert.modeling_flaubert import FlaubertModel
from transformers.modeling_utils import SequenceSummary
class FlaubertForSequenceClassification(FlaubertModel):
r"""
**labels**: (`optional`) ``torch.L... | 3,921 | 44.604651 | 134 | py |
RECCON | RECCON-main/simpletransformers/classification/transformer_models/layoutlm_model.py | import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.models.bert.modeling_bert import BertPreTrainedModel
from transformers.models.layoutlm.modeling_layoutlm import LayoutLMModel
class LayoutLMForSequenceClassification(BertPreTrainedModel):
def __init__(self, config):
sup... | 1,830 | 31.122807 | 93 | py |
RECCON | RECCON-main/simpletransformers/config/model_args.py | import json
import os
import sys
from dataclasses import asdict, dataclass, field, fields
from multiprocessing import cpu_count
import warnings
from torch.utils.data import Dataset
def get_default_process_count():
process_count = cpu_count() - 2 if cpu_count() > 2 else 1
if sys.platform == "win32":
p... | 10,229 | 28.738372 | 111 | py |
RECCON | RECCON-main/simpletransformers/question_answering/question_answering_utils.py | from __future__ import absolute_import, division, print_function
import collections
import json
import linecache
import logging
import math
import mmap
import os
import re
import string
from functools import partial
from io import open
from multiprocessing import Pool, cpu_count
from pprint import pprint
import torch... | 74,641 | 37.775065 | 127 | py |
RECCON | RECCON-main/simpletransformers/question_answering/question_answering_model.py | from __future__ import absolute_import, division, print_function
import json
import logging
import math
import os
import random
import warnings
from dataclasses import asdict
from multiprocessing import cpu_count
import numpy as np
import pandas as pd
import torch
from scipy.stats import pearsonr
from sklearn.metrics... | 50,386 | 42.967714 | 178 | py |
RECCON | RECCON-main/simpletransformers/conv_ai/conv_ai_model.py | #!/usr/bin/env python
# coding: utf-8
from __future__ import absolute_import, division, print_function
import json
import logging
import math
import os
import random
import statistics
import warnings
from collections import defaultdict
from dataclasses import asdict
from itertools import chain
from multiprocessing i... | 48,349 | 44.271536 | 194 | py |
RECCON | RECCON-main/simpletransformers/conv_ai/conv_ai_utils.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 socket
import tarfile
import tempfile
from datetime import datetime
from multi... | 3,473 | 32.403846 | 115 | py |
RECCON | RECCON-main/simpletransformers/language_generation/language_generation_model.py | import argparse
import json
import logging
import os
import random
import numpy as np
import torch
from transformers import (
CTRLConfig,
CTRLLMHeadModel,
CTRLTokenizer,
GPT2Config,
GPT2LMHeadModel,
GPT2Tokenizer,
OpenAIGPTConfig,
OpenAIGPTLMHeadModel,
OpenAIGPTTokenizer,
Transf... | 8,300 | 37.78972 | 194 | py |
RECCON | RECCON-main/simpletransformers/language_representation/representation_model.py | #!/usr/bin/env python
# coding: utf-8
from __future__ import absolute_import, division, print_function
import logging
import random
import warnings
from functools import partial
import numpy as np
import torch
from tqdm.auto import tqdm
from transformers import BertConfig, BertTokenizer, GPT2Config, GPT2Tokenizer, ... | 7,997 | 38.99 | 214 | py |
RECCON | RECCON-main/simpletransformers/ner/ner_model.py | from __future__ import absolute_import, division, print_function
import json
import logging
import math
import os
import random
import warnings
from dataclasses import asdict
from multiprocessing import cpu_count
import tempfile
from pathlib import Path
import numpy as np
import pandas as pd
import torch
from scipy.s... | 59,119 | 44.758514 | 203 | py |
RECCON | RECCON-main/simpletransformers/ner/ner_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... | 16,585 | 36.440181 | 119 | py |
RECCON | RECCON-main/simpletransformers/seq2seq/seq2seq_utils.py | import logging
import os
import pickle
from multiprocessing import Pool
from typing import Tuple
import pandas as pd
import torch
from tokenizers.implementations import ByteLevelBPETokenizer
from tokenizers.processors import BertProcessing
from torch.utils.data import Dataset
from tqdm.auto import tqdm
from transforme... | 6,167 | 36.609756 | 118 | py |
RECCON | RECCON-main/simpletransformers/seq2seq/seq2seq_model.py | import json
import logging
import math
import os
import random
import warnings
from dataclasses import asdict
from multiprocessing import Pool, cpu_count
from pathlib import Path
import numpy as np
import pandas as pd
import torch
from tensorboardX import SummaryWriter
from torch.nn.utils.rnn import pad_sequence
from ... | 51,662 | 45.251567 | 227 | py |
RECCON | RECCON-main/simpletransformers/t5/t5_model.py | import json
import logging
import math
import os
import random
import warnings
from dataclasses import asdict
from multiprocessing import Pool, cpu_count
from os import truncate
from pathlib import Path
import numpy as np
import pandas as pd
import torch
from tensorboardX import SummaryWriter
from torch.nn.utils.rnn i... | 40,487 | 44.441077 | 214 | py |
RECCON | RECCON-main/simpletransformers/t5/t5_utils.py | import logging
import os
import pickle
from multiprocessing import Pool
from os import truncate
from typing import Tuple
import pandas as pd
import torch
from tokenizers.implementations import ByteLevelBPETokenizer
from tokenizers.processors import BertProcessing
from torch.utils.data import Dataset
from tqdm.auto imp... | 3,375 | 34.166667 | 119 | py |
RECCON | RECCON-main/simpletransformers/streamlit/simple_view.py | import os
import json
import logging
import streamlit as st
from torch.cuda import is_available
from simpletransformers.classification import (
ClassificationModel,
MultiLabelClassificationModel,
)
from simpletransformers.ner import NERModel
from simpletransformers.question_answering import QuestionAnsweringM... | 6,640 | 38.064706 | 142 | py |
RECCON | RECCON-main/simpletransformers/experimental/classification/classification_model.py | #!/usr/bin/env python
# coding: utf-8
from __future__ import absolute_import, division, print_function
import json
import math
import os
import random
import warnings
from multiprocessing import cpu_count
import numpy as np
import torch
from scipy.stats import pearsonr
from sklearn.metrics import (
confusion_ma... | 32,900 | 41.507752 | 196 | py |
RECCON | RECCON-main/simpletransformers/experimental/classification/multi_label_classification_model.py | from multiprocessing import cpu_count
import torch
from transformers import (
WEIGHTS_NAME,
AlbertConfig,
AlbertTokenizer,
BertConfig,
BertTokenizer,
DistilBertConfig,
DistilBertTokenizer,
RobertaConfig,
RobertaTokenizer,
XLMConfig,
XLMTokenizer,
XLNetConfig,
XLNetTo... | 6,079 | 40.081081 | 186 | py |
RECCON | RECCON-main/simpletransformers/experimental/classification/transformer_models/xlm_model.py | import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.models.xlm.modeling_xlm import SequenceSummary, XLMModel, XLMPreTrainedModel
class XLMForSequenceClassification(XLMPreTrainedModel):
r"""
**labels**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size... | 3,831 | 44.082353 | 134 | py |
RECCON | RECCON-main/simpletransformers/experimental/classification/transformer_models/bert_model.py | import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.models.bert.modeling_bert import BertModel, BertPreTrainedModel
class BertForSequenceClassification(BertPreTrainedModel):
r"""
**labels**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size,)``:
... | 4,808 | 44.8 | 134 | py |
RECCON | RECCON-main/simpletransformers/experimental/classification/transformer_models/camembert_model.py | import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.models.camembert.modeling_camembert import (
CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
CamembertConfig,
CamembertModel,
)
from transformers.models.roberta.modeling_roberta import RobertaClassificationHead, Rob... | 4,789 | 48.895833 | 134 | py |
RECCON | RECCON-main/simpletransformers/experimental/classification/transformer_models/xlnet_model.py | import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.models.xlnet.modeling_xlnet import SequenceSummary, XLNetModel, XLNetPreTrainedModel
class XLNetForSequenceClassification(XLNetPreTrainedModel):
r"""
**labels**: (`optional`) ``torch.LongTensor`` of shape `... | 5,568 | 47.426087 | 134 | py |
RECCON | RECCON-main/simpletransformers/experimental/classification/transformer_models/albert_model.py | import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.models.albert.modeling_albert import AlbertConfig, AlbertModel, AlbertPreTrainedModel
class AlbertForSequenceClassification(AlbertPreTrainedModel):
"""
**labels**: (`optional`) ``torch.LongTensor`` of shape... | 4,841 | 45.114286 | 134 | py |
RECCON | RECCON-main/simpletransformers/experimental/classification/transformer_models/distilbert_model.py | import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.models.distilbert.modeling_distilbert import DistilBertModel, DistilBertPreTrainedModel
class DistilBertForSequenceClassification(DistilBertPreTrainedModel):
r"""
**labels**: (`optional`) ``torch.LongTensor`` of shape `... | 3,890 | 57.954545 | 134 | py |
RECCON | RECCON-main/simpletransformers/experimental/classification/transformer_models/roberta_model.py | import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.models.bert.modeling_bert import BertPreTrainedModel
from transformers.models.roberta.modeling_roberta import (
ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
RobertaClassificationHead,
RobertaConfig,
RobertaMode... | 4,891 | 45.150943 | 134 | py |
RECCON | RECCON-main/simpletransformers/custom_models/models.py | import torch
from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from transformers import (
BertModel,
BertPreTrainedModel,
DistilBertModel,
ElectraForMaskedLM,
ElectraForPreTraining,
FlaubertModel,
LongformerModel,
RobertaModel,
XLMModel,
XLMPr... | 26,896 | 36.048209 | 134 | py |
TURL-release_ongoing | TURL-release_ongoing/run_lm_finetuning.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... | 25,565 | 50.753036 | 165 | py |
TURL-release_ongoing | TURL-release_ongoing/run_table_CT_finetuning.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... | 30,438 | 51.481034 | 225 | py |
TURL-release_ongoing | TURL-release_ongoing/run_hybrid_table_lm_finetuning.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... | 45,081 | 55.993679 | 288 | py |
TURL-release_ongoing | TURL-release_ongoing/test.py | import argparse
import torch
from tqdm import tqdm
import data_loader.data_loaders as module_data
import model.loss as module_loss
import model.metric as module_metric
import model.model as module_arch
from parse_config import ConfigParser
def main(config):
logger = config.get_logger('test')
# setup data_loa... | 2,720 | 32.182927 | 93 | py |
TURL-release_ongoing | TURL-release_ongoing/run_table_EL_finetuning.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... | 28,228 | 52.06203 | 213 | py |
TURL-release_ongoing | TURL-release_ongoing/run_table_RE_finetuning.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... | 29,804 | 50.744792 | 174 | py |
TURL-release_ongoing | TURL-release_ongoing/test_data_loader.py | from data_loader.data_loaders import *
from data_loader.TR_data_loaders import *
from data_loader.CT_Wiki_data_loaders import *
from data_loader.hybrid_data_loaders import *
import pdb
import torch
import numpy as np
from utils.util import *
if __name__ == "__main__":
torch.manual_seed(0)
np.random.seed(0)
... | 1,976 | 41.06383 | 162 | py |
TURL-release_ongoing | TURL-release_ongoing/run_table_CER_finetuning.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... | 34,044 | 53.039683 | 208 | py |
TURL-release_ongoing | TURL-release_ongoing/run_BERT_RE_finetuning.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... | 25,224 | 50.796715 | 175 | py |
TURL-release_ongoing | TURL-release_ongoing/run_table_TR_finetuning.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... | 30,295 | 52.338028 | 210 | py |
TURL-release_ongoing | TURL-release_ongoing/run_table_HR_finetuning.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... | 27,058 | 50.73805 | 171 | py |
TURL-release_ongoing | TURL-release_ongoing/run_table_lm_finetuning.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,995 | 55.722955 | 288 | py |
TURL-release_ongoing | TURL-release_ongoing/evaluate_task.py | from __future__ import absolute_import, division, print_function
import argparse
import glob
import logging
import os
import pickle
import random
import re
import shutil
import numpy as np
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader, Dataset, SequentialSampler, RandomSampler
f... | 23,112 | 49.136659 | 224 | py |
TURL-release_ongoing | TURL-release_ongoing/train.py | import argparse
import collections
import torch
import numpy as np
import data_loader.data_loaders as module_data
import model.loss as module_loss
import model.metric as module_metric
import model.model as module_arch
from parse_config import ConfigParser
from trainer import Trainer
# fix random seeds for reproducibi... | 2,537 | 36.880597 | 114 | py |
TURL-release_ongoing | TURL-release_ongoing/trainer/trainer.py | import numpy as np
import torch
from torchvision.utils import make_grid
from base import BaseTrainer
from utils import inf_loop, MetricTracker
class Trainer(BaseTrainer):
"""
Trainer class
"""
def __init__(self, model, criterion, metric_ftns, optimizer, config, data_loader,
valid_data... | 4,327 | 38.345455 | 111 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.