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/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/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 | 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/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/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/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 | 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/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/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/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 | 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/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/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/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/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/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/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/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/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/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.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/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 | 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/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/codeparrot_training.py | import logging
import os
import time
from argparse import Namespace
from pathlib import Path
import datasets
import torch
from accelerate import Accelerator, DistributedType
from accelerate.utils import ProjectConfiguration
from arguments import TrainingArguments
from datasets import load_dataset
from huggingface_hub ... | 0 |
hf_public_repos/transformers/examples/research_projects/codeparrot | hf_public_repos/transformers/examples/research_projects/codeparrot/scripts/pretokenizing.py | import multiprocessing
import time
from arguments import PretokenizationArguments
from datasets import load_dataset
from transformers import AutoTokenizer, HfArgumentParser
def tokenize(example):
output = {}
output["input_ids"] = tokenizer(example["content"], truncation=False)["input_ids"]
output["ratio... | 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/preprocessing.py | import gzip
import json
import multiprocessing
import os
import re
import shutil
import time
from pathlib import Path
import numpy as np
from arguments import PreprocessingArguments
from datasets import load_dataset
from huggingface_hub.utils import insecure_hashlib
from minhash_deduplication import deduplicate_datase... | 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/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 |
hf_public_repos/transformers/examples/research_projects/codeparrot | hf_public_repos/transformers/examples/research_projects/codeparrot/scripts/minhash_deduplication.py | import json
import multiprocessing as mp
import re
from collections import defaultdict
from functools import partial
from typing import Dict, List, Optional, Set, Tuple, Type
from datasets import Dataset
from datasketch import MinHash, MinHashLSH
from dpu_utils.utils.iterators import ThreadedIterator
from tqdm import ... | 0 |
hf_public_repos/transformers/examples/research_projects/codeparrot | hf_public_repos/transformers/examples/research_projects/codeparrot/scripts/arguments.py | from dataclasses import dataclass, field
from typing import Optional
@dataclass
class TrainingArguments:
"""
Configuration for training model.
"""
model_ckpt: Optional[str] = field(
default="codeparrot/codeparrot", metadata={"help": "Model name or path of model to be trained."}
)
save... | 0 |
hf_public_repos/transformers/examples/research_projects/codeparrot/scripts | hf_public_repos/transformers/examples/research_projects/codeparrot/scripts/tests/test_deduplicate.py | from unittest import TestCase
from datasets import Dataset
from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters
def get_dataset():
data_dict = {
"repo_name": ["test_repo1", "test_repo2", "test_repo3"],
"path": ["test_1.py", "test_2.py", "unit_test.py"],
"content"... | 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/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 | 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/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/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/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/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/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/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/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 | 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.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/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-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/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-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/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/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/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/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 | 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/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/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/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/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/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/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/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/robust-speech-event/README.md | # Robust Speech Challenge 🤗
Welcome to the robust speech recognition challenge 🎙️ !
The goal of this event is to build **robust**, **real-world** speech recognition (ASR) systems in as many languages as possible 🌏🌍🌎.
If necessary and available, free access to a V100S 32 GB GPU will kindly be provided by the [OVH... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/robust-speech-event/run_speech_recognition_ctc_bnb.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/examples/research_projects | hf_public_repos/transformers/examples/research_projects/robust-speech-event/run_speech_recognition_ctc_streaming.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/robust-speech-event/eval.py | #!/usr/bin/env python3
import argparse
import re
from typing import Dict
import torch
from datasets import Audio, Dataset, load_dataset, load_metric
from transformers import AutoFeatureExtractor, pipeline
def log_results(result: Dataset, args: Dict[str, str]):
"""DO NOT CHANGE. This function computes and logs t... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/layoutlmv3/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/layoutlmv3/requirements.txt | datasets
seqeval
pillow
| 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/layoutlmv3/run_funsd_cord.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-... | 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 | 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/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/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/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/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/mlm_wwm/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/mlm_wwm/run_mlm_wwm.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/mlm_wwm/run_chinese_ref.py | import argparse
import json
from typing import List
from ltp import LTP
from transformers.models.bert.tokenization_bert 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:
#... | 0 |
hf_public_repos/transformers/examples/research_projects | hf_public_repos/transformers/examples/research_projects/mlm_wwm/requirements.txt | datasets >= 1.1.3
sentencepiece != 0.1.92
protobuf
ltp
| 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/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/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/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/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/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/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/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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.