repo_id stringlengths 15 89 | file_path stringlengths 27 180 | content stringlengths 1 2.23M | __index_level_0__ int64 0 0 |
|---|---|---|---|
hf_public_repos/transformers/docs/source/en | hf_public_repos/transformers/docs/source/en/main_classes/deepspeed.md | <!--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 applicable law or agreed... | 0 |
hf_public_repos/transformers/docs/source/en | hf_public_repos/transformers/docs/source/en/main_classes/configuration.md | <!--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 applicable law or agreed... | 0 |
hf_public_repos/transformers/docs/source/en | hf_public_repos/transformers/docs/source/en/main_classes/logging.md | <!--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 applicable law or agreed... | 0 |
hf_public_repos/transformers/docs/source/en | hf_public_repos/transformers/docs/source/en/main_classes/image_processor.md | <!--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-2.0
Unless required by applicable law or agreed... | 0 |
hf_public_repos/transformers/docs/source/en | hf_public_repos/transformers/docs/source/en/main_classes/callback.md | <!--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 applicable law or agreed... | 0 |
hf_public_repos/transformers/docs/source/en | hf_public_repos/transformers/docs/source/en/main_classes/quantization.md | <!--Copyright 2023 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 applicable law or agreed... | 0 |
hf_public_repos/transformers/docs/source/en | hf_public_repos/transformers/docs/source/en/main_classes/onnx.md | <!--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 applicable law or agreed... | 0 |
hf_public_repos/transformers/docs/source | hf_public_repos/transformers/docs/source/tr/_toctree.yml | - sections:
- local: index
title: 🤗 Transformers
title: Get started | 0 |
hf_public_repos/transformers/docs/source | hf_public_repos/transformers/docs/source/tr/index.md | <!--Telif Hakkı 2020 The HuggingFace Ekibi. Tüm hakları saklıdır.
Apache Lisansı, Sürüm 2.0 (Lisans); bu dosyayı yürürlükteki yasalara uygun bir şekilde kullanabilirsiniz. Lisansın bir kopyasını aşağıdaki adresten alabilirsiniz.
http://www.apache.org/licenses/LICENSE-2.0
Lisansa tabi olmayan durumlarda veya yazılı a... | 0 |
hf_public_repos/transformers | hf_public_repos/transformers/model_cards/README.md | ## 🔥 Model cards now live inside each huggingface.co model repo 🔥
For consistency, ease of use and scalability, `README.md` model cards now live directly inside each model repo on the HuggingFace model hub.
### How to update a model card
You can directly update a model card inside any model repo you have **write ... | 0 |
hf_public_repos/transformers | hf_public_repos/transformers/examples/run_on_remote.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... | 0 |
hf_public_repos/transformers | hf_public_repos/transformers/examples/README.md | <!---
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 applicable law or a... | 0 |
hf_public_repos/transformers/examples | hf_public_repos/transformers/examples/research_projects/README.md | <!---
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 applicable law or ... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/vqgan-clip/img_processing.py | import numpy as np
import PIL
import torch
import torchvision.transforms as T
import torchvision.transforms.functional as TF
from PIL import Image
def preprocess(img, target_image_size=256):
s = min(img.size)
if s < target_image_size:
raise ValueError(f"min dim for image {s} < {target_image_size}")
... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/vqgan-clip/requirements.txt | einops
gradio
icecream
imageio
lpips
matplotlib
more_itertools
numpy
omegaconf
opencv_python_headless
Pillow
pudb
pytorch_lightning
PyYAML
requests
scikit_image
scipy
setuptools
streamlit
taming-transformers
torch
torchvision
tqdm
transformers==4.26.0
tokenizers==0.13.2
typing_extensions
wandb
| 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/vqgan-clip/VQGAN_CLIP.py | import os
from glob import glob
import imageio
import torch
import torchvision
import wandb
from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan
from loaders import load_vqgan
from PIL import Image
from torch import nn
from transformers import CLIPModel, CLIPTokenizerFast
from uti... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/vqgan-clip/loaders.py | import importlib
import torch
import yaml
from omegaconf import OmegaConf
from taming.models.vqgan import VQModel
def load_config(config_path, display=False):
config = OmegaConf.load(config_path)
if display:
print(yaml.dump(OmegaConf.to_container(config)))
return config
def load_vqgan(device, c... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/vqgan-clip/README.md | # Simple VQGAN CLIP
Author: @ErwannMillon
This is a very simple VQGAN-CLIP implementation that was built as a part of the <a href= "https://github.com/ErwannMillon/face-editor"> Face Editor project </a> . This simplified version allows you to generate or edit images using text with just three lines of code. For a mo... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/vqgan-clip/utils.py | from datetime import datetime
import matplotlib.pyplot as plt
import torch
def freeze_module(module):
for param in module.parameters():
param.requires_grad = False
def get_device():
device = "cuda" if torch.cuda.is_available() else "cpu"
if torch.backends.mps.is_available() and torch.backends.m... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/visual_bert/processing_image.py | """
coding=utf-8
Copyright 2018, Antonio Mendoza Hao Tan, Mohit Bansal
Adapted From Facebook Inc, Detectron2
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/license... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/visual_bert/modeling_frcnn.py | """
coding=utf-8
Copyright 2018, Antonio Mendoza Hao Tan, Mohit Bansal
Adapted From Facebook Inc, Detectron2 && Huggingface Co.
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... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/visual_bert/requirements.txt | appdirs==1.4.3
argon2-cffi==20.1.0
async-generator==1.10
attrs==20.2.0
backcall==0.2.0
CacheControl==0.12.6
certifi==2023.7.22
cffi==1.14.2
chardet==3.0.4
click==7.1.2
colorama==0.4.3
contextlib2==0.6.0
cycler==0.10.0
datasets==1.0.0
decorator==4.4.2
defusedxml==0.6.0
dill==0.3.2
distlib==0.3.0
distro==1.4.0
entrypoint... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/visual_bert/demo.ipynb | # %pip install-r requirements.txtfrom IPython.display import Image, display
import PIL.Image
import io
import torch
import numpy as np
from processing_image import Preprocess
from visualizing_image import SingleImageViz
from modeling_frcnn import GeneralizedRCNN
from utils import Config
import utils
from transformers i... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/visual_bert/README.md | # VisualBERT Demo
This demo shows usage of VisualBERT VQA model and is adapted from LXMERT demo present [here](https://github.com/huggingface/transformers/blob/main/examples/research_projects/lxmert/demo.ipynb).
1. make a virtualenv: ``virtualenv venv`` and activate ``source venv/bin/activate``
2. install reqs: ``pip ... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/visual_bert/utils.py | """
coding=utf-8
Copyright 2018, Antonio Mendoza Hao Tan, Mohit Bansal, Huggingface team :)
Adapted From Facebook Inc, Detectron2
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://w... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/visual_bert/visualizing_image.py | """
coding=utf-8
Copyright 2018, Antonio Mendoza Hao Tan, Mohit Bansal
Adapted From Facebook Inc, Detectron2
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/license... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/visual_bert/extracting_data.py | import getopt
import json
import os
# import numpy as np
import sys
from collections import OrderedDict
import datasets
import numpy as np
import torch
from modeling_frcnn import GeneralizedRCNN
from processing_image import Preprocess
from utils import Config
"""
USAGE:
``python extracting_data.py -i <img_dir> -o ... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/self-training-text-classification/requirements.txt | accelerate
datasets >= 1.8.0
protobuf
scikit-learn
scipy
sentencepiece != 0.1.92
torch >= 1.3
| 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/self-training-text-classification/selftraining.py | # coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/self-training-text-classification/finetuning.py | # coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/self-training-text-classification/run.sh | # Copyright 2022 The Google Research 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 agree... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/self-training-text-classification/README.md | # Self-training
This is an implementation of the self-training algorithm (without task augmentation) in the [EMNLP 2021](https://2021.emnlp.org/) paper: [STraTA: Self-Training with Task Augmentation for Better Few-shot Learning](https://arxiv.org/abs/2109.06270). Please check out https://github.com/google-research/goo... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/jax-projects/README.md | # Flax/JAX community week 🤗
Welcome to the Flax/JAX community week! The goal of this week is to make compute-intensive NLP and CV projects (like pre-training BERT, GPT2, CLIP, ViT)
practicable for a wider audience of engineers and researchers.
To do so, we will try to teach **you** how to effectively use JAX/Flax o... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/jax-projects/HOW_TO_PROPOSE_PROJECT.md | # How to propose a Flax/JAX + Transformers project
Great that you've opened this document!
While we at 🤗 are proposing a couple of projects, we strongly
believe that the community can come up with much more **creative**, **fun**, and
**impactful** projects on their own. This being said, we are really looking forw... | 0 |
hf_public_repos/transformers/examples/research_projects/jax-projects | hf_public_repos/transformers/examples/research_projects/jax-projects/big_bird/sweep_flax.yaml | command:
- python3
- train.py
method: random
parameters:
lr:
values: [4e-5, 3e-5]
warmup_steps:
values: [20000, 15000, 10000, 5000]
weight_decay:
distribution: normal
mu: 1e-2
sigma: 2e-3
metric:
... | 0 |
hf_public_repos/transformers/examples/research_projects/jax-projects | hf_public_repos/transformers/examples/research_projects/jax-projects/big_bird/requirements.txt | git+https://github.com/huggingface/transformers@main
datasets
sentencepiece
wandb
flax
jsonlines
| 0 |
hf_public_repos/transformers/examples/research_projects/jax-projects | hf_public_repos/transformers/examples/research_projects/jax-projects/big_bird/bigbird_flax.py | import json
import os
from dataclasses import dataclass
from functools import partial
from typing import Callable
import flax.linen as nn
import jax
import jax.numpy as jnp
import joblib
import optax
import wandb
from flax import jax_utils, struct, traverse_util
from flax.serialization import from_bytes, to_bytes
from... | 0 |
hf_public_repos/transformers/examples/research_projects/jax-projects | hf_public_repos/transformers/examples/research_projects/jax-projects/big_bird/README.md |
Author: [@vasudevgupta7](https://github.com/thevasudevgupta/)
## Intro
In this project, we fine-tuned [**BigBird**](https://arxiv.org/abs/2007.14062) on [**natural-questions**](https://huggingface.co/datasets/natural_questions) dataset for **question-answering** task on long documents. **BigBird**, is a **sparse-att... | 0 |
hf_public_repos/transformers/examples/research_projects/jax-projects | hf_public_repos/transformers/examples/research_projects/jax-projects/big_bird/train.py | import os
from dataclasses import replace
import jax
import wandb
from bigbird_flax import Args, DataCollator, FlaxBigBirdForNaturalQuestions, Trainer, build_tx, train_step, val_step
from datasets import load_dataset
from flax import jax_utils
from transformers import BigBirdTokenizerFast
if __name__ == "__main__":... | 0 |
hf_public_repos/transformers/examples/research_projects/jax-projects | hf_public_repos/transformers/examples/research_projects/jax-projects/big_bird/evaluate.py | import jax
import jax.numpy as jnp
from bigbird_flax import FlaxBigBirdForNaturalQuestions
from datasets import load_from_disk
from transformers import BigBirdTokenizerFast
CATEGORY_MAPPING = {0: "null", 1: "short", 2: "long", 3: "yes", 4: "no"}
PUNCTUATION_SET_TO_EXCLUDE = set("".join(["‘", "’", "´", "`", ".", ",",... | 0 |
hf_public_repos/transformers/examples/research_projects/jax-projects | hf_public_repos/transformers/examples/research_projects/jax-projects/big_bird/prepare_natural_questions.py | import os
import jsonlines
import numpy as np
from tqdm import tqdm
DOC_STRIDE = 2048
MAX_LENGTH = 4096
SEED = 42
PROCESS_TRAIN = os.environ.pop("PROCESS_TRAIN", "false")
CATEGORY_MAPPING = {"null": 0, "short": 1, "long": 2, "yes": 3, "no": 4}
def _get_single_answer(example):
def choose_first(answer, is_long_a... | 0 |
hf_public_repos/transformers/examples/research_projects/jax-projects | hf_public_repos/transformers/examples/research_projects/jax-projects/hybrid_clip/requirements.txt | jax>=0.2.8
jaxlib>=0.1.59
flax>=0.3.5
optax>=0.0.8
-f https://download.pytorch.org/whl/torch_stable.html
torch==1.9.0+cpu
-f https://download.pytorch.org/whl/torch_stable.html
torchvision==0.10.0+cpu | 0 |
hf_public_repos/transformers/examples/research_projects/jax-projects | hf_public_repos/transformers/examples/research_projects/jax-projects/hybrid_clip/modeling_hybrid_clip.py | # 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-2.0
#
# Unless requir... | 0 |
hf_public_repos/transformers/examples/research_projects/jax-projects | hf_public_repos/transformers/examples/research_projects/jax-projects/hybrid_clip/README.md | <!---
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 applicable law or ... | 0 |
hf_public_repos/transformers/examples/research_projects/jax-projects | hf_public_repos/transformers/examples/research_projects/jax-projects/hybrid_clip/configuration_hybrid_clip.py | import copy
from transformers.configuration_utils import PretrainedConfig
from transformers.utils import logging
logger = logging.get_logger(__name__)
class HybridCLIPConfig(PretrainedConfig):
r"""
:class:`HybridCLIPConfig` is the configuration class to store the configuration of a
:class:`~HybridCLIPM... | 0 |
hf_public_repos/transformers/examples/research_projects/jax-projects | hf_public_repos/transformers/examples/research_projects/jax-projects/hybrid_clip/run_hybrid_clip.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-... | 0 |
hf_public_repos/transformers/examples/research_projects/jax-projects | hf_public_repos/transformers/examples/research_projects/jax-projects/wav2vec2/run_wav2vec2_pretrain_flax.py | #!/usr/bin/env python3
import logging
import sys
import time
from dataclasses import field
from pathlib import Path
from typing import Dict, List, Optional, Union
import flax
import jax
import jax.numpy as jnp
import librosa
import numpy as np
import optax
from datasets import DatasetDict, load_dataset
from flax impor... | 0 |
hf_public_repos/transformers/examples/research_projects/jax-projects | hf_public_repos/transformers/examples/research_projects/jax-projects/wav2vec2/README.md | # Wav2Vec2 Contrastive Loss PreTraining examples
The following example showcases how to pretrain a wav2vec2 model using the JAX/Flax backend.
Pretraining Wav2Vec2 is rather complex, so it is highly recommended to read the
[official paper](https://arxiv.org/abs/2006.11477).
JAX/Flax allows you to trace pure functions... | 0 |
hf_public_repos/transformers/examples/research_projects/jax-projects | hf_public_repos/transformers/examples/research_projects/jax-projects/model_parallel/partitions.py | #!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The Google Research Authors and 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://... | 0 |
hf_public_repos/transformers/examples/research_projects/jax-projects | hf_public_repos/transformers/examples/research_projects/jax-projects/model_parallel/README.md | <!---
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 applicable law or ... | 0 |
hf_public_repos/transformers/examples/research_projects/jax-projects | hf_public_repos/transformers/examples/research_projects/jax-projects/model_parallel/run_clm_mp.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-... | 0 |
hf_public_repos/transformers/examples/research_projects/jax-projects | hf_public_repos/transformers/examples/research_projects/jax-projects/dataset-streaming/run_mlm_flax_stream.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-... | 0 |
hf_public_repos/transformers/examples/research_projects/jax-projects | hf_public_repos/transformers/examples/research_projects/jax-projects/dataset-streaming/README.md | <!---
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 applicable law or ... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/information-gain-filtration/requirements.txt | matplotlib
numpy>=1.17.2
joblib>=0.13.2
scipy
torch>=1.10.1
transformers>=3.5 | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/information-gain-filtration/run_clm_igf.py | # Copyright 2022 - Intel Corp. All rights reserved.
# Authors: Mayank Kumar Raunak, Javier Turek, Nicole Beckage
"""
Implementation of a new method for fine-tuning transformer models that we call
Information Gain Filtration 'IGF' on WikiText data set and compared the results
with the standard fine-tuning method
Steps... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/information-gain-filtration/README.md |
# Information Gain Filtration(IGF)
Authors @Tuko @mraunak
This folder contains the code how to implement IGF for finetuning on GPT-2.
## What is IGF?
Here we present a general fine-tuning method that we call information gain filtration for improving the overall training efficiency and final
performance of language... | 0 |
hf_public_repos/transformers/examples/research_projects/information-gain-filtration | hf_public_repos/transformers/examples/research_projects/information-gain-filtration/igf/igf.py | # Copyright 2022 - Intel Corp. All rights reserved.
# Authors: Mayank Kumar Raunak, Javier Turek, Nicole Backage
import copy
import logging
import random
import joblib
import numpy as np
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from tqdm import tqdm
from transformers import AdamW, G... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/performer/run_mlm_performer.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... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/performer/full_script.sh | TOKENIZERS_PARALLELISM=true python run_mlm_performer.py --output_dir experiments --dataset_name wikipedia --dataset_config_name 20200501.en --model_name_or_path bert-large-cased --tokenizer_name bert-large-cased --do_train --overwrite_output_dir --per_device_train_batch_size 4 --learning_rate 5e-4 --warmup_steps 100 -... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/performer/README.md | # Performer fine-tuning
Example authors: @TevenLeScao, @Patrickvonplaten
Paper authors: Krzysztof Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Davis, Afroz Mohiuddin, Lukasz Kaiser, David Belanger, Lucy Colwell, Adrian Weller
## Requirements
`datase... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/performer/modeling_flax_performer_utils.py | # coding=utf-8
# Copyright 2020 The Google Research 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 applicab... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/performer/sanity_script.sh | TOKENIZERS_PARALLELISM=true python run_mlm_performer.py --output_dir experiments --dataset_name wikipedia --dataset_config_name 20200501.simple --model_name_or_path bert-base-cased --tokenizer_name bert-base-cased --do_train --overwrite_output_dir --per_device_train_batch_size 4 --learning_rate 5e-4 --warmup_steps 100... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/performer/modeling_flax_performer.py | # coding=utf-8
# Copyright 2018 The Google Flax 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
... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/bertabs/requirements.txt | transformers == 3.5.1
# For ROUGE
nltk
py-rouge
| 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/bertabs/run_summarization.py | #! /usr/bin/python3
import argparse
import logging
import os
import sys
from collections import namedtuple
import torch
from modeling_bertabs import BertAbs, build_predictor
from torch.utils.data import DataLoader, SequentialSampler
from tqdm import tqdm
from transformers import BertTokenizer
from .utils_summarizati... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/bertabs/convert_bertabs_original_pytorch_checkpoint.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... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/bertabs/configuration_bertabs.py | # coding=utf-8
# Copyright 2019 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... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/bertabs/README.md | # Text Summarization with Pretrained Encoders
This folder contains part of the code necessary to reproduce the results on abstractive summarization from the article [Text Summarization with Pretrained Encoders](https://arxiv.org/pdf/1908.08345.pdf) by [Yang Liu](https://nlp-yang.github.io/) and [Mirella Lapata](https:... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/bertabs/utils_summarization.py | import os
from collections import deque
import torch
from torch.utils.data import Dataset
# ------------
# Data loading
# ------------
class CNNDMDataset(Dataset):
"""Abstracts the dataset used to train seq2seq models.
The class will process the documents that are located in the specified
folder. The ... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/bertabs/modeling_bertabs.py | # MIT License
# Copyright (c) 2019 Yang Liu and the HuggingFace team
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, c... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/bertabs/test_utils_summarization.py | # coding=utf-8
# Copyright 2019 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 applicable law or ag... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/luke/README.md | # Token classification
## PyTorch version, no Trainer
Fine-tuning (m)LUKE for token classification task such as Named Entity Recognition (NER), Parts-of-speech
tagging (POS) or phrase extraction (CHUNKS). You can easily
customize it to your needs if you need extra processing on your datasets.
It will either run on a... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/luke/run_luke_ner_no_trainer.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... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/luke/luke_utils.py | import unicodedata
from dataclasses import dataclass
from typing import Optional, Union
import numpy as np
from transformers.data.data_collator import DataCollatorMixin
from transformers.file_utils import PaddingStrategy
from transformers.tokenization_utils_base import PreTrainedTokenizerBase
def padding_tensor(seq... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/adversarial/requirements.txt | transformers == 3.5.1
| 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/adversarial/run_hans.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... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/adversarial/README.md | ## Adversarial evaluation of model performances
Here is an example on evaluating a model using adversarial evaluation of natural language inference with the Heuristic Analysis for NLI Systems (HANS) dataset [McCoy et al., 2019](https://arxiv.org/abs/1902.01007). The example was gracefully provided by [Nafise Sadat Moo... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/adversarial/utils_hans.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... | 0 |
hf_public_repos/transformers/examples/research_projects/onnx | hf_public_repos/transformers/examples/research_projects/onnx/summarization/requirements.txt | torch >= 1.10 | 0 |
hf_public_repos/transformers/examples/research_projects/onnx | hf_public_repos/transformers/examples/research_projects/onnx/summarization/run_onnx_exporter.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... | 0 |
hf_public_repos/transformers/examples/research_projects/onnx | hf_public_repos/transformers/examples/research_projects/onnx/summarization/README.md | <!---
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 applicable law or a... | 0 |
hf_public_repos/transformers/examples/research_projects/onnx/summarization | hf_public_repos/transformers/examples/research_projects/onnx/summarization/bart_onnx/reduce_onnx_size.py | """
Code to remove duplicate initializers to reduce ONNX model size.
"""
import os
import numpy
import onnx
def _is_equal_tensor_proto(a, b):
name_a = a.name
name_b = b.name
a.name = ""
b.name = ""
res = a == b
a.name = name_a
b.name = name_b
return res
def _node_replace_input_... | 0 |
hf_public_repos/transformers/examples/research_projects/onnx/summarization | hf_public_repos/transformers/examples/research_projects/onnx/summarization/bart_onnx/generation_onnx.py | import copy
import itertools
from typing import List, Optional, Tuple
import torch
import torch.nn.functional as F
from transformers import BartConfig
from transformers.generation import GenerationMixin
def _convert_past_list_to_tuple(past_key_values):
"""
In Bart model, the type of past_key_values is tuple... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/lxmert/processing_image.py | """
coding=utf-8
Copyright 2018, Antonio Mendoza Hao Tan, Mohit Bansal
Adapted From Facebook Inc, Detectron2
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/license... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/lxmert/modeling_frcnn.py | """
coding=utf-8
Copyright 2018, Antonio Mendoza Hao Tan, Mohit Bansal
Adapted From Facebook Inc, Detectron2 && Huggingface Co.
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... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/lxmert/requirements.txt | appdirs==1.4.3
argon2-cffi==20.1.0
async-generator==1.10
attrs==20.2.0
backcall==0.2.0
CacheControl==0.12.6
certifi==2023.7.22
cffi==1.14.2
chardet==3.0.4
click==7.1.2
colorama==0.4.3
contextlib2==0.6.0
cycler==0.10.0
datasets==1.0.0
decorator==4.4.2
defusedxml==0.6.0
dill==0.3.2
distlib==0.3.0
distro==1.4.0
entrypoint... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/lxmert/demo.ipynb | # %pip install-r requirements.txtfrom IPython.display import clear_output, Image, display
import PIL.Image
import io
import json
import torch
import numpy as np
from processing_image import Preprocess
from visualizing_image import SingleImageViz
from modeling_frcnn import GeneralizedRCNN
from utils import Config
import... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/lxmert/README.md | # LXMERT DEMO
1. make a virtualenv: ``virtualenv venv`` and activate ``source venv/bin/activate``
2. install reqs: ``pip install -r ./requirements.txt``
3. usage is as shown in demo.ipynb
| 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/lxmert/utils.py | """
coding=utf-8
Copyright 2018, Antonio Mendoza Hao Tan, Mohit Bansal, Huggingface team :)
Adapted From Facebook Inc, Detectron2
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://w... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/lxmert/visualizing_image.py | """
coding=utf-8
Copyright 2018, Antonio Mendoza Hao Tan, Mohit Bansal
Adapted From Facebook Inc, Detectron2
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/license... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/lxmert/extracting_data.py | import getopt
import json
import os
# import numpy as np
import sys
from collections import OrderedDict
import datasets
import numpy as np
import torch
from modeling_frcnn import GeneralizedRCNN
from processing_image import Preprocess
from utils import Config
"""
USAGE:
``python extracting_data.py -i <img_dir> -o ... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/codeparrot/requirements.txt | transformers==4.19.0
datasets==1.16.0
wandb==0.12.0
tensorboard==2.6.0
torch==1.11.0
huggingface-hub==0.1.0
git+https://github.com/huggingface/accelerate.git@3c45b6f760ad8745be9ebc9bbb26f5b04dea4abe
datasketch==1.5.7
dpu_utils | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/codeparrot/README.md | # CodeParrot 🦜
<p align="center">
<img src="https://huggingface.co/datasets/lvwerra/repo-images/raw/main/code-highlighting-streamlit.png" alt="drawing" width="350"/>
</p>
## What is this about?
This is an open-source effort to train and evaluate code generation models. CodeParrot 🦜 is a GPT-2 model trained from ... | 0 |
hf_public_repos/transformers/examples/research_projects/codeparrot | hf_public_repos/transformers/examples/research_projects/codeparrot/examples/requirements.txt | datasets==2.3.2
transformers==4.21.1
wandb==0.13.1
evaluate==0.2.2
scikit-learn==1.1.2 | 0 |
hf_public_repos/transformers/examples/research_projects/codeparrot | hf_public_repos/transformers/examples/research_projects/codeparrot/examples/train_complexity_predictor.py | import argparse
from copy import deepcopy
import numpy as np
from datasets import ClassLabel, DatasetDict, load_dataset
from evaluate import load
from transformers import (
AutoModelForSequenceClassification,
AutoTokenizer,
DataCollatorWithPadding,
Trainer,
TrainerCallback,
TrainingArguments,
... | 0 |
hf_public_repos/transformers/examples/research_projects/codeparrot | hf_public_repos/transformers/examples/research_projects/codeparrot/examples/README.md | # Examples
In this folder we showcase some examples to use code models for downstream tasks.
## Complexity prediction
In this task we want to predict the complexity of Java programs in [CodeComplex](https://huggingface.co/datasets/codeparrot/codecomplex) dataset. Using Hugging Face `trainer`, we finetuned [multilingua... | 0 |
hf_public_repos/transformers/examples/research_projects/codeparrot | hf_public_repos/transformers/examples/research_projects/codeparrot/scripts/initialize_model.py | from arguments import InitializationArguments
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser
# Configuration
parser = HfArgumentParser(InitializationArguments)
args = parser.parse_args()
# Load codeparrot tokenizer trained for Python code tokenization
tokenizer = AutoToke... | 0 |
hf_public_repos/transformers/examples/research_projects/codeparrot | hf_public_repos/transformers/examples/research_projects/codeparrot/scripts/human_eval.py | import json
import multiprocessing
import os
import re
from collections import defaultdict
import torch
from accelerate import Accelerator
from accelerate.utils import set_seed
from arguments import HumanEvalArguments
from datasets import load_dataset, load_metric
from torch.utils.data import IterableDataset
from torc... | 0 |
hf_public_repos/transformers/examples/research_projects/codeparrot | hf_public_repos/transformers/examples/research_projects/codeparrot/scripts/bpe_training.py | from arguments import TokenizerTrainingArguments
from datasets import load_dataset
from tqdm import tqdm
from transformers import AutoTokenizer, HfArgumentParser
from transformers.models.gpt2.tokenization_gpt2 import bytes_to_unicode
# Iterator for Training
def batch_iterator(batch_size=10):
for _ in tqdm(range(... | 0 |
hf_public_repos/transformers/examples/research_projects/codeparrot | hf_public_repos/transformers/examples/research_projects/codeparrot/scripts/validation_loss.py | import logging
import torch
from accelerate import Accelerator
from arguments import EvaluationArguments
from datasets import load_dataset
from torch.utils.data import IterableDataset
from torch.utils.data.dataloader import DataLoader
from transformers import AutoModelForCausalLM, AutoTokenizer, HfArgumentParser, set... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.