repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
SLT-FAI | SLT-FAI-main/transformers/modeling_tf_distilbert.py | # coding=utf-8
# Copyright 2019-present, the HuggingFace Inc. team, The Google AI Language Team and Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.or... | 46,463 | 41.78453 | 141 | py |
SLT-FAI | SLT-FAI-main/transformers/convert_bert_pytorch_checkpoint_to_original_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,115 | 35.424779 | 118 | py |
SLT-FAI | SLT-FAI-main/transformers/tokenization_electra_fast.py | # coding=utf-8
# Copyright 2020 The Google AI Team, Stanford University 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/L... | 4,144 | 53.539474 | 150 | py |
SLT-FAI | SLT-FAI-main/transformers/tokenization_utils_fast.py | # coding=utf-8
# Copyright 2020 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 24,319 | 39.942761 | 126 | py |
SLT-FAI | SLT-FAI-main/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... | 46,565 | 41.217588 | 180 | py |
SLT-FAI | SLT-FAI-main/transformers/convert_xlnet_original_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... | 3,698 | 31.165217 | 117 | py |
SLT-FAI | SLT-FAI-main/transformers/modeling_albert.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain 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
#
# U... | 53,414 | 39.743707 | 168 | py |
SLT-FAI | SLT-FAI-main/transformers/modeling_blenderbot.py | #!/usr/bin/env python3
# coding=utf-8
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the;
# 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
#
... | 2,374 | 40.666667 | 120 | py |
SLT-FAI | SLT-FAI-main/transformers/modeling_tf_longformer.py | # coding=utf-8
# Copyright 2020 The Allen Institute for AI team 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... | 78,170 | 41.927512 | 271 | py |
SLT-FAI | SLT-FAI-main/transformers/tokenization_retribert_fast.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,247 | 35.258065 | 130 | py |
SLT-FAI | SLT-FAI-main/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... | 89,614 | 43.363861 | 197 | py |
SLT-FAI | SLT-FAI-main/transformers/modeling_tf_camembert.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... | 6,262 | 39.934641 | 224 | py |
SLT-FAI | SLT-FAI-main/transformers/configuration_t5.py | # coding=utf-8
# Copyright 2010, The T5 Authors and HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 5,617 | 41.560606 | 120 | py |
SLT-FAI | SLT-FAI-main/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... | 52,051 | 40.278351 | 197 | py |
SLT-FAI | SLT-FAI-main/transformers/modeling_tf_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... | 49,337 | 45.153414 | 167 | py |
SLT-FAI | SLT-FAI-main/transformers/modeling_lxmert.py | # coding=utf-8
# Copyright 2018 Hao Tan, Mohit Bansal, and the HuggingFace 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 r... | 64,084 | 43.534399 | 177 | py |
SLT-FAI | SLT-FAI-main/transformers/modeling_ctrl.py | # coding=utf-8
# Copyright 2018 Salesforce 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 at
#
# h... | 24,658 | 40.02995 | 124 | py |
SLT-FAI | SLT-FAI-main/transformers/trainer.py | # coding=utf-8
# Copyright 2020-present 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 ap... | 70,498 | 45.781022 | 188 | py |
SLT-FAI | SLT-FAI-main/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... | 30,586 | 38.31491 | 136 | py |
SLT-FAI | SLT-FAI-main/transformers/configuration_reformer.py | # coding=utf-8
# Copyright 2020 The Trax 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 copy of the License at... | 13,249 | 56.359307 | 122 | py |
SLT-FAI | SLT-FAI-main/transformers/configuration_squeezebert.py | # coding=utf-8
# Copyright 2020 The SqueezeBert 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/LICENSE-2.0
#
# U... | 7,280 | 46.588235 | 149 | py |
SLT-FAI | SLT-FAI-main/transformers/tokenization_openai.py | # coding=utf-8
# Copyright 2018 The Open AI 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/LICENSE-2.0
#
# ... | 8,533 | 35.314894 | 119 | py |
SLT-FAI | SLT-FAI-main/transformers/tokenization_t5.py | # coding=utf-8
# Copyright 2018 T5 Authors and 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... | 12,287 | 39.82392 | 164 | py |
SLT-FAI | SLT-FAI-main/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... | 10,652 | 41.612 | 128 | py |
SLT-FAI | SLT-FAI-main/transformers/modelcard.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... | 10,052 | 45.541667 | 300 | py |
SLT-FAI | SLT-FAI-main/transformers/convert_reformer_trax_checkpoint_to_pytorch.py | # coding=utf-8
# Copyright 2020 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 7,830 | 34.595455 | 118 | py |
SLT-FAI | SLT-FAI-main/transformers/tokenization_pegasus.py | # coding=utf-8
# Copyright 2020 Google 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
#
# Unless required by... | 6,714 | 40.96875 | 117 | py |
SLT-FAI | SLT-FAI-main/transformers/modeling_deberta.py | # coding=utf-8
# Copyright 2020 Microsoft and the Hugging Face 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 require... | 41,672 | 39.341723 | 225 | py |
SLT-FAI | SLT-FAI-main/transformers/configuration_rag.py | # coding=utf-8
# Copyright 2020, The RAG 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/LICENSE-2.0
#
# Unless r... | 8,540 | 46.187845 | 166 | py |
SLT-FAI | SLT-FAI-main/transformers/modeling_xlm_prophetnet.py | # coding=utf-8
# Copyright 2020 The Microsoft 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/LICENSE-2.0
#
# Unl... | 6,853 | 41.8375 | 158 | py |
SLT-FAI | SLT-FAI-main/transformers/convert_pytorch_checkpoint_to_tf2.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... | 15,336 | 33.936219 | 126 | py |
SLT-FAI | SLT-FAI-main/transformers/modeling_roberta.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... | 62,680 | 41.209428 | 219 | py |
SLT-FAI | SLT-FAI-main/transformers/tokenization_utils.py | # coding=utf-8
# Copyright 2020 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 39,004 | 43.123303 | 155 | py |
SLT-FAI | SLT-FAI-main/transformers/commands/user.py | import os
import sys
from argparse import ArgumentParser
from getpass import getpass
from typing import List, Union
from requests.exceptions import HTTPError
from transformers.commands import BaseTransformersCLICommand
from transformers.hf_api import HfApi, HfFolder
UPLOAD_MAX_FILES = 15
class UserCommands(BaseTra... | 9,308 | 37.466942 | 120 | py |
SLT-FAI | SLT-FAI-main/transformers/commands/serving.py | from argparse import ArgumentParser, Namespace
from typing import Any, List, Optional
from transformers import Pipeline
from transformers.commands import BaseTransformersCLICommand
from transformers.pipelines import SUPPORTED_TASKS, pipeline
from ..utils import logging
try:
from fastapi import Body, FastAPI, HT... | 7,474 | 33.606481 | 119 | py |
SLT-FAI | SLT-FAI-main/transformers/commands/download.py | from argparse import ArgumentParser
from transformers.commands import BaseTransformersCLICommand
def download_command_factory(args):
return DownloadCommand(args.model, args.cache_dir, args.force)
class DownloadCommand(BaseTransformersCLICommand):
@staticmethod
def register_subcommand(parser: ArgumentPa... | 1,272 | 37.575758 | 110 | py |
SLT-FAI | SLT-FAI-main/transformers/commands/run.py | from argparse import ArgumentParser
from transformers.commands import BaseTransformersCLICommand
from transformers.pipelines import SUPPORTED_TASKS, Pipeline, PipelineDataFormat, pipeline
from ..utils import logging
logger = logging.get_logger(__name__) # pylint: disable=invalid-name
def try_infer_format_from_ex... | 3,688 | 36.642857 | 119 | py |
SLT-FAI | SLT-FAI-main/transformers/commands/convert.py | from argparse import ArgumentParser, Namespace
from transformers.commands import BaseTransformersCLICommand
from ..utils import logging
def convert_command_factory(args: Namespace):
"""
Factory function used to convert a model TF 1.0 checkpoint in a PyTorch checkpoint.
:return: ServeCommand
"""
... | 6,582 | 40.664557 | 117 | py |
SLT-FAI | SLT-FAI-main/transformers/commands/__init__.py | from abc import ABC, abstractmethod
from argparse import ArgumentParser
class BaseTransformersCLICommand(ABC):
@staticmethod
@abstractmethod
def register_subcommand(parser: ArgumentParser):
raise NotImplementedError()
@abstractmethod
def run(self):
raise NotImplementedError()
| 316 | 21.642857 | 52 | py |
SLT-FAI | SLT-FAI-main/transformers/commands/transformers_cli.py | #!/usr/bin/env python
from argparse import ArgumentParser
from transformers.commands.convert import ConvertCommand
from transformers.commands.download import DownloadCommand
from transformers.commands.env import EnvironmentCommand
from transformers.commands.run import RunCommand
from transformers.commands.serving impo... | 1,168 | 29.763158 | 97 | py |
SLT-FAI | SLT-FAI-main/transformers/commands/train.py | import os
from argparse import ArgumentParser, Namespace
from transformers import SingleSentenceClassificationProcessor as Processor
from transformers import TextClassificationPipeline, is_tf_available, is_torch_available
from transformers.commands import BaseTransformersCLICommand
from ..utils import logging
if no... | 5,798 | 38.993103 | 117 | py |
SLT-FAI | SLT-FAI-main/transformers/commands/env.py | import platform
from argparse import ArgumentParser
from transformers import __version__ as version
from transformers import is_tf_available, is_torch_available
from transformers.commands import BaseTransformersCLICommand
def info_command_factory(_):
return EnvironmentCommand()
class EnvironmentCommand(BaseTra... | 2,027 | 33.372881 | 105 | py |
SLT-FAI | SLT-FAI-main/transformers/benchmark/benchmark.py | # coding=utf-8
# Copyright 2018 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 copy of the License at
#
# http://www.a... | 10,617 | 38.619403 | 181 | py |
SLT-FAI | SLT-FAI-main/transformers/benchmark/benchmark_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.
"""
import copy
import csv
import linecache
import os
import platform
import sys
from abc import ABC, abstractmethod
from collections import d... | 36,700 | 40.658343 | 204 | py |
SLT-FAI | SLT-FAI-main/transformers/benchmark/benchmark_args_utils.py | # coding=utf-8
# Copyright 2018 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 copy of the License at
#
# http://www.a... | 5,903 | 38.891892 | 252 | py |
SLT-FAI | SLT-FAI-main/transformers/benchmark/benchmark_tf.py | # coding=utf-8
# Copyright 2018 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 copy of the License at
#
# http://www.a... | 12,928 | 42.827119 | 181 | py |
SLT-FAI | SLT-FAI-main/transformers/benchmark/benchmark_args.py | # coding=utf-8
# Copyright 2018 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 copy of the License at
#
# http://www.a... | 3,768 | 31.773913 | 127 | py |
SLT-FAI | SLT-FAI-main/transformers/benchmark/__init__.py | 0 | 0 | 0 | py | |
SLT-FAI | SLT-FAI-main/transformers/benchmark/benchmark_args_tf.py | # coding=utf-8
# Copyright 2018 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 copy of the License at
#
# http://www.a... | 4,603 | 32.852941 | 127 | py |
SLT-FAI | SLT-FAI-main/transformers/utils/dummy_pt_objects.py | # This file is autogenerated by the command `make fix-copies`, do not edit.
from ..file_utils import requires_pytorch
class PyTorchBenchmark:
def __init__(self, *args, **kwargs):
requires_pytorch(self)
class PyTorchBenchmarkArguments:
def __init__(self, *args, **kwargs):
requires_pytorch(sel... | 43,177 | 20.895538 | 75 | py |
SLT-FAI | SLT-FAI-main/transformers/utils/dummy_flax_objects.py | # This file is autogenerated by the command `make fix-copies`, do not edit.
from ..file_utils import requires_flax
class FlaxBertModel:
def __init__(self, *args, **kwargs):
requires_flax(self)
@classmethod
def from_pretrained(self, *args, **kwargs):
requires_flax(self)
class FlaxRoberta... | 490 | 22.380952 | 75 | py |
SLT-FAI | SLT-FAI-main/transformers/utils/dummy_tf_objects.py | # This file is autogenerated by the command `make fix-copies`, do not edit.
from ..file_utils import requires_tf
class TensorFlowBenchmarkArguments:
def __init__(self, *args, **kwargs):
requires_tf(self)
class TensorFlowBenchmark:
def __init__(self, *args, **kwargs):
requires_tf(self)
def ... | 26,977 | 19.880805 | 75 | py |
SLT-FAI | SLT-FAI-main/transformers/utils/logging.py | # coding=utf-8
# Copyright 2020 Optuna, Hugging Face
#
# 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 o... | 7,015 | 27.991736 | 114 | py |
SLT-FAI | SLT-FAI-main/transformers/utils/dummy_tokenizers_objects.py | # This file is autogenerated by the command `make fix-copies`, do not edit.
from ..file_utils import requires_tokenizers
class AlbertTokenizerFast:
def __init__(self, *args, **kwargs):
requires_tokenizers(self)
@classmethod
def from_pretrained(self, *args, **kwargs):
requires_tokenizers(s... | 5,813 | 21.980237 | 75 | py |
SLT-FAI | SLT-FAI-main/transformers/utils/sentencepiece_model_pb2.py | # flake8: noqa
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: sentencepiece_model.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pb2
from google.protob... | 39,000 | 32.334188 | 3,625 | py |
SLT-FAI | SLT-FAI-main/transformers/utils/dummy_sentencepiece_objects.py | # This file is autogenerated by the command `make fix-copies`, do not edit.
from ..file_utils import requires_sentencepiece
class AlbertTokenizer:
def __init__(self, *args, **kwargs):
requires_sentencepiece(self)
@classmethod
def from_pretrained(self, *args, **kwargs):
requires_sentencepi... | 2,409 | 22.627451 | 75 | py |
SLT-FAI | SLT-FAI-main/transformers/utils/__init__.py | 0 | 0 | 0 | py | |
SLT-FAI | SLT-FAI-main/transformers/utils/notebook.py | # coding=utf-8
# Copyright 2020 Hugging Face
#
# 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... | 14,370 | 40.414986 | 131 | py |
SLT-FAI | SLT-FAI-main/transformers/data/data_collator.py | from dataclasses import dataclass
from typing import Any, Callable, Dict, List, NewType, Optional, Tuple, Union
import torch
from torch.nn.utils.rnn import pad_sequence
from ..tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTrainedTokenizerBase
InputDataClass = NewType("InputDataClass", Any)
"""
... | 27,108 | 50.342803 | 184 | py |
SLT-FAI | SLT-FAI-main/transformers/data/test_generation_utils.py | import random
import unittest
import timeout_decorator
from transformers import is_torch_available
from transformers.file_utils import cached_property
from transformers.testing_utils import require_torch
if is_torch_available():
import torch
from transformers import MarianConfig, MarianMTModel
@require_t... | 2,874 | 31.670455 | 94 | py |
SLT-FAI | SLT-FAI-main/transformers/data/__init__.py | # flake8: noqa
# There's no way to ignore "F401 '...' imported but unused" warnings in this
# module, but to preserve other warnings. So, don't check this module at all.
from .metrics import glue_compute_metrics, xnli_compute_metrics
from .processors import (
DataProcessor,
InputExample,
InputFeatures,
... | 664 | 26.708333 | 77 | py |
SLT-FAI | SLT-FAI-main/transformers/data/metrics/squad_metrics.py | """ Very heavily inspired by the official evaluation script for SQuAD version 2.0 which was
modified by XLNet authors to update `find_best_threshold` scripts for SQuAD V2.0
In addition to basic functionality, we also compute additional statistics and
plot precision-recall curves if an additional na_prob.json file is p... | 29,105 | 37.047059 | 117 | py |
SLT-FAI | SLT-FAI-main/transformers/data/metrics/__init__.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... | 3,116 | 34.022472 | 118 | py |
SLT-FAI | SLT-FAI-main/transformers/data/datasets/glue.py | import os
import time
from dataclasses import dataclass, field
from enum import Enum
from typing import List, Optional, Union
import torch
from torch.utils.data.dataset import Dataset
from filelock import FileLock
from ...tokenization_utils_base import PreTrainedTokenizerBase
from ...utils import logging
from ..proc... | 5,240 | 34.412162 | 119 | py |
SLT-FAI | SLT-FAI-main/transformers/data/datasets/squad.py | import os
import time
from dataclasses import dataclass, field
from enum import Enum
from typing import Dict, List, Optional, Union
import torch
from torch.utils.data.dataset import Dataset
from filelock import FileLock
from ...modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAPPING
from ...tokenization_utils impo... | 8,523 | 39.018779 | 129 | py |
SLT-FAI | SLT-FAI-main/transformers/data/datasets/language_modeling.py | import os
import pickle
import random
import time
from typing import Dict, List, Optional
import torch
from torch.utils.data.dataset import Dataset
from filelock import FileLock
from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging
logger = logging.get_logger(__name__)
class TextData... | 18,485 | 41.890951 | 119 | py |
SLT-FAI | SLT-FAI-main/transformers/data/datasets/__init__.py | # flake8: noqa
# There's no way to ignore "F401 '...' imported but unused" warnings in this
# module, but to preserve other warnings. So, don't check this module at all.
from .glue import GlueDataset, GlueDataTrainingArguments
from .language_modeling import (
LineByLineTextDataset,
LineByLineWithSOPTextDataset... | 443 | 33.153846 | 77 | py |
SLT-FAI | SLT-FAI-main/transformers/data/processors/glue.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | 21,346 | 34.757119 | 119 | py |
SLT-FAI | SLT-FAI-main/transformers/data/processors/squad.py | import json
import os
from functools import partial
from multiprocessing import Pool, cpu_count
import numpy as np
from tqdm import tqdm
from ...file_utils import is_tf_available, is_torch_available
from ...tokenization_bart import BartTokenizer
from ...tokenization_bert import whitespace_tokenize
from ...tokenizatio... | 32,391 | 38.406326 | 125 | py |
SLT-FAI | SLT-FAI-main/transformers/data/processors/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... | 14,140 | 38.946328 | 119 | py |
SLT-FAI | SLT-FAI-main/transformers/data/processors/__init__.py | # flake8: noqa
# There's no way to ignore "F401 '...' imported but unused" warnings in this
# module, but to preserve other warnings. So, don't check this module at all.
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels
from .squad import SquadExample, Squad... | 578 | 63.333333 | 118 | py |
SLT-FAI | SLT-FAI-main/transformers/data/processors/xnli.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... | 3,308 | 35.766667 | 128 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/SentenceTransformer.py | import copy
import json
import logging
import os
import shutil
from collections import OrderedDict
from typing import List, Dict, Tuple, Iterable, Type, Union, Callable, Optional
from zipfile import ZipFile
import requests
import numpy as np
from numpy import ndarray
import transformers
import torch
from torch import n... | 34,422 | 45.454791 | 280 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/util.py | import requests
from torch import Tensor, device
from typing import List
from tqdm import tqdm
import sys
import importlib
import os
import torch
import numpy as np
import queue
def pytorch_cos_sim(a: Tensor, b: Tensor):
"""
Computes the cosine similarity cos_sim(a[i], b[j]) for all i and j.
This function... | 11,267 | 42.674419 | 165 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/LoggingHandler.py | import logging
import tqdm
class LoggingHandler(logging.Handler):
def __init__(self, level=logging.NOTSET):
super().__init__(level)
def emit(self, record):
try:
msg = self.format(record)
tqdm.tqdm.write(msg)
self.flush()
except (KeyboardInterrupt, Sy... | 401 | 24.125 | 47 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/__init__.py | __version__ = "0.3.9"
__DOWNLOAD_SERVER__ = 'https://sbert.net/models/'
from .datasets import SentencesDataset, SentenceLabelDataset, ParallelSentencesDataset
from .LoggingHandler import LoggingHandler
from .SentenceTransformer import SentenceTransformer
from .readers import InputExample
from .cross_encoder.CrossEncode... | 343 | 37.222222 | 86 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/evaluation/BinaryClassificationEvaluator.py | from . import SentenceEvaluator
import logging
import os
import csv
from sklearn.metrics.pairwise import paired_cosine_distances, paired_euclidean_distances, paired_manhattan_distances
from sklearn.metrics import average_precision_score
import numpy as np
from typing import List
from ..readers import InputExample
clas... | 7,973 | 42.102703 | 187 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/evaluation/SequentialEvaluator.py | from . import SentenceEvaluator
from typing import Iterable
class SequentialEvaluator(SentenceEvaluator):
"""
This evaluator allows that multiple sub-evaluators are passed. When the model is evaluated,
the data is passed sequentially to all sub-evaluators.
All scores are passed to 'main_score_function... | 855 | 39.761905 | 113 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/evaluation/EmbeddingSimilarityEvaluator.py | from . import SentenceEvaluator, SimilarityFunction
import logging
import os
import csv
from sklearn.metrics.pairwise import paired_cosine_distances, paired_euclidean_distances, paired_manhattan_distances
from scipy.stats import pearsonr, spearmanr
import numpy as np
from typing import List
from ..readers import InputE... | 6,260 | 46.793893 | 205 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/evaluation/MSEEvaluator.py | from sentence_transformers.evaluation import SentenceEvaluator
import numpy as np
import logging
import os
import csv
from typing import List
class MSEEvaluator(SentenceEvaluator):
"""
Computes the mean squared error (x100) between the computed sentence embedding
and some target sentence embedding.
Th... | 2,834 | 44.725806 | 174 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/evaluation/InformationRetrievalEvaluator.py | from . import SentenceEvaluator
import torch
import logging
from tqdm import tqdm, trange
from ..util import pytorch_cos_sim
import os
import numpy as np
from typing import List, Tuple, Dict, Set
class InformationRetrievalEvaluator(SentenceEvaluator):
"""
This class evaluates an Information Retrieval (IR) set... | 10,665 | 35.652921 | 171 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/evaluation/TranslationEvaluator.py | from . import SentenceEvaluator
import logging
from ..util import pytorch_cos_sim
import os
import csv
import numpy as np
import scipy.spatial
from typing import List
import torch
class TranslationEvaluator(SentenceEvaluator):
"""
Given two sets of sentences in different languages, e.g. (en_1, en_2, en_3...) a... | 4,278 | 39.367925 | 188 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/evaluation/MSEEvaluatorFromDataFrame.py | from sentence_transformers.evaluation import SentenceEvaluator
from sentence_transformers.util import batch_to_device
from sentence_transformers import SentenceTransformer
from typing import List, Tuple, Dict
import torch
import numpy as np
import logging
import os
import csv
class MSEEvaluatorFromDataFrame(SentenceE... | 3,814 | 42.850575 | 162 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/evaluation/SentenceEvaluator.py | class SentenceEvaluator:
"""
Base class for all evaluators
Extend this class and implement __call__ for custom evaluators.
"""
def __call__(self, model, output_path: str = None, epoch: int = -1, steps: int = -1) -> float:
"""
This is called during training to evaluate the model.
... | 1,084 | 37.75 | 98 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/evaluation/__init__.py | from .SentenceEvaluator import SentenceEvaluator
from .SimilarityFunction import SimilarityFunction
from .BinaryClassificationEvaluator import BinaryClassificationEvaluator
from .EmbeddingSimilarityEvaluator import EmbeddingSimilarityEvaluator
from .InformationRetrievalEvaluator import InformationRetrievalEvaluator
f... | 702 | 45.866667 | 72 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/evaluation/ParaphraseMiningEvaluator.py | from . import SentenceEvaluator
import logging
from sentence_transformers.util import paraphrase_mining
import os
import csv
from typing import List, Tuple, Dict
from collections import defaultdict
class ParaphraseMiningEvaluator(SentenceEvaluator):
"""
Given a large set of sentences, this evaluator performs... | 8,160 | 48.162651 | 404 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/evaluation/SimilarityFunction.py | from enum import Enum
class SimilarityFunction(Enum):
COSINE = 0
EUCLIDEAN = 1
MANHATTAN = 2
DOT_PRODUCT = 3
| 127 | 13.222222 | 31 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/evaluation/LabelAccuracyEvaluator.py | from . import SentenceEvaluator
import torch
from torch.utils.data import DataLoader
import logging
from tqdm import tqdm
from ..util import batch_to_device
import os
import csv
class LabelAccuracyEvaluator(SentenceEvaluator):
"""
Evaluate a model based on its accuracy on a labeled dataset
This requires a... | 2,599 | 33.666667 | 98 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/evaluation/TripletEvaluator.py | from . import SentenceEvaluator, SimilarityFunction
import logging
import os
import csv
from sklearn.metrics.pairwise import paired_cosine_distances, paired_euclidean_distances, paired_manhattan_distances
from typing import List
from ..readers import InputExample
class TripletEvaluator(SentenceEvaluator):
"""
... | 5,947 | 45.46875 | 209 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/cross_encoder/CrossEncoder.py |
from transformers import AutoModelForSequenceClassification, AutoTokenizer, AutoConfig, DistilBertConfig
import numpy as np
import logging
import os
from typing import Dict, Type, Callable, List
import transformers
import torch
from torch import nn
from torch.optim import Optimizer
from torch.utils.data import DataLoa... | 13,823 | 44.32459 | 254 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/cross_encoder/__init__.py | from .CrossEncoder import CrossEncoder | 38 | 38 | 38 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/cross_encoder/evaluation/CESoftmaxAccuracyEvaluator.py | import logging
import os
import csv
from typing import List
from ... import InputExample
import numpy as np
class CESoftmaxAccuracyEvaluator:
"""
This evaluator can be used with the CrossEncoder class.
It is designed for CrossEncoders with 2 or more outputs. It measure the
accuracy of the predict clas... | 2,280 | 35.790323 | 111 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/cross_encoder/evaluation/CEBinaryClassificationEvaluator.py | import logging
from sklearn.metrics import average_precision_score
from typing import List
import numpy as np
import os
import csv
from ... import InputExample
from ...evaluation import BinaryClassificationEvaluator
class CEBinaryClassificationEvaluator:
"""
This evaluator can be used with the CrossEncoder cl... | 3,183 | 43.84507 | 145 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/cross_encoder/evaluation/CECorrelationEvaluator.py | import logging
from scipy.stats import pearsonr, spearmanr
from typing import List
import os
import csv
from ... import InputExample
class CECorrelationEvaluator:
"""
This evaluator can be used with the CrossEncoder class. Given sentence pairs and continuous scores,
it compute the pearson & spearman correl... | 2,402 | 39.05 | 107 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/cross_encoder/evaluation/__init__.py | from .CEBinaryClassificationEvaluator import CEBinaryClassificationEvaluator
from .CECorrelationEvaluator import CECorrelationEvaluator
from .CESoftmaxAccuracyEvaluator import CESoftmaxAccuracyEvaluator
| 203 | 50 | 76 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/models/Transformer.py | from torch import nn
from transformers import AutoModel, AutoTokenizer, AutoConfig
import json
from typing import List, Dict, Optional, Union
import os
class Transformer(nn.Module):
"""Huggingface AutoModel to generate token embeddings.
Loads the correct class, e.g. BERT / RoBERTa etc.
:param model_name_... | 5,725 | 46.322314 | 255 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/models/WeightedLayerPooling.py | import torch
from torch import Tensor
from torch import nn
from typing import Union, Tuple, List, Iterable, Dict
import os
import json
class WeightedLayerPooling(nn.Module):
"""
Token embeddings are weighted mean of their different hidden layer representations
"""
def __init__(self, word_embedding_dim... | 2,246 | 40.611111 | 165 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/models/CNN.py | import torch
from torch import nn, Tensor
from typing import Union, Tuple, List, Iterable, Dict
import logging
import gzip
from tqdm import tqdm
import numpy as np
import os
import json
from ..util import import_from_string, fullname, http_get
from .tokenizer import WordTokenizer, WhitespaceTokenizer
class CNN(nn.Mod... | 2,462 | 34.695652 | 119 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/models/WordEmbeddings.py | import torch
from torch import nn, Tensor
from typing import Union, Tuple, List, Iterable, Dict
import logging
import gzip
from tqdm import tqdm
import numpy as np
import os
import json
from ..util import import_from_string, fullname, http_get
from .tokenizer import WordTokenizer, WhitespaceTokenizer
class WordEmbedd... | 5,818 | 44.108527 | 171 | py |
SLT-FAI | SLT-FAI-main/sentence_transformers/models/XLMRoBERTa.py | from . import Transformer
class XLMRoBERTa(Transformer):
"""
DEPRECATED: Please use models.Transformer instead.
"""
pass
| 145 | 8.733333 | 54 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.