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/examples/research_projects
hf_public_repos/transformers/examples/research_projects/wav2vec2/finetune_large_lv60_100.sh
#!/usr/bin/env bash python run_asr.py \ --output_dir="./wav2vec2-large-lv60-100h" \ --num_train_epochs="30" \ --per_device_train_batch_size="16" \ --per_device_eval_batch_size="16" \ --evaluation_strategy="steps" \ --save_total_limit="3" \ --save_steps="500" \ --eval_steps="100" \ --logging_steps="50" \ --learning_rate...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/wav2vec2/run_asr.py
#!/usr/bin/env python3 import logging import pathlib import re import sys from dataclasses import dataclass, field from typing import Any, Callable, Dict, List, Optional, Set, Union import datasets import librosa import numpy as np import torch from lang_trans import arabic from packaging import version from torch imp...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/wav2vec2/test_wav2vec2_deepspeed.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...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/wav2vec2/finetune_base_100.sh
#!/usr/bin/env bash python run_asr.py \ --output_dir="./wav2vec2-base-100h" \ --num_train_epochs="30" \ --per_device_train_batch_size="32" \ --per_device_eval_batch_size="32" \ --evaluation_strategy="steps" \ --save_total_limit="3" \ --save_steps="500" \ --eval_steps="100" \ --logging_steps="50" \ --learning_rate="5e-4...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/wav2vec2/run_common_voice.py
#!/usr/bin/env python3 import json import logging import os import re import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import datasets import numpy as np import torch import torchaudio from packaging import version from torch import nn import transformers from tr...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/wav2vec2/finetune_base_timit_asr.sh
#!/usr/bin/env bash python run_asr.py \ --output_dir="./wav2vec2-base-timit-asr" \ --num_train_epochs="30" \ --per_device_train_batch_size="20" \ --per_device_eval_batch_size="20" \ --evaluation_strategy="steps" \ --save_steps="500" \ --eval_steps="100" \ --logging_steps="50" \ --learning_rate="5e-4" \ --warmup_steps="...
0
hf_public_repos/transformers/examples/research_projects/wav2vec2
hf_public_repos/transformers/examples/research_projects/wav2vec2/vocab/buckwalter.json
{ "<pad>": 0, "<s>": 1, "</s>": 2, "<unk>": 3, "/": 4, "'": 5, "|": 6, ">": 7, "&": 8, "<": 9, "}": 10, "A": 11, "b": 12, "p": 13, "t": 14, "v": 15, "j": 16, "H": 17, "x": 18, "d": 19, "*": 20, "r": 21, "z": 22, "s": 23, ...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/zero-shot-distillation/distill_classifier.py
import logging import os import sys from dataclasses import dataclass, field from typing import List, Optional import torch from datasets import Dataset from torch import nn from tqdm.auto import tqdm from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, HfArgumentParser, Train...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/zero-shot-distillation/README.md
# Zero-shot classifier distillation Author: @joeddav This script provides a way to improve the speed and memory performance of a zero-shot classifier by training a more efficient student model from the zero-shot teacher's predictions over an unlabeled dataset. The zero-shot classification pipeline uses a model pre-...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/pplm/requirements.txt
tensorboard scikit-learn seqeval psutil sacrebleu rouge-score tensorflow_datasets pytorch-lightning matplotlib git-python==1.0.3 faiss-cpu streamlit elasticsearch nltk pandas datasets >= 1.1.3 fire pytest conllu sentencepiece != 0.1.92 protobuf transformers==3.5.1
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/pplm/run_pplm.py
#! /usr/bin/env python3 # coding=utf-8 # Copyright (c) 2019 Uber Technologies, 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 ...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/pplm/README.md
# Plug and Play Language Models: a Simple Approach to Controlled Text Generation Authors: [Sumanth Dathathri](https://dathath.github.io/), [Andrea Madotto](https://andreamad8.github.io/), Janice Lan, Jane Hung, Eric Frank, [Piero Molino](https://w4nderlu.st/), [Jason Yosinski](http://yosinski.com/), and [Rosanne Liu](...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/pplm/pplm_classification_head.py
from torch import nn class ClassificationHead(nn.Module): """Classification Head for transformer encoders""" def __init__(self, class_size, embed_size): super().__init__() self.class_size = class_size self.embed_size = embed_size # self.mlp1 = nn.Linear(embed_size, embed_size...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/pplm/run_pplm_discrim_train.py
#! /usr/bin/env python3 # coding=utf-8 # Copyright (c) 2019 Uber Technologies, 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 ...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/deebert/requirements.txt
transformers == 3.5.1
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/deebert/run_glue_deebert.py
from __future__ import absolute_import, division, print_function import argparse import glob import logging import os import random import time import numpy as np import torch from torch import nn from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from torch.utils.data.distribute...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/deebert/README.md
# DeeBERT: Early Exiting for *BERT This is the code base for the paper [DeeBERT: Dynamic Early Exiting for Accelerating BERT Inference](https://www.aclweb.org/anthology/2020.acl-main.204/), modified from its [original code base](https://github.com/castorini/deebert). The original code base also has information for do...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/deebert/entropy_eval.sh
#!/bin/bash export CUDA_VISIBLE_DEVICES=0 PATH_TO_DATA=/h/xinji/projects/GLUE MODEL_TYPE=bert # bert or roberta MODEL_SIZE=base # base or large DATASET=MRPC # SST-2, MRPC, RTE, QNLI, QQP, or MNLI MODEL_NAME=${MODEL_TYPE}-${MODEL_SIZE} if [ $MODEL_TYPE = 'bert' ] then MODEL_NAME=${MODEL_NAME}-uncased fi ENTROPI...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/deebert/test_glue_deebert.py
import argparse import logging import sys from unittest.mock import patch import run_glue_deebert from transformers.testing_utils import TestCasePlus, get_gpu_count, require_torch_non_multi_gpu, slow logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger() def get_setup_file(): parser = argparse...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/deebert/eval_deebert.sh
#!/bin/bash export CUDA_VISIBLE_DEVICES=0 PATH_TO_DATA=/h/xinji/projects/GLUE MODEL_TYPE=bert # bert or roberta MODEL_SIZE=base # base or large DATASET=MRPC # SST-2, MRPC, RTE, QNLI, QQP, or MNLI MODEL_NAME=${MODEL_TYPE}-${MODEL_SIZE} if [ $MODEL_TYPE = 'bert' ] then MODEL_NAME=${MODEL_NAME}-uncased fi python...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/deebert/train_deebert.sh
#!/bin/bash export CUDA_VISIBLE_DEVICES=0 PATH_TO_DATA=/h/xinji/projects/GLUE MODEL_TYPE=bert # bert or roberta MODEL_SIZE=base # base or large DATASET=MRPC # SST-2, MRPC, RTE, QNLI, QQP, or MNLI MODEL_NAME=${MODEL_TYPE}-${MODEL_SIZE} EPOCHS=10 if [ $MODEL_TYPE = 'bert' ] then EPOCHS=3 MODEL_NAME=${MODEL_NAME...
0
hf_public_repos/transformers/examples/research_projects/deebert
hf_public_repos/transformers/examples/research_projects/deebert/src/modeling_highway_roberta.py
from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.roberta...
0
hf_public_repos/transformers/examples/research_projects/deebert
hf_public_repos/transformers/examples/research_projects/deebert/src/modeling_highway_bert.py
import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, BertEmbeddings, BertLayer, ...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/tapex/requirements.txt
numpy datasets pandas nltk
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/tapex/run_wikitablequestions_with_tapex.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2022 The Microsoft 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.apac...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/tapex/README.md
<!--- Copyright 2022 The Microsoft Inc. 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.apache.org/licenses/LICENSE-2.0 Unless re...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/tapex/wikisql_utils.py
# coding=utf-8 # Copyright 2022 The Microsoft, The Google 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.apache.org/lic...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/tapex/run_wikisql_with_tapex.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2022 The Microsoft 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.apac...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/tapex/run_tabfact_with_tapex.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2022 The Microsoft 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.apac...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/movement-pruning/bertarize.py
# 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 applicable law o...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/movement-pruning/requirements.txt
torch>=1.4.0 -e git+https://github.com/huggingface/transformers.git@352d5472b0c1dec0f420d606d16747d851b4bda8#egg=transformers knockknock>=0.1.8.1 h5py>=2.10.0 numpy>=1.18.2 scipy>=1.4.1
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/movement-pruning/counts_parameters.py
# 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 applicable law o...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/movement-pruning/README.md
# Movement Pruning: Adaptive Sparsity by Fine-Tuning Author: @VictorSanh *Magnitude pruning is a widely used strategy for reducing model size in pure supervised learning; however, it is less effective in the transfer learning regime that has become standard for state-of-the-art natural language processing application...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/movement-pruning/masked_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...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/movement-pruning/masked_run_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...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/movement-pruning/Saving_PruneBERT.ipynb
# Includes import h5py import os import json from collections import OrderedDict from scipy import sparse import numpy as np import torch from torch import nn from transformers import * os.chdir("../../")# Load fine-pruned model and quantize the model model = BertForQuestionAnswering.from_pretrained("huggingface/...
0
hf_public_repos/transformers/examples/research_projects/movement-pruning
hf_public_repos/transformers/examples/research_projects/movement-pruning/emmental/configuration_bert_masked.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/movement-pruning
hf_public_repos/transformers/examples/research_projects/movement-pruning/emmental/__init__.py
from .configuration_bert_masked import MaskedBertConfig from .modeling_bert_masked import ( MaskedBertForMultipleChoice, MaskedBertForQuestionAnswering, MaskedBertForSequenceClassification, MaskedBertForTokenClassification, MaskedBertModel, ) from .modules import *
0
hf_public_repos/transformers/examples/research_projects/movement-pruning
hf_public_repos/transformers/examples/research_projects/movement-pruning/emmental/modeling_bert_masked.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/movement-pruning/emmental
hf_public_repos/transformers/examples/research_projects/movement-pruning/emmental/modules/masked_nn.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 a...
0
hf_public_repos/transformers/examples/research_projects/movement-pruning/emmental
hf_public_repos/transformers/examples/research_projects/movement-pruning/emmental/modules/__init__.py
from .binarizer import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer from .masked_nn import MaskedLinear
0
hf_public_repos/transformers/examples/research_projects/movement-pruning/emmental
hf_public_repos/transformers/examples/research_projects/movement-pruning/emmental/modules/binarizer.py
# coding=utf-8 # Copyright 2020-present, AllenAI Authors, University of Illinois Urbana-Champaign, # Intel Nervana Systems 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 ...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/finetune_rag.py
"""Finetuning script for RAG models. Adapted from examples.seq2seq.finetune.py""" import argparse import copy import json import logging import multiprocessing import os import random import shutil import sys import time from collections import defaultdict from pathlib import Path from typing import Any, Dict, List, T...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/utils_rag.py
import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data import Dataset from transfo...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/requirements.txt
faiss-cpu >= 1.7.2 datasets psutil >= 5.9.1 torch >= 1.11.0 pytorch-lightning == 1.6.4 nvidia-ml-py3 == 7.352.0 ray >= 1.13.0
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/finetune_rag_ray_end2end.sh
# Sample script to finetune RAG using Ray for distributed retrieval. # Add parent directory to python path to access lightning_base.py export PYTHONPATH="../":"${PYTHONPATH}" #creates the custom knowlegebase python use_own_knowledge_dataset.py \ --csv_path /DIR/SQUAD-KB/squad-kb.csv \ --output_dir /DIR/SQUA...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/callbacks_rag.py
import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def count_trainable_parameters(model): model_paramet...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/kb_encode_utils.py
import os from functools import partial from glob import glob import faiss from datasets import Features, Sequence, Value, concatenate_datasets, load_dataset, load_from_disk from transformers import DPRContextEncoder, DPRContextEncoderTokenizerFast def split_text(text, n=100, character=" "): """Split the text e...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/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, ...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/README.md
# End-to-End finetuning of RAG (including DPR retriever) for Question Answering. This finetuning script is actively maintained by [Shamane Siri](https://github.com/shamanez). Feel free to ask questions on the [Forum](https://discuss.huggingface.co/) or post an issue on [GitHub](https://github.com/huggingface/transform...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/distributed_ray_retriever.py
import logging import random import ray from transformers import RagConfig, RagRetriever, RagTokenizer from transformers.models.rag.retrieval_rag import CustomHFIndex logger = logging.getLogger(__name__) class RayRetriever: def __init__(self): self.initialized = False def create_rag_retriever(sel...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/eval_rag.py
""" Evaluation script for RAG models.""" import argparse import ast import logging import os import sys import pandas as pd import torch from tqdm import tqdm from transformers import BartForConditionalGeneration, RagRetriever, RagSequenceForGeneration, RagTokenForGeneration from transformers import logging as trans...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/use_own_knowledge_dataset.py
import logging import os from dataclasses import dataclass, field from functools import partial from pathlib import Path from tempfile import TemporaryDirectory from typing import List, Optional import faiss import torch from datasets import Features, Sequence, Value, load_dataset from transformers import DPRContextE...
0
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/test_run/test_finetune.sh
# Add parent directory to python path to access lightning_base.py export PYTHONPATH="../":"${PYTHONPATH}" #creates the custom knowlegebase python use_own_knowledge_dataset.py # Start a single-node Ray cluster. ray start --head # A sample finetuning run, you need to specify data_dir, output_dir and model_name_or_pat...
0
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/test_run/test_rag_new_features.sh
export PYTHONPATH="../":"${PYTHONPATH}" python use_own_knowledge_dataset.py ray start --head python finetune_rag.py \ --model_name_or_path facebook/rag-token-base \ --model_type rag_token \ --context_encoder_name facebook/dpr-ctx_encoder-multiset-base \ --fp16 \ --gpus 1 \ --profile \ --e...
0
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/test_run
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/test_run/dummy-train-data/train.target
to a snake Moses' assistant Egyptian royal court let his rod turn in to a snake The Pokémon Company Nintendo world's top-selling toy brand, the top-selling trading card game over 20 seasons to a snake Moses' assistant Egyptian royal court let his rod turn in to a snake The Pokémon Company Nintendo world's top-selling...
0
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/test_run
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/test_run/dummy-train-data/train.source
What does Moses' rod turn into ? Who is Aron? Where did Moses grow up ? What happens at the command of the Moses ? Who manages the Pokémon ? Who owned the Pokémon trademark ? What else include in Pokémon franchise ? How many seasons in Pokémon animme series ? What does Moses' rod turn into ? Who is Aron? Where did Mose...
0
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/test_run
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/test_run/dummy-train-data/val.source
What does Moses' rod turn into ? Who is Aron? Where did Moses grow up ? What happens at the command of the Moses ? Who manages the Pokémon ? Who owned the Pokémon trademark ? What else include in Pokémon franchise ? How many seasons in Pokémon animme series ?
0
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/test_run
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/test_run/dummy-train-data/val.target
to a snake Moses' assistant Egyptian royal court let his rod turn in to a snake The Pokémon Company Nintendo world's top-selling toy brand, the top-selling trading card game over 20 seasons
0
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/test_run
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/test_run/dummy-train-data/test.source
What does Moses' rod turn into ? Who is Aron? Where did Moses grow up ? What happens at the command of the Moses ? Who manages the Pokémon ? Who owned the Pokémon trademark ? What else include in Pokémon franchise ? How many seasons in Pokémon animme series ?
0
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/test_run
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/test_run/dummy-train-data/test.target
to a snake Moses' assistant Egyptian royal court let his rod turn in to a snake The Pokémon Company Nintendo world's top-selling toy brand, the top-selling trading card game over 20 seasons
0
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/test_run
hf_public_repos/transformers/examples/research_projects/rag-end2end-retriever/test_run/dummy-kb/my_knowledge_dataset.csv
Aaron Aaron Aaron ( or ; "Ahärôn") is a prophet, high priest, and the brother of Moses in the Abrahamic religions. Knowledge of Aaron, along with his brother Moses, comes exclusively from religious texts, such as the Bible and Quran. The Hebrew Bible relates that, unlike Moses, who grew up in the Egyptian royal court, ...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/decision_transformer/requirements.txt
absl-py==1.0.0 aiohttp==3.8.5 aiosignal==1.2.0 alembic==1.7.7 appdirs==1.4.4 APScheduler==3.9.1 arrow==1.2.2 asttokens==2.0.5 astunparse==1.6.3 async-timeout==4.0.2 attrs==21.4.0 audioread==2.1.9 autopage==0.5.0 backcall==0.2.0 backoff==1.11.1 backports.zoneinfo==0.2.1 binaryornot==0.4.4 black==22.1.0 boto3==1.16.34 bo...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/decision_transformer/run_decision_transformer.py
import gym import numpy as np import torch from mujoco_py import GlfwContext from transformers import DecisionTransformerModel GlfwContext(offscreen=True) # Create a window to init GLFW. def get_action(model, states, actions, rewards, returns_to_go, timesteps): # we don't care about the past rewards in this m...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/xtreme-s/requirements.txt
datasets >= 1.18.0 torch >= 1.5 torchaudio librosa jiwer
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/xtreme-s/README.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 ...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/xtreme-s/run_xtreme_s.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/longform-qa/requirements.txt
datasets >= 1.1.3 faiss-cpu streamlit elasticsearch
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/longform-qa/README.md
# Long Form Question Answering Author: @yjernite This folder contains the code for the Long Form Question answering [demo](http://35.226.96.115:8080/) as well as methods to train and use a fully end-to-end Long Form Question Answering system using the [🤗transformers](https://github.com/huggingface/transformers) and ...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/longform-qa/eli5_app.py
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from eli5_utils import ( embed_questions_for_retrieval, make_qa_s2s_model, qa_s2s_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers impor...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/longform-qa/eli5_utils.py
import functools import math import os # noqa: F401 from random import choice, randint from time import time import datasets # noqa: F401 import faiss # noqa: F401 import numpy as np import pandas as pd import torch import torch.utils.checkpoint as checkpoint from elasticsearch import Elasticsearch # noqa: F401 fr...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/bert-loses-patience/test_run_glue_with_pabee.py
import argparse import logging import sys from unittest.mock import patch import run_glue_with_pabee from transformers.testing_utils import TestCasePlus logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger() def get_setup_file(): parser = argparse.ArgumentParser() parser.add_argument("-f")...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/bert-loses-patience/requirements.txt
transformers == 3.5.1
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/bert-loses-patience/run_glue_with_pabee.py
# coding=utf-8 # Copyright 2020 The Google AI Language Team Authors, The HuggingFace Inc. team and Microsoft Corporation. # 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....
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/bert-loses-patience/README.md
# Patience-based Early Exit Patience-based Early Exit (PABEE) is a plug-and-play inference method for pretrained language models. We have already implemented it on BERT and ALBERT. Basically, you can make your LM faster and more robust with PABEE. It can even improve the performance of ALBERT on GLUE. The only sacrifi...
0
hf_public_repos/transformers/examples/research_projects/bert-loses-patience
hf_public_repos/transformers/examples/research_projects/bert-loses-patience/pabee/modeling_pabee_albert.py
# coding=utf-8 # Copyright 2020 Google AI, Google Brain, the HuggingFace Inc. team and Microsoft Corporation. # # 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/lic...
0
hf_public_repos/transformers/examples/research_projects/bert-loses-patience
hf_public_repos/transformers/examples/research_projects/bert-loses-patience/pabee/modeling_pabee_bert.py
# coding=utf-8 # Copyright 2020 The Google AI Language Team Authors, The HuggingFace Inc. team and Microsoft Corporation. # 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....
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/bertology/requirements.txt
transformers == 3.5.1
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/bertology/run_prune_gpt.py
#!/usr/bin/env python3 """ This script is adapted from the Bertology pruning code (https://github.com/huggingface/transformers/blob/783d7d2629e97c5f0c5f9ef01b8c66410275c204/examples/research_projects/bertology/run_bertology.py) to prune GPT-like models. The author is @altsoph. """ import argparse import logging import...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/bertology/run_bertology.py
#!/usr/bin/env python3 # Copyright 2018 CMU 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 requir...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/fsner/requirements.txt
transformers>=4.9.2
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/fsner/pyproject.toml
[build-system] requires = [ "setuptools>=57.4.0", "wheel>=0.37.0", "transformers>=4.9.2" ] build-backend = "setuptools.build_meta"
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/fsner/README.md
<p align="center"> <img src="http://sayef.tech:8082/uploads/FSNER-LOGO-2.png" alt="FSNER LOGO"> </p> <p align="center"> Implemented by <a href="https://huggingface.co/sayef"> sayef </a>. </p> ## Overview The FSNER model was proposed in [Example-Based Named Entity Recognition](https://arxiv.org/abs/2008.10570) by ...
0
hf_public_repos/transformers/examples/research_projects
hf_public_repos/transformers/examples/research_projects/fsner/setup.py
import setuptools with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setuptools.setup( name="fsner", version="0.0.1", author="msi sayef", author_email="msi.sayef@gmail.com", description="Few-shot Named Entity Recognition", long_description=long_description, ...
0
hf_public_repos/transformers/examples/research_projects/fsner/src
hf_public_repos/transformers/examples/research_projects/fsner/src/fsner/tokenizer_utils.py
import torch from transformers import AutoTokenizer class FSNERTokenizerUtils(object): def __init__(self, pretrained_model_name_or_path): self.tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path) def tokenize(self, x): """ Wrapper function for tokenizing query and...
0
hf_public_repos/transformers/examples/research_projects/fsner/src
hf_public_repos/transformers/examples/research_projects/fsner/src/fsner/__init__.py
from .model import FSNERModel from .tokenizer_utils import FSNERTokenizerUtils __all__ = ["FSNERModel", "FSNERTokenizerUtils"]
0
hf_public_repos/transformers/examples/research_projects/fsner/src
hf_public_repos/transformers/examples/research_projects/fsner/src/fsner/model.py
import torch from transformers import AutoModel class FSNERModel(torch.nn.Module): """ The FSNER model implements a few-shot named entity recognition method from the paper `Example-Based Named Entity Recognition <https://arxiv.org/abs/2008.10570>`__ by Morteza Ziyadi, Yuting Sun, Abhishek Goswami, Jade H...
0
hf_public_repos/transformers/examples
hf_public_repos/transformers/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. ...
0
hf_public_repos/transformers/examples
hf_public_repos/transformers/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_...
0
hf_public_repos/transformers/examples
hf_public_repos/transformers/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...
0
hf_public_repos/transformers/examples
hf_public_repos/transformers/examples/legacy/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
hf_public_repos/transformers/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...
0
hf_public_repos/transformers/examples
hf_public_repos/transformers/examples/legacy/run_chinese_ref.py
#!/usr/bin/env python import argparse import json from typing import List from ltp import LTP from transformers import BertTokenizer def _is_chinese_char(cp): """Checks whether CP is the codepoint of a CJK character.""" # This defines a "chinese character" as anything in the CJK Unicode block: # https...
0
hf_public_repos/transformers/examples
hf_public_repos/transformers/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. ...
0
hf_public_repos/transformers/examples/legacy
hf_public_repos/transformers/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...
0
hf_public_repos/transformers/examples/legacy
hf_public_repos/transformers/examples/legacy/question-answering/README.md
#### Fine-tuning BERT on SQuAD1.0 with relative position embeddings The following examples show how to fine-tune BERT models with different relative position embeddings. The BERT model `bert-base-uncased` was pretrained with default absolute position embeddings. We provide the following pretrained models which were ...
0
hf_public_repos/transformers/examples/legacy
hf_public_repos/transformers/examples/legacy/question-answering/run_squad_trainer.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/legacy
hf_public_repos/transformers/examples/legacy/multiple_choice/run_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...
0
hf_public_repos/transformers/examples/legacy
hf_public_repos/transformers/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...
0
hf_public_repos/transformers/examples/legacy
hf_public_repos/transformers/examples/legacy/text-classification/run_tf_text_classification.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...
0