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 |
|---|---|---|---|---|---|---|
robust-transformers | robust-transformers-main/examples/pytorch/question-answering/run_qa_beam_search_no_trainer.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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/LI... | 40,589 | 46.033604 | 120 | py |
robust-transformers | robust-transformers-main/examples/pytorch/question-answering/utils_qa.py | # coding=utf-8
# Copyright 2020 The HuggingFace Team 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 require... | 22,582 | 50.559361 | 135 | py |
robust-transformers | robust-transformers-main/examples/pytorch/question-answering/trainer_qa.py | # coding=utf-8
# Copyright 2020 The HuggingFace Team 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 require... | 4,740 | 44.152381 | 118 | py |
robust-transformers | robust-transformers-main/examples/pytorch/question-answering/run_seq2seq_qa.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Team 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-... | 50,543 | 46.105312 | 136 | py |
robust-transformers | robust-transformers-main/examples/pytorch/question-answering/run_qa_beam_search.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2020 The HuggingFace Team 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-... | 50,808 | 47.435653 | 774 | py |
robust-transformers | robust-transformers-main/examples/pytorch/question-answering/run_qa_no_trainer.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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/LI... | 37,599 | 44.520581 | 120 | py |
robust-transformers | robust-transformers-main/examples/pytorch/token-classification/run_ner_no_trainer.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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/LI... | 26,309 | 40.498423 | 147 | py |
robust-transformers | robust-transformers-main/examples/pytorch/token-classification/run_ner.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2020 The HuggingFace Team 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-... | 25,434 | 41.321131 | 124 | py |
robust-transformers | robust-transformers-main/examples/pytorch/image-pretraining/run_mae.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2022 The HuggingFace Inc. team. 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/LI... | 14,724 | 38.690027 | 119 | py |
robust-transformers | robust-transformers-main/examples/pytorch/image-pretraining/run_mim.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2022 The HuggingFace Inc. team. 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/LI... | 18,065 | 39.23608 | 120 | py |
robust-transformers | robust-transformers-main/examples/pytorch/image-classification/run_image_classification_dro.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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/LI... | 20,092 | 39.756592 | 171 | py |
robust-transformers | robust-transformers-main/examples/pytorch/image-classification/run_image_classification.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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/LI... | 17,554 | 38.449438 | 143 | py |
robust-transformers | robust-transformers-main/examples/pytorch/image-classification/generate_features.py | #!/usr/bin/env python
# coding=utf-8
# generating features for image classification
import logging
import os
import sys
import jsonlines
import json
from dataclasses import dataclass, field
from typing import Optional
import tqdm
import pickle
import datasets
from datasets.dataset_dict import DatasetDict, IterableDat... | 30,464 | 42.771552 | 177 | py |
robust-transformers | robust-transformers-main/examples/pytorch/image-classification/learn_grouper.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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/LI... | 22,444 | 41.18985 | 205 | py |
robust-transformers | robust-transformers-main/examples/pytorch/image-classification/domino_learnt_slicer.py | import math
import numpy as np
from turtle import forward
import torch
import torch.utils.checkpoint
from packaging import version
from torch import nn, optim, autograd
import torch.distributed as dist
from torch.distributed import ReduceOp
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from datacla... | 20,182 | 48.957921 | 165 | py |
robust-transformers | robust-transformers-main/examples/pytorch/image-classification/domino_slicer.py | from __future__ import annotations
import warnings
from functools import wraps
from typing import Union
import meerkat as mk
import numpy as np
import sklearn.cluster as cluster
from scipy import linalg
from scipy.special import logsumexp
from sklearn.decomposition import PCA
from sklearn.exceptions import Convergenc... | 30,667 | 39.405797 | 141 | py |
robust-transformers | robust-transformers-main/examples/pytorch/summarization/run_summarization_no_trainer.py | #!/usr/bin/env python
# coding=utf-8
# Copyright The HuggingFace Team and The HuggingFace Inc. team. 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.ap... | 25,382 | 39.874396 | 119 | py |
robust-transformers | robust-transformers-main/examples/pytorch/summarization/run_summarization.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Team. 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... | 30,199 | 42.328551 | 149 | py |
robust-transformers | robust-transformers-main/examples/pytorch/text-classification/run_glue.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team. 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/LI... | 25,282 | 43.278459 | 119 | py |
robust-transformers | robust-transformers-main/examples/pytorch/text-classification/run_glue_cartography.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team. 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/LI... | 31,285 | 44.145743 | 155 | py |
robust-transformers | robust-transformers-main/examples/pytorch/text-classification/train_dy_filtering.py | """
Filtering and dataset mapping methods based on training dynamics.
By default, this module reads training dynamics from a given trained model and
computes the metrics---confidence, variability, correctness,
as well as baseline metrics of forgetfulness and threshold closeness
for each instance in the training data.
I... | 18,898 | 40.174292 | 140 | py |
robust-transformers | robust-transformers-main/examples/pytorch/text-classification/run_xnli.py | #!/usr/bin/env python
# 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.
... | 16,340 | 39.750623 | 119 | py |
robust-transformers | robust-transformers-main/examples/pytorch/text-classification/run_glue_no_trainer.py | # coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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 r... | 21,165 | 42.020325 | 119 | py |
robust-transformers | robust-transformers-main/examples/pytorch/speech-pretraining/run_wav2vec2_pretraining_no_trainer.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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/LI... | 29,371 | 39.346154 | 200 | py |
robust-transformers | robust-transformers-main/examples/pytorch/text-generation/run_generation.py | #!/usr/bin/env python
# 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 co... | 10,991 | 36.773196 | 119 | py |
robust-transformers | robust-transformers-main/examples/pytorch/multiple-choice/run_swag.py | #!/usr/bin/env python
# coding=utf-8
# Copyright The HuggingFace Team and The HuggingFace Inc. team. 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.ap... | 18,885 | 40.416667 | 119 | py |
robust-transformers | robust-transformers-main/examples/pytorch/multiple-choice/run_swag_no_trainer.py | #!/usr/bin/env python
# coding=utf-8
# Copyright The HuggingFace Team and The HuggingFace Inc. team. 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.ap... | 21,483 | 39.921905 | 119 | py |
robust-transformers | robust-transformers-main/examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Team. 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... | 20,824 | 40.40159 | 126 | py |
robust-transformers | robust-transformers-main/examples/pytorch/speech-recognition/run_speech_recognition_ctc.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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/LI... | 30,371 | 40.098782 | 158 | py |
robust-transformers | robust-transformers-main/examples/pytorch/slice-discovery/generate_features.py | #!/usr/bin/env python
# coding=utf-8
"""
Code to create feature representations for instances of a text classification task, for automatic spurious-feature slice-discovery.
Supported Feature types:
Given a model path (pretrained or finetuned), return
* CLS
* Maxpool representations
Given two model representat... | 32,462 | 46.047826 | 197 | py |
robust-transformers | robust-transformers-main/examples/pytorch/slice-discovery/custom_slicer.py | from __future__ import annotations
import warnings
from functools import wraps
from typing import Union
import meerkat as mk
import numpy as np
import sklearn.cluster as cluster
from scipy import linalg
from scipy.special import logsumexp
from sklearn.decomposition import PCA
from sklearn.exceptions import Convergenc... | 29,931 | 39.231183 | 89 | py |
robust-transformers | robust-transformers-main/examples/pytorch/slice-discovery/domino_learnt_slicer.py | import math
import numpy as np
from turtle import forward
import torch
import torch.utils.checkpoint
from packaging import version
from torch import nn, optim, autograd
import torch.distributed as dist
from torch.distributed import ReduceOp
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from datacla... | 19,060 | 48.897906 | 144 | py |
robust-transformers | robust-transformers-main/examples/pytorch/slice-discovery/learn_groups.py | # A way to learn ideal incorporation of features for clustering in order to identify regions that have high loss
# Instantiate the network randomly
# Train for few epochs until convergence for the network to predict the same assignment as the ones given by the GMM model (improves convergence maybe)
# Train for the fin... | 25,315 | 42.57315 | 175 | py |
robust-transformers | robust-transformers-main/examples/pytorch/slice-discovery/domino_slicer.py | from __future__ import annotations
import warnings
from functools import wraps
from typing import Union
import meerkat as mk
import numpy as np
import sklearn.cluster as cluster
from scipy import linalg
from scipy.special import logsumexp
from sklearn.decomposition import PCA
from sklearn.exceptions import Convergenc... | 30,667 | 39.405797 | 141 | py |
robust-transformers | robust-transformers-main/examples/pytorch/slice-discovery/error_aware_slice_discovery.py | # load for each fold of training data, corresponding model, pretrained model and split out Ypred, Y
# Combine all that data and create 6 folds.
# For Dev set, do something similar, but now, the strategy for worst -group selection criterion is different. Recombining some of the low error groups together by class, crea... | 37,779 | 44.905225 | 240 | py |
robust-transformers | robust-transformers-main/examples/pytorch/slice-discovery/generate_pretrained_features.py | #!/usr/bin/env python
# coding=utf-8
"""
Code to create feature representations for instances of a text classification task, for automatic spurious-feature slice-discovery.
Supported Feature types:
Given a model path (pretrained or finetuned), return
* CLS
* Maxpool representations
Given two model representat... | 28,557 | 44.330159 | 195 | py |
robust-transformers | robust-transformers-main/examples/pytorch/translation/run_translation_no_trainer.py | #!/usr/bin/env python
# coding=utf-8
# Copyright The HuggingFace Team and The HuggingFace Inc. team. 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.ap... | 24,806 | 40.345 | 119 | py |
robust-transformers | robust-transformers-main/examples/pytorch/translation/run_translation.py | #!/usr/bin/env python
# coding=utf-8
# Copyright The HuggingFace Team and The HuggingFace Inc. team. 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.ap... | 27,176 | 42.4832 | 120 | py |
robust-transformers | robust-transformers-main/examples/pytorch/language-modeling/run_mlm.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2020 The HuggingFace Team 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-... | 25,307 | 42.709845 | 119 | py |
robust-transformers | robust-transformers-main/examples/pytorch/language-modeling/run_clm_no_trainer.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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/LI... | 21,930 | 40.614801 | 242 | py |
robust-transformers | robust-transformers-main/examples/pytorch/language-modeling/run_plm.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2020 The HuggingFace Team 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-... | 22,553 | 41.878327 | 120 | py |
robust-transformers | robust-transformers-main/examples/pytorch/language-modeling/run_mlm_no_trainer.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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/LI... | 24,041 | 41.327465 | 121 | py |
robust-transformers | robust-transformers-main/examples/pytorch/language-modeling/run_clm.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team. 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/LI... | 23,726 | 42.456044 | 152 | py |
robust-transformers | robust-transformers-main/examples/pytorch/audio-classification/run_audio_classification.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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/LI... | 16,086 | 40.354756 | 119 | py |
robust-transformers | robust-transformers-main/examples/pytorch/contrastive-image-text/run_clip.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2022 The HuggingFace Team 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-... | 21,819 | 41.451362 | 119 | py |
robust-transformers | robust-transformers-main/examples/tensorflow/question-answering/run_qa.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2020 The HuggingFace Team 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-... | 30,503 | 44.664671 | 124 | py |
robust-transformers | robust-transformers-main/examples/tensorflow/question-answering/utils_qa.py | # coding=utf-8
# Copyright 2020 The HuggingFace Team 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 require... | 22,378 | 50.445977 | 135 | py |
robust-transformers | robust-transformers-main/examples/tensorflow/token-classification/run_ner.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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/LI... | 22,260 | 40.377323 | 147 | py |
robust-transformers | robust-transformers-main/examples/tensorflow/summarization/run_summarization.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Team. 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... | 27,681 | 40.689759 | 120 | py |
robust-transformers | robust-transformers-main/examples/tensorflow/text-classification/run_glue.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team. 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/LI... | 21,938 | 41.028736 | 119 | py |
robust-transformers | robust-transformers-main/examples/tensorflow/text-classification/run_text_classification.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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/LI... | 21,233 | 41.983806 | 121 | py |
robust-transformers | robust-transformers-main/examples/tensorflow/multiple-choice/run_swag.py | #!/usr/bin/env python
# coding=utf-8
# Copyright The HuggingFace Team and The HuggingFace Inc. team. 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.ap... | 21,257 | 41.516 | 119 | py |
robust-transformers | robust-transformers-main/examples/tensorflow/translation/run_translation.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Team. 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... | 26,661 | 41.933977 | 120 | py |
robust-transformers | robust-transformers-main/examples/tensorflow/language-modeling/run_mlm.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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/LI... | 24,808 | 43.065719 | 142 | py |
robust-transformers | robust-transformers-main/examples/tensorflow/language-modeling/run_clm.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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/LI... | 22,652 | 42.563462 | 142 | py |
robust-transformers | robust-transformers-main/examples/legacy/run_transfo_xl.py | #!/usr/bin/env python
# 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 co... | 6,205 | 41.506849 | 114 | py |
robust-transformers | robust-transformers-main/examples/legacy/run_swag.py | #!/usr/bin/env python
# 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.
... | 30,163 | 40.836338 | 150 | py |
robust-transformers | robust-transformers-main/examples/legacy/run_language_modeling.py | #!/usr/bin/env python
# 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.
... | 13,704 | 36.547945 | 136 | py |
robust-transformers | robust-transformers-main/examples/legacy/run_openai_gpt.py | #!/usr/bin/env python
# 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 co... | 14,269 | 43.454829 | 128 | py |
robust-transformers | robust-transformers-main/examples/legacy/run_camembert.py | #!/usr/bin/env python
import torch
from transformers import CamembertForMaskedLM, CamembertTokenizer
def fill_mask(masked_input, model, tokenizer, topk=5):
# Adapted from https://github.com/pytorch/fairseq/blob/master/fairseq/models/roberta/hub_interface.py
assert masked_input.count("<mask>") == 1
input_... | 1,935 | 39.333333 | 114 | py |
robust-transformers | robust-transformers-main/examples/legacy/question-answering/run_squad.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,739 | 40.805054 | 126 | py |
robust-transformers | robust-transformers-main/examples/legacy/pytorch-lightning/run_glue.py | import argparse
import glob
import logging
import os
import time
from argparse import Namespace
import numpy as np
import torch
from torch.utils.data import DataLoader, TensorDataset
from lightning_base import BaseTransformer, add_generic_args, generic_train
from transformers import glue_compute_metrics as compute_me... | 8,014 | 38.678218 | 119 | py |
robust-transformers | robust-transformers-main/examples/legacy/pytorch-lightning/lightning_base.py | import argparse
import logging
import os
from pathlib import Path
from typing import Any, Dict
import pytorch_lightning as pl
from pytorch_lightning.utilities import rank_zero_info
from transformers import (
AdamW,
AutoConfig,
AutoModel,
AutoModelForPreTraining,
AutoModelForQuestionAnswering,
... | 15,022 | 37.32398 | 119 | py |
robust-transformers | robust-transformers-main/examples/legacy/pytorch-lightning/run_ner.py | import argparse
import glob
import logging
import os
from argparse import Namespace
from importlib import import_module
import numpy as np
import torch
from seqeval.metrics import accuracy_score, f1_score, precision_score, recall_score
from torch.nn import CrossEntropyLoss
from torch.utils.data import DataLoader, Tens... | 9,690 | 43.865741 | 119 | py |
robust-transformers | robust-transformers-main/examples/legacy/token-classification/run_ner.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... | 12,219 | 36.950311 | 133 | py |
robust-transformers | robust-transformers-main/examples/legacy/token-classification/utils_ner.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... | 15,649 | 40.957105 | 160 | py |
robust-transformers | robust-transformers-main/examples/legacy/multiple_choice/utils_multiple_choice.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... | 20,890 | 35.018966 | 116 | py |
robust-transformers | robust-transformers-main/examples/legacy/seq2seq/run_distributed_eval.py | #!/usr/bin/env python
# Copyright 2020 The HuggingFace Team. 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... | 10,216 | 37.847909 | 119 | py |
robust-transformers | robust-transformers-main/examples/legacy/seq2seq/old_test_datasets.py | # Copyright 2020 The HuggingFace Team. 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 applicabl... | 11,060 | 43.600806 | 118 | py |
robust-transformers | robust-transformers-main/examples/legacy/seq2seq/run_eval.py | #!/usr/bin/env python
# Copyright 2020 The HuggingFace Team. 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... | 7,285 | 38.814208 | 189 | py |
robust-transformers | robust-transformers-main/examples/legacy/seq2seq/xla_spawn.py | # Copyright 2020 The HuggingFace Team. 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 applicabl... | 2,519 | 28.302326 | 108 | py |
robust-transformers | robust-transformers-main/examples/legacy/seq2seq/old_test_fsmt_bleu_score.py | # coding=utf-8
# Copyright 2020 Huggingface
#
# 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 ... | 2,504 | 33.791667 | 114 | py |
robust-transformers | robust-transformers-main/examples/legacy/seq2seq/utils.py | # Copyright 2020 The HuggingFace Team. 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 applicabl... | 25,293 | 37.03609 | 128 | py |
robust-transformers | robust-transformers-main/examples/legacy/seq2seq/old_test_tatoeba_conversion.py | # Copyright 2020 The HuggingFace Team. 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 applicabl... | 1,388 | 34.615385 | 103 | py |
robust-transformers | robust-transformers-main/examples/legacy/seq2seq/seq2seq_trainer.py | # Copyright 2020 The HuggingFace Team. 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 applicabl... | 11,141 | 42.019305 | 154 | py |
robust-transformers | robust-transformers-main/examples/legacy/seq2seq/convert_model_to_fp16.py | #!/usr/bin/env python
# Copyright 2020 The HuggingFace Team. 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... | 1,383 | 36.405405 | 117 | py |
robust-transformers | robust-transformers-main/examples/legacy/seq2seq/save_len_file.py | #!/usr/bin/env python
# Copyright 2020 The HuggingFace Team. 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... | 2,111 | 36.052632 | 111 | py |
robust-transformers | robust-transformers-main/examples/legacy/seq2seq/old_test_seq2seq_examples_multi_gpu.py | # Copyright 2020 The HuggingFace Team. 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 applicabl... | 2,032 | 35.303571 | 123 | py |
robust-transformers | robust-transformers-main/src/transformers/gcdro_loss_ga.py | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from dataclasses import dataclass, field
from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union
class GCDROLossComputerWithGA:
def __init__(self, dro_arg... | 13,707 | 47.098246 | 189 | py |
robust-transformers | robust-transformers-main/src/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... | 27,756 | 40.366617 | 137 | py |
robust-transformers | robust-transformers-main/src/transformers/modeling_flax_pytorch_utils.py | # coding=utf-8
# Copyright 2021 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... | 12,296 | 41.403448 | 143 | py |
robust-transformers | robust-transformers-main/src/transformers/trainer_dro.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... | 104,956 | 46.816401 | 170 | py |
robust-transformers | robust-transformers-main/src/transformers/configuration_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... | 46,267 | 49.236699 | 119 | py |
robust-transformers | robust-transformers-main/src/transformers/optimization_tf.py | # Copyright 2019 The TensorFlow Authors, The Hugging Face Team. 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
#
# Unl... | 15,722 | 43.667614 | 121 | py |
robust-transformers | robust-transformers-main/src/transformers/modeling_tf_pytorch_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... | 19,939 | 42.442266 | 146 | py |
robust-transformers | robust-transformers-main/src/transformers/trainer_slicer.py | """
The Trainer class, to train a group classifier using learned features of the model.
"""
import contextlib
import inspect
import math
import os
from attr import dataclass
import pandas as pd
from pandas import DataFrame
import random
import re
import shutil
import sys
import time
import warnings
from collections.ab... | 93,684 | 45.53999 | 199 | py |
robust-transformers | robust-transformers-main/src/transformers/dro_loss.py | from curses import meta
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from dataclasses import dataclass, field
from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union
@dataclass
class DroArguments:
"""... | 13,663 | 49.795539 | 134 | py |
robust-transformers | robust-transformers-main/src/transformers/modeling_outputs.py | # Copyright 2020 The HuggingFace Team. 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 applicabl... | 57,639 | 60.647059 | 194 | py |
robust-transformers | robust-transformers-main/src/transformers/dependency_versions_table.py | # THIS FILE HAS BEEN AUTOGENERATED. To update:
# 1. modify the `_deps` dict in setup.py
# 2. run `make deps_table_update``
deps = {
"Pillow": "Pillow",
"black": "black~=22.0",
"codecarbon": "codecarbon==1.2.0",
"cookiecutter": "cookiecutter==1.7.2",
"dataclasses": "dataclasses",
"datasets": "dat... | 2,329 | 31.361111 | 54 | py |
robust-transformers | robust-transformers-main/src/transformers/image_utils.py | # coding=utf-8
# Copyright 2021 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... | 12,839 | 41.8 | 130 | py |
robust-transformers | robust-transformers-main/src/transformers/modeling_utils.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors, Facebook AI Research 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 L... | 117,993 | 46.712899 | 189 | py |
robust-transformers | robust-transformers-main/src/transformers/testing_utils.py | # Copyright 2020 The HuggingFace Team. 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 applicabl... | 47,978 | 30.71117 | 119 | py |
robust-transformers | robust-transformers-main/src/transformers/modeling_flax_outputs.py | # Copyright 2021 The HuggingFace Team. 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 applicabl... | 35,519 | 58.79798 | 188 | py |
robust-transformers | robust-transformers-main/src/transformers/training_args_tf.py | # Copyright 2020 The HuggingFace Team. 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 applicabl... | 14,296 | 47.629252 | 119 | py |
robust-transformers | robust-transformers-main/src/transformers/convert_graph_to_onnx.py | # Copyright 2020 The HuggingFace Team. 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 applicabl... | 19,580 | 35.945283 | 122 | py |
robust-transformers | robust-transformers-main/src/transformers/gcdro_loss.py | import os
import torch
import torch.nn as nn
import torch.distributed as dist
from torch.distributed import ReduceOp
import torch.nn.functional as F
import numpy as np
from dataclasses import dataclass, field
from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tupl... | 13,580 | 46.15625 | 134 | py |
robust-transformers | robust-transformers-main/src/transformers/tokenization_utils_base.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... | 170,242 | 46.36867 | 222 | py |
robust-transformers | robust-transformers-main/src/transformers/convert_tf_hub_seq_to_seq_bert_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... | 2,899 | 31.58427 | 119 | py |
robust-transformers | robust-transformers-main/src/transformers/trainer_dro_ga.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... | 148,043 | 47.380392 | 189 | py |
robust-transformers | robust-transformers-main/src/transformers/trainer_callback.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... | 23,083 | 40.074733 | 130 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.