modelId
stringlengths
4
112
sha
stringlengths
40
40
lastModified
stringlengths
24
24
tags
sequence
pipeline_tag
stringclasses
29 values
private
bool
1 class
author
stringlengths
2
38
config
null
id
stringlengths
4
112
downloads
float64
0
36.8M
likes
float64
0
712
library_name
stringclasses
17 values
__index_level_0__
int64
0
38.5k
readme
stringlengths
0
186k
TencentGameMate/chinese-hubert-base
fce0375452b1dd6c080ac3248d423d4d037bc831
2022-06-24T01:52:57.000Z
[ "pytorch", "hubert", "feature-extraction", "transformers", "license:mit" ]
feature-extraction
false
TencentGameMate
null
TencentGameMate/chinese-hubert-base
953
3
transformers
1,800
--- license: mit --- Pretrained on 10k hours WenetSpeech L subset. More details in [TencentGameMate/chinese_speech_pretrain](https://github.com/TencentGameMate/chinese_speech_pretrain) This model does not have a tokenizer as it was pretrained on audio alone. In order to use this model speech recognition, a tokenizer should be created and the model should be fine-tuned on labeled text data. python package: transformers==4.16.2 ```python import torch import torch.nn.functional as F import soundfile as sf from transformers import ( Wav2Vec2FeatureExtractor, HubertModel, ) model_path="" wav_path="" feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(model_path) model = HubertModel.from_pretrained(model_path) # for pretrain: Wav2Vec2ForPreTraining # model = Wav2Vec2ForPreTraining.from_pretrained(model_path) model = model.to(device) model = model.half() model.eval() wav, sr = sf.read(wav_path) input_values = feature_extractor(wav, return_tensors="pt").input_values input_values = input_values.half() input_values = input_values.to(device) with torch.no_grad(): outputs = model(input_values) last_hidden_state = outputs.last_hidden_state ```
Norod78/hebrew-gpt_neo-small
12ac2ca1aac05eeaab5e3bb278fd4e31180b7545
2022-07-04T12:43:15.000Z
[ "pytorch", "jax", "onnx", "gpt_neo", "text-generation", "he", "transformers", "license:mit" ]
text-generation
false
Norod78
null
Norod78/hebrew-gpt_neo-small
946
null
transformers
1,801
--- language: he thumbnail: https://avatars1.githubusercontent.com/u/3617152?norod.jpg widget: - text: "עוד בימי קדם" - text: "קוראים לי דורון ואני מעוניין ל" - text: "קוראים לי איציק ואני חושב ש" - text: "החתול שלך מאוד חמוד ו" license: mit --- # hebrew-gpt_neo-small Hebrew text generation model based on [EleutherAI's gpt-neo](https://github.com/EleutherAI/gpt-neo). Each was trained on a TPUv3-8 which was made avilable to me via the [TPU Research Cloud](https://sites.research.google/trc/) Program. ## Datasets 1. An assortment of various Hebrew corpuses - I have made it available [here](https://mega.nz/folder/CodSSA4R#4INvMes-56m_WUi7jQMbJQ) 2. oscar / unshuffled_deduplicated_he - [Homepage](https://oscar-corpus.com) | [Dataset Permalink](https://huggingface.co/datasets/viewer/?dataset=oscar&config=unshuffled_deduplicated_he) The Open Super-large Crawled ALMAnaCH coRpus is a huge multilingual corpus obtained by language classification and filtering of the Common Crawl corpus using the goclassy architecture. 3. CC100-Hebrew Dataset [Homepage](https://metatext.io/datasets/cc100-hebrew) Created by Conneau & Wenzek et al. at 2020, the CC100-Hebrew This dataset is one of the 100 corpora of monolingual data that was processed from the January-December 2018 Commoncrawl snapshots from the CC-Net repository. The size of this corpus is 6.1G., in Hebrew language. ## Training Config Available [here](https://github.com/Norod/hebrew-gpt_neo/tree/main/hebrew-gpt_neo-small/configs) <BR> ## Usage ### Google Colab Notebook Available [here ](https://colab.research.google.com/github/Norod/hebrew-gpt_neo/blob/main/hebrew-gpt_neo-small/Norod78_hebrew_gpt_neo_small_Colab.ipynb) <BR> #### Simple usage sample code ```python !pip install tokenizers==0.10.2 transformers==4.6.0 from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Norod78/hebrew-gpt_neo-small") model = AutoModelForCausalLM.from_pretrained("Norod78/hebrew-gpt_neo-small", pad_token_id=tokenizer.eos_token_id) prompt_text = "אני אוהב שוקולד ועוגות" max_len = 512 sample_output_num = 3 seed = 1000 import numpy as np import torch device = torch.device("cuda" if torch.cuda.is_available() else "cpu") n_gpu = 0 if torch.cuda.is_available()==False else torch.cuda.device_count() print(f"device: {device}, n_gpu: {n_gpu}") np.random.seed(seed) torch.manual_seed(seed) if n_gpu > 0: torch.cuda.manual_seed_all(seed) model.to(device) encoded_prompt = tokenizer.encode( prompt_text, add_special_tokens=False, return_tensors="pt") encoded_prompt = encoded_prompt.to(device) if encoded_prompt.size()[-1] == 0: input_ids = None else: input_ids = encoded_prompt print("input_ids = " + str(input_ids)) if input_ids != None: max_len += len(encoded_prompt[0]) if max_len > 2048: max_len = 2048 print("Updated max_len = " + str(max_len)) stop_token = "<|endoftext|>" new_lines = "\n\n\n" sample_outputs = model.generate( input_ids, do_sample=True, max_length=max_len, top_k=50, top_p=0.95, num_return_sequences=sample_output_num ) print(100 * '-' + "\n\t\tOutput\n" + 100 * '-') for i, sample_output in enumerate(sample_outputs): text = tokenizer.decode(sample_output, skip_special_tokens=True) # Remove all text after the stop token text = text[: text.find(stop_token) if stop_token else None] # Remove all text after 3 newlines text = text[: text.find(new_lines) if new_lines else None] print("\n{}: {}".format(i, text)) print("\n" + 100 * '-') ```
Aniemore/wav2vec2-xlsr-53-russian-emotion-recognition
a1e1c0fb14af7e4c4c2dfb2f35860da8b744f1b0
2022-07-24T10:47:37.000Z
[ "pytorch", "wav2vec2", "ru", "dataset:Aniemore/resd", "transformers", "audio-classification", "audio", "emotion", "emotion-recognition", "emotion-classification", "speech", "license:mit", "model-index" ]
audio-classification
false
Aniemore
null
Aniemore/wav2vec2-xlsr-53-russian-emotion-recognition
946
2
transformers
1,802
--- language: ru tags: - audio-classification - audio - emotion - emotion-recognition - emotion-classification - speech license: mit datasets: - Aniemore/resd model-index: - name: XLS-R Wav2Vec2 For Russian Speech Emotion Classification by Nikita Davidchuk results: - task: name: Audio Emotion Recognition type: audio-emotion-recognition dataset: name: Russian Emotional Speech Dialogs type: Aniemore/resd args: ru metrics: - name: accuracy type: accuracy value: 72% --- # Prepare and importing ```python import torch import torch.nn as nn import torch.nn.functional as F import torchaudio from transformers import AutoConfig, AutoModel, Wav2Vec2FeatureExtractor import librosa import numpy as np def speech_file_to_array_fn(path, sampling_rate): speech_array, _sampling_rate = torchaudio.load(path) resampler = torchaudio.transforms.Resample(_sampling_rate) speech = resampler(speech_array).squeeze().numpy() return speech def predict(path, sampling_rate): speech = speech_file_to_array_fn(path, sampling_rate) inputs = feature_extractor(speech, sampling_rate=sampling_rate, return_tensors="pt", padding=True) inputs = {key: inputs[key].to(device) for key in inputs} with torch.no_grad(): logits = model_(**inputs).logits scores = F.softmax(logits, dim=1).detach().cpu().numpy()[0] outputs = [{"Emotion": config.id2label[i], "Score": f"{round(score * 100, 3):.1f}%"} for i, score in enumerate(scores)] return outputs ``` # Evoking: ```python TRUST = True config = AutoConfig.from_pretrained('Aniemore/wav2vec2-xlsr-53-russian-emotion-recognition', trust_remote_code=TRUST) model_ = AutoModel.from_pretrained("Aniemore/wav2vec2-xlsr-53-russian-emotion-recognition", trust_remote_code=TRUST) feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained("Aniemore/wav2vec2-xlsr-53-russian-emotion-recognition") device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model_.to(device) ``` # Use case ```python result = predict("/path/to/russian_audio_speech.wav", 16000) print(result) ``` ```python # outputs [{'Emotion': 'anger', 'Score': '0.0%'}, {'Emotion': 'disgust', 'Score': '100.0%'}, {'Emotion': 'enthusiasm', 'Score': '0.0%'}, {'Emotion': 'fear', 'Score': '0.0%'}, {'Emotion': 'happiness', 'Score': '0.0%'}, {'Emotion': 'neutral', 'Score': '0.0%'}, {'Emotion': 'sadness', 'Score': '0.0%'}] ``` # Results | | precision | recall | f1-score | support | |--------------|-----------|--------|----------|---------| | anger | 0.97 | 0.86 | 0.92 | 44 | | disgust | 0.71 | 0.78 | 0.74 | 37 | | enthusiasm | 0.51 | 0.80 | 0.62 | 40 | | fear | 0.80 | 0.62 | 0.70 | 45 | | happiness | 0.66 | 0.70 | 0.68 | 44 | | neutral | 0.81 | 0.66 | 0.72 | 38 | | sadness | 0.79 | 0.59 | 0.68 | 32 | | accuracy | | | 0.72 | 280 | | macro avg | 0.75 | 0.72 | 0.72 | 280 | | weighted avg | 0.75 | 0.72 | 0.73 | 280 | # Citations ``` @misc{Aniemore, author = {Артем Аментес, Илья Лубенец, Никита Давидчук}, title = {Открытая библиотека искусственного интеллекта для анализа и выявления эмоциональных оттенков речи человека}, year = {2022}, publisher = {Hugging Face}, journal = {Hugging Face Hub}, howpublished = {\url{https://huggingface.com/aniemore/Aniemore}}, email = {[email protected]} } ```
DataikuNLP/tiny-random-bert
7fb1dc6c16498e2028cc74afcf64319302fab101
2021-11-19T16:27:38.000Z
[ "pytorch", "tf", "bert", "transformers" ]
null
false
DataikuNLP
null
DataikuNLP/tiny-random-bert
944
null
transformers
1,803
Entry not found
mrm8488/mbart-large-finetuned-opus-en-es-translation
a9bfab17eba27c9bf319056017d610141ce137f0
2021-01-26T12:24:37.000Z
[ "pytorch", "mbart", "text2text-generation", "en", "es", "dataset:opus100", "transformers", "translation", "autotrain_compatible" ]
translation
false
mrm8488
null
mrm8488/mbart-large-finetuned-opus-en-es-translation
944
2
transformers
1,804
--- tags: - translation language: - en - es datasets: - opus100 --- ### mbart-large-en-es This is mbart-large-cc25, finetuned on opus100 for English to Spanish translation. It scores BLEU **32.54** on test set.
sultan/BioM-ALBERT-xxlarge
c85649a7b3345b7de438e59c03f8f702e3aebc76
2021-10-12T21:23:31.000Z
[ "pytorch", "albert", "fill-mask", "transformers", "autotrain_compatible" ]
fill-mask
false
sultan
null
sultan/BioM-ALBERT-xxlarge
944
1
transformers
1,805
# BioM-Transformers: Building Large Biomedical Language Models with BERT, ALBERT and ELECTRA # Abstract The impact of design choices on the performance of biomedical language models recently has been a subject for investigation. In this paper, we empirically study biomedical domain adaptation with large transformer models using different design choices. We evaluate the performance of our pretrained models against other existing biomedical language models in the literature. Our results show that we achieve state-of-the-art results on several biomedical domain tasks despite using similar or less computational cost compared to other models in the literature. Our findings highlight the significant effect of design choices on improving the performance of biomedical language models. # Model Description This model was pre-trained on PubMed Abstracts only with biomedical domain vocabulary for 264K steps with a batch size of 8192 on TPUv3-512 unit. In order to help researchers with limited resources to fine-tune larger models, we created an example with PyTorch XLA. PyTorch XLA (https://github.com/pytorch/xla) is a library that allows you to use PyTorch on TPU units, which is provided for free by Google Colab and Kaggle. Follow this example to work with PyTorch/XLA [Link](https://github.com/salrowili/BioM-Transformers/blob/main/examples/Fine_Tuning_Biomedical_Models_on_Text_Classification_Task_With_HuggingFace_Transformers_and_PyTorch_XLA.ipynb) Check our GitHub repo at https://github.com/salrowili/BioM-Transformers for TensorFlow and GluonNLP checkpoints. We also updated this repo with a couple of examples on how to fine-tune LMs on text classification and questions answering tasks such as ChemProt, SQuAD, and BioASQ. # Colab Notebook Examples BioM-ELECTRA-LARGE on NER and ChemProt Task [![Open In Colab][COLAB]](https://colab.research.google.com/github/salrowili/BioM-Transformers/blob/main/examples/Example_of_NER_and_ChemProt_Task_on_TPU.ipynb) BioM-ELECTRA-Large on SQuAD2.0 and BioASQ7B Factoid tasks [![Open In Colab][COLAB]](https://colab.research.google.com/github/salrowili/BioM-Transformers/blob/main/examples/Example_of_SQuAD2_0_and_BioASQ7B_tasks_with_BioM_ELECTRA_Large_on_TPU.ipynb) BioM-ALBERT-xxlarge on SQuAD2.0 and BioASQ7B Factoid tasks [![Open In Colab][COLAB]](https://colab.research.google.com/github/salrowili/BioM-Transformers/blob/main/examples/Example_of_SQuAD2_0_and_BioASQ7B_tasks_with_BioM_ALBERT_xxlarge_on_TPU.ipynb) Text Classification Task With HuggingFace Transformers and PyTorchXLA on Free TPU [![Open In Colab][COLAB]](https://colab.research.google.com/github/salrowili/BioM-Transformers/blob/main/examples/Fine_Tuning_Biomedical_Models_on_Text_Classification_Task_With_HuggingFace_Transformers_and_PyTorch_XLA.ipynb) [COLAB]: https://colab.research.google.com/assets/colab-badge.svg # Acknowledgment We would like to acknowledge the support we have from Tensorflow Research Cloud (TFRC) team to grant us access to TPUv3 units. # Citation ```bibtex @inproceedings{alrowili-shanker-2021-biom, title = "{B}io{M}-Transformers: Building Large Biomedical Language Models with {BERT}, {ALBERT} and {ELECTRA}", author = "Alrowili, Sultan and Shanker, Vijay", booktitle = "Proceedings of the 20th Workshop on Biomedical Language Processing", month = jun, year = "2021", address = "Online", publisher = "Association for Computational Linguistics", url = "https://www.aclweb.org/anthology/2021.bionlp-1.24", pages = "221--227", abstract = "The impact of design choices on the performance of biomedical language models recently has been a subject for investigation. In this paper, we empirically study biomedical domain adaptation with large transformer models using different design choices. We evaluate the performance of our pretrained models against other existing biomedical language models in the literature. Our results show that we achieve state-of-the-art results on several biomedical domain tasks despite using similar or less computational cost compared to other models in the literature. Our findings highlight the significant effect of design choices on improving the performance of biomedical language models.", } ```
funnel-transformer/small-base
373ecb760257d0059f1efdf58b3796d4d616ad0a
2020-12-11T21:40:41.000Z
[ "pytorch", "tf", "funnel", "feature-extraction", "en", "dataset:bookcorpus", "dataset:wikipedia", "dataset:gigaword", "arxiv:2006.03236", "transformers", "license:apache-2.0" ]
feature-extraction
false
funnel-transformer
null
funnel-transformer/small-base
943
null
transformers
1,806
--- language: en license: apache-2.0 datasets: - bookcorpus - wikipedia - gigaword --- # Funnel Transformer small model (B4-4-4 without decoder) Pretrained model on English language using a similar objective objective as [ELECTRA](https://huggingface.co/transformers/model_doc/electra.html). It was introduced in [this paper](https://arxiv.org/pdf/2006.03236.pdf) and first released in [this repository](https://github.com/laiguokun/Funnel-Transformer). This model is uncased: it does not make a difference between english and English. Disclaimer: The team releasing Funnel Transformer did not write a model card for this model so this model card has been written by the Hugging Face team. ## Model description Funnel Transformer is a transformers model pretrained on a large corpus of English data in a self-supervised fashion. This means it was pretrained on the raw texts only, with no humans labelling them in any way (which is why it can use lots of publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely, a small language model corrupts the input texts and serves as a generator of inputs for this model, and the pretraining objective is to predict which token is an original and which one has been replaced, a bit like a GAN training. This way, the model learns an inner representation of the English language that can then be used to extract features useful for downstream tasks: if you have a dataset of labeled sentences for instance, you can train a standard classifier using the features produced by the BERT model as inputs. **Note:** This model does not contain the decoder, so it ouputs hidden states that have a sequence length of one fourth of the inputs. It's good to use for tasks requiring a summary of the sentence (like sentence classification) but not if you need one input per initial token. You should use the `small` model in that case. ## Intended uses & limitations You can use the raw model to extract a vector representation of a given text, but it's mostly intended to be fine-tuned on a downstream task. See the [model hub](https://huggingface.co/models?filter=funnel-transformer) to look for fine-tuned versions on a task that interests you. Note that this model is primarily aimed at being fine-tuned on tasks that use the whole sentence (potentially masked) to make decisions, such as sequence classification, token classification or question answering. For tasks such as text generation you should look at model like GPT2. ### How to use Here is how to use this model to get the features of a given text in PyTorch: ```python from transformers import FunnelTokenizer, FunnelBaseModel tokenizer = FunnelTokenizer.from_pretrained("funnel-transformer/small-base") model = FunnelBaseModel.from_pretrained("funnel-transformer/small-base") text = "Replace me by any text you'd like." encoded_input = tokenizer(text, return_tensors='pt') output = model(**encoded_input) ``` and in TensorFlow: ```python from transformers import FunnelTokenizer, TFFunnelBaseModel tokenizer = FunnelTokenizer.from_pretrained("funnel-transformer/small-base") model = TFFunnelBaseModel.from_pretrained("funnel-transformer/small-base") text = "Replace me by any text you'd like." encoded_input = tokenizer(text, return_tensors='tf') output = model(encoded_input) ``` ## Training data The BERT model was pretrained on: - [BookCorpus](https://yknzhu.wixsite.com/mbweb), a dataset consisting of 11,038 unpublished books, - [English Wikipedia](https://en.wikipedia.org/wiki/English_Wikipedia) (excluding lists, tables and headers), - [Clue Web](https://lemurproject.org/clueweb12/), a dataset of 733,019,372 English web pages, - [GigaWord](https://catalog.ldc.upenn.edu/LDC2011T07), an archive of newswire text data, - [Common Crawl](https://commoncrawl.org/), a dataset of raw web pages. ### BibTeX entry and citation info ```bibtex @misc{dai2020funneltransformer, title={Funnel-Transformer: Filtering out Sequential Redundancy for Efficient Language Processing}, author={Zihang Dai and Guokun Lai and Yiming Yang and Quoc V. Le}, year={2020}, eprint={2006.03236}, archivePrefix={arXiv}, primaryClass={cs.LG} } ```
codeparrot/codeparrot
065248a99f051da363b1c2cbf05da943c8b6211b
2022-06-24T08:28:28.000Z
[ "pytorch", "tensorboard", "gpt2", "text-generation", "code", "dataset:codeparrot/codeparrot-clean-train", "transformers", "generation", "model-index" ]
text-generation
false
codeparrot
null
codeparrot/codeparrot
943
24
transformers
1,807
--- language: code tags: - code - gpt2 - generation datasets: - codeparrot/codeparrot-clean-train widget: - text: "from transformer import" example_title: "Transformers" - text: "def print_hello_world():\n\t" example_title: "Hello World!" - text: "def get_file_size(filepath):" example_title: "File size" - text: "import numpy as" example_title: "Numpy" model-index: - name: codeparrot results: - task: name: Code Generation type: code-generation dataset: name: "HumanEval" type: openai_humaneval metrics: - name: pass@1 type: code_eval value: 3.99 - name: pass@10 type: code_eval value: 8.69 - name: pass@100 type: code_eval value: 17.88 --- # CodeParrot 🦜 CodeParrot 🦜 is a GPT-2 model (1.5B parameters) trained to generate Python code. After the initial training and release of v1.0 we trained the model some more and released v1.1 (see below for details). ## Usage You can load the CodeParrot model and tokenizer directly in `transformers`: ```Python from transformers import AutoTokenizer, AutoModelWithLMHead tokenizer = AutoTokenizer.from_pretrained("codeparrot/codeparrot") model = AutoModelWithLMHead.from_pretrained("codeparrot/codeparrot") inputs = tokenizer("def hello_world():", return_tensors="pt") outputs = model(**inputs) ``` or with a `pipeline`: ```Python from transformers import pipeline pipe = pipeline("text-generation", model="codeparrot/codeparrot") outputs = pipe("def hello_world():") ``` ## Training The model was trained on the cleaned [CodeParrot 🦜 dataset](https://huggingface.co/datasets/codeparrot/codeparrot-clean) in two steps. After the initial training (v1.0) the model was trained for another 30k steps resulting in v1.1 and you find the settings in the following table: |Config| v1.0| v1.1| |------|------------------|--------------------| |Batch size| 512 | 512 | |Context size| 1024 | 1024 | |Training steps| 50'000| 30'000 |Gradient accumulation| 16| 16 | |Gradient checkpointing| True| True | |Learning rate| 2e-4 | 5e-5 | |Weight decay | 0.1 | 0.1 | |Warmup steps| 750 | 750 | |Schedule| Cosine | Cosine | The training was executed on 16 x A100 (40GB) GPUs. This setting amounts to roughly 26 + 15 billion tokens. ## Performance We evaluated the model on OpenAI's [HumanEval](https://huggingface.co/datasets/openai_humaneval) benchmark which consists of programming challenges: | Metric | v1.0 | v1.1 | |--------|-----|-----| |pass@1 | 3.58% | 3.99% | |pass@10 | 8.03% | 8.69% | |pass@100 | 14.96% | 17.88% | The [pass@k metric](https://huggingface.co/metrics/code_eval) tells the probability that at least one out of k generations passes the tests. ## Resources - Dataset: [full](https://huggingface.co/datasets/codeparrot/codeparrot-clean), [train](https://huggingface.co/datasets/codeparrot/codeparrot-clean-train), [valid](https://huggingface.co/datasets/codeparrot/codeparrot-clean-valid) - Code: [repository](https://github.com/huggingface/transformers/tree/master/examples/research_projects/codeparrot) - Spaces: [generation](), [highlighting]()
Helsinki-NLP/opus-mt-it-fr
e2b19cab7c3ec41f1f314afc78a4e9423605f553
2021-09-10T13:53:00.000Z
[ "pytorch", "marian", "text2text-generation", "it", "fr", "transformers", "translation", "license:apache-2.0", "autotrain_compatible" ]
translation
false
Helsinki-NLP
null
Helsinki-NLP/opus-mt-it-fr
942
null
transformers
1,808
--- tags: - translation license: apache-2.0 --- ### opus-mt-it-fr * source languages: it * target languages: fr * OPUS readme: [it-fr](https://github.com/Helsinki-NLP/OPUS-MT-train/blob/master/models/it-fr/README.md) * dataset: opus * model: transformer-align * pre-processing: normalization + SentencePiece * download original weights: [opus-2020-01-16.zip](https://object.pouta.csc.fi/OPUS-MT-models/it-fr/opus-2020-01-16.zip) * test set translations: [opus-2020-01-16.test.txt](https://object.pouta.csc.fi/OPUS-MT-models/it-fr/opus-2020-01-16.test.txt) * test set scores: [opus-2020-01-16.eval.txt](https://object.pouta.csc.fi/OPUS-MT-models/it-fr/opus-2020-01-16.eval.txt) ## Benchmarks | testset | BLEU | chr-F | |-----------------------|-------|-------| | Tatoeba.it.fr | 67.9 | 0.792 |
UrukHan/t5-russian-spell
9e1e7dda2468aac53b8e4aa1ae30dc8fd9e9c47c
2022-04-04T18:55:49.000Z
[ "pytorch", "tensorboard", "t5", "text2text-generation", "transformers", "generated_from_trainer", "model-index", "autotrain_compatible" ]
text2text-generation
false
UrukHan
null
UrukHan/t5-russian-spell
942
1
transformers
1,809
--- tags: - generated_from_trainer model-index: - name: t5-russian-spell results: [] widget: - text: "ывсем привет выныканалетоп армии и это двадцать пятый день спец операций на украине ет самый главной новости российские военные ракетами кинжалы калибр уничтожили крупную военную топливную базу украины ракетным ударом по населенному пункту под жетамиром уничтжены более стаукраинских военных в две тысячи двадцать втором году" --- <!-- This model card has been generated automatically according to the information the Trainer had access to. You should probably proofread and complete it, then remove this comment. --> --- # t5-russian-spell --- модель для исправление текста из распознаного аудио. моя модлеь для распознования аудио https://huggingface.co/UrukHan/wav2vec2-russian и его результаты можно закидывать в эту модель. тестил на видео случайном с ютюба <table border="0"> <tr> <td><b style="font-size:30px">Output wav2vec2</b></td> <td><b style="font-size:30px">Output spell correcor</b></td> </tr> <tr> <td>ывсем привет выныканалетоп армии и это двадцать пятый день спец операций на украине ет самый главной новости российские военные ракетами кинжалы калибр уничтожили крупную военную топливную базу украины ракетным ударом по населенному пункту под жетамиром уничтжены более стаукраинских военных в две тысячи двадцать втором году</td> <td>Всем привет! Вы в курсе новостей от армии. И это 25 день спецопераций на Украине. Есть самые главные новости. Российские военные ракетами «Кинжалы» и «Кинжалы» калибра уничтожили крупную военную топливную базу Украины. Ракетным ударом по населенному пункту под Жетамиром уничтожены более ста украинских военных в 2022г.</td> </tr> </table> # --- Датасеты для обучения: UrukHan/t5-russian-spell_I : https://huggingface.co/datasets/UrukHan/t5-russian-spell_I UrukHan/t5-russian-spell_II : https://huggingface.co/datasets/UrukHan/t5-russian-spell_II UrukHan/t5-russian-spell_III : https://huggingface.co/datasets/UrukHan/t5-russian-spell_III --- # Запуск на вывод результатов пример работы с комментариями в колабе https://colab.research.google.com/drive/1ame2va9_NflYqy4RZ07HYmQ0moJYy7w2?usp=sharing : # ```python # Установим библиотеку трансформеров !pip install transformers # Импортируем библиотеки from transformers import AutoModelForSeq2SeqLM, T5TokenizerFast # Зададим название выбронной модели из хаба MODEL_NAME = 'UrukHan/t5-russian-spell' MAX_INPUT = 256 # Загрузка модели и токенизатора tokenizer = T5TokenizerFast.from_pretrained(MODEL_NAME) model = AutoModelForSeq2SeqLM.from_pretrained(MODEL_NAME) # Входные данные (можно массив фраз или текст) input_sequences = ['сеглдыя хорош ден', 'когд а вы прдет к нам в госи'] # или можно использовать одиночные фразы: input_sequences = 'сеглдыя хорош ден' task_prefix = "Spell correct: " # Токенизирование данных if type(input_sequences) != list: input_sequences = [input_sequences] encoded = tokenizer( [task_prefix + sequence for sequence in input_sequences], padding="longest", max_length=MAX_INPUT, truncation=True, return_tensors="pt", ) predicts = model.generate(encoded) # # Прогнозирование tokenizer.batch_decode(predicts, skip_special_tokens=True) # Декодируем данные ``` # --- #Настроенный блокнот для запуска обучения и сохранения модели в свой репозиторий на huggingface hub: #https://colab.research.google.com/drive/1H4IoasDqa2TEjGivVDp-4Pdpm0oxrCWd?usp=sharing # ```python # Установка библиотек !pip install datasets !apt install git-lfs !pip install transformers !pip install sentencepiece !pip install rouge_score # Импорт библиотек import numpy as np from datasets import Dataset import tensorflow as import nltk from transformers import T5TokenizerFast, Seq2SeqTrainingArguments, Seq2SeqTrainer, AutoModelForSeq2SeqLM, DataCollatorForSeq2Seq import torch from transformers.optimization import Adafactor, AdafactorSchedule from datasets import load_dataset, load_metric # загрузка параметров raw_datasets = load_dataset("xsum") metric = load_metric("rouge") nltk.download('punkt') # Ввести свой ключ huggingface hyb from huggingface_hub import notebook_login notebook_login() # Определение параметров REPO = "t5-russian-spell" # Введите наазвание название репозитория MODEL_NAME = "UrukHan/t5-russian-spell" # Введите наазвание выбранной модели из хаба MAX_INPUT = 256 # Введите максимальную длинну входных данных в токенах (длинна входных фраз в словах (можно считать полслова токен)) MAX_OUTPUT = 256 # Введите максимальную длинну прогнозов в токенах (можно уменьшить для задач суммризации или других задач где выход короче) BATCH_SIZE = 8 DATASET = 'UrukHan/t5-russian-spell_I' # Введите наазвание название датасета # Загрузка датасета использование других типов данных опишу ниже data = load_dataset(DATASET) # Загрузка модели и токенизатора tokenizer = T5TokenizerFast.from_pretrained(MODEL_NAME) model = AutoModelForSeq2SeqLM.from_pretrained(MODEL_NAME) model.config.max_length = MAX_OUTPUT # по умолчанию 20, поэтому во всех моделях прогнозы обрезаются выходные последовательности # Закоментить после первого соъранения в репозиторий свой необъязательно tokenizer.push_to_hub(repo_name) train = data['train'] test = data['test'].train_test_split(0.02)['test'] # Уменьшил так тестовыу. выборку чтоб не ждать долго расчет ошибок между эпохами data_collator = DataCollatorForSeq2Seq(tokenizer, model=model) #return_tensors="tf" def compute_metrics(eval_pred): predictions, labels = eval_pred decoded_preds = tokenizer.batch_decode(predictions, skip_special_tokens=True) # Replace -100 in the labels as we can't decode them. labels = np.where(labels != -100, labels, tokenizer.pad_token_id) decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=True) # Rouge expects a newline after each sentence decoded_preds = ["\n".join(nltk.sent_tokenize(pred.strip())) for pred in decoded_preds] decoded_labels = ["\n".join(nltk.sent_tokenize(label.strip())) for label in decoded_labels] result = metric.compute(predictions=decoded_preds, references=decoded_labels, use_stemmer=True) # Extract a few results result = {key: value.mid.fmeasure * 100 for key, value in result.items()} # Add mean generated length prediction_lens = [np.count_nonzero(pred != tokenizer.pad_token_id) for pred in predictions] result["gen_len"] = np.mean(prediction_lens) return {k: round(v, 4) for k, v in result.items()} training_args = Seq2SeqTrainingArguments( output_dir = REPO, #overwrite_output_dir=True, evaluation_strategy='steps', #learning_rate=2e-5, eval_steps=5000, save_steps=5000, num_train_epochs=1, predict_with_generate=True, per_device_train_batch_size=BATCH_SIZE, per_device_eval_batch_size=BATCH_SIZE, fp16=True, save_total_limit=2, #generation_max_length=256, #generation_num_beams=4, weight_decay=0.005, #logging_dir='logs', push_to_hub=True, ) # Выберем вручную оптимизатор. Т5 в оригинальной архитектуре использует Адафактор оптимизатор optimizer = Adafactor( model.parameters(), lr=1e-5, eps=(1e-30, 1e-3), clip_threshold=1.0, decay_rate=-0.8, beta1=None, weight_decay=0.0, relative_step=False, scale_parameter=False, warmup_init=False, ) lr_scheduler = AdafactorSchedule(optimizer) trainer = Seq2SeqTrainer( model=model, args=training_args, train_dataset = train, eval_dataset = test, optimizers = (optimizer, lr_scheduler), tokenizer = tokenizer, compute_metrics=compute_metrics ) trainer.train() trainer.push_to_hub() ``` # --- # Пример конвертации массивов для данной сети # ```python input_data = ['удач почти отнее отвернулась', 'в хааоде проведения чемпиониавта мира дветысячивосемнандцтая лгодаа'] output_data = ['Удача почти от нее отвернулась', 'в ходе проведения чемпионата мира две тысячи восемнадцатого года'] # Токенизируем входные данные task_prefix = "Spell correct: " input_sequences = input_data encoding = tokenizer( [task_prefix + sequence for sequence in input_sequences], padding="longest", max_length=MAX_INPUT, truncation=True, return_tensors="pt", ) input_ids, attention_mask = encoding.input_ids, encoding.attention_mask # Токенизируем выходные данные target_encoding = tokenizer(output_data, padding="longest", max_length=MAX_OUTPUT, truncation=True) labels = target_encoding.input_ids # replace padding token id's of the labels by -100 labels = torch.tensor(labels) labels[labels == tokenizer.pad_token_id] = -100''' # Конвертируем наши данные в формат dataset data = Dataset.from_pandas(pd.DataFrame({'input_ids': list(np.array(input_ids)), 'attention_mask': list(np.array(attention_mask)), 'labels': list(np.array(labels))})) data = data.train_test_split(0.02) # и получим на вход сети для нашешго trainer: train_dataset = data['train'], eval_dataset = data['test']
Stancld/longt5-tglobal-large-16384-pubmed-3k_steps
6949726515747477615ee1cecb31ff5d34ca3add
2022-06-20T15:45:47.000Z
[ "pytorch", "jax", "longt5", "text2text-generation", "en", "dataset:ccdv/pubmed-summarization", "arxiv:2112.07916", "arxiv:1910.10683", "transformers", "license:apache-2.0", "autotrain_compatible" ]
text2text-generation
false
Stancld
null
Stancld/longt5-tglobal-large-16384-pubmed-3k_steps
941
7
transformers
1,810
--- language: en datasets: - ccdv/pubmed-summarization license: apache-2.0 --- ## Introduction [Google's LongT5: Efficient Text-To-Text Transformer for Long Sequences](https://arxiv.org/pdf/2112.07916.pdf) introduced as an extension of a successful [T5 model](https://arxiv.org/pdf/1910.10683.pdf). This is an unofficial *longt5-large-16384-pubmed-3k_steps* checkpoint. I.e., this is a large configuration of the LongT5 model with a `transient-global` attention fine-tuned on [pubmed summarization dataset](https://huggingface.co/datasets/ccdv/pubmed-summarization) for 3,000 training steps. It may be worth continuing in the fine-tuning as we did not train the model until the convergence. ## Results and Fine-tuning Details The fine-tuned model achieves the following results on the evaluation set using `beam_search=3` and without any specific calibration of generation parameters are presented below, altogether with the results from the original paper (the original scores are higher, very likely due to a higher number of training steps). | Metric | Score | Score (original paper) | --- | --- | --- | | Rouge-1 | 47.44 | 49.98 | | Rouge-2 | 22.68 | 24.69 | | Rouge-L | 29.83 | x | | Rouge-Lsum | 43.13 | 46.46 | The training parameters follow the ones specified in the paper. We accumulated batch size to 128 examples and used `Adafactor` optimizer with a constant learning rate `0.001`. The full training hyper-parameters and logs can be found via the following [W&B run](https://wandb.ai/stancld/LongT5/runs/1lwncl8a?workspace=user-stancld). The model was trained using the [HuggingFace's trainer](https://github.com/huggingface/transformers/blob/main/src/transformers/trainer_seq2seq.py). The only specific adjustment, I made for the training, was dropping very short input articles (less than 16 words (a bit of mistake, should be less than 16 tokens)) as this sequences do not contribute to gradient creation in the *transient-global* attention, which resulted in training crashes when DDP used. ## Usage ```python LONG_ARTICLE = """"anxiety affects quality of life in those living with parkinson 's disease ( pd ) more so than overall cognitive status , motor deficits , apathy , and depression [ 13 ] . although anxiety and depression are often related and coexist in pd patients , recent research suggests that anxiety rather than depression is the most prominent and prevalent mood disorder in pd [ 5 , 6 ] . yet , our current understanding of anxiety and its impact on cognition in pd , as well as its neural basis and best treatment practices , remains meager and lags far behind that of depression . overall , neuropsychiatric symptoms in pd have been shown to be negatively associated with cognitive performance . for example , higher depression scores have been correlated with lower scores on the mini - mental state exam ( mmse ) [ 8 , 9 ] as well as tests of memory and executive functions ( e.g. , attention ) [ 1014 ] . likewise , apathy and anhedonia in pd patients have been associated with executive dysfunction [ 10 , 1523 ] . however , few studies have specifically investigated the relationship between anxiety and cognition in pd . one study showed a strong negative relationship between anxiety ( both state and trait ) and overall cognitive performance ( measured by the total of the repeatable battery for the assessment of neuropsychological status index ) within a sample of 27 pd patients . furthermore , trait anxiety was negatively associated with each of the cognitive domains assessed by the rbans ( i.e. , immediate memory , visuospatial construction , language , attention , and delayed memory ) . two further studies have examined whether anxiety differentially affects cognition in patients with left - sided dominant pd ( lpd ) versus right - sided dominant pd ( rpd ) ; however , their findings were inconsistent . the first study found that working memory performance was worse in lpd patients with anxiety compared to rpd patients with anxiety , whereas the second study reported that , in lpd , apathy but not anxiety was associated with performance on nonverbally mediated executive functions and visuospatial tasks ( e.g. , tmt - b , wms - iii spatial span ) , while in rpd , anxiety but not apathy significantly correlated with performance on verbally mediated tasks ( e.g. , clock reading test and boston naming test ) . furthermore , anxiety was significantly correlated with neuropsychological measures of attention and executive and visuospatial functions . taken together , it is evident that there are limited and inconsistent findings describing the relationship between anxiety and cognition in pd and more specifically how anxiety might influence particular domains of cognition such as attention and memory and executive functioning . it is also striking that , to date , no study has examined the influence of anxiety on cognition in pd by directly comparing groups of pd patients with and without anxiety while excluding depression . given that research on healthy young adults suggests that anxiety reduces processing capacity and impairs processing efficiency , especially in the central executive and attentional systems of working memory [ 26 , 27 ] , we hypothesized that pd patients with anxiety would show impairments in attentional set - shifting and working memory compared to pd patients without anxiety . furthermore , since previous work , albeit limited , has focused on the influence of symptom laterality on anxiety and cognition , we also explored this relationship . seventeen pd patients with anxiety and thirty - three pd patients without anxiety were included in this study ( see table 1 ) . the cross - sectional data from these participants was taken from a patient database that has been compiled over the past 8 years ( since 2008 ) at the parkinson 's disease research clinic at the brain and mind centre , university of sydney . inclusion criteria involved a diagnosis of idiopathic pd according to the united kingdom parkinson 's disease society brain bank criteria and were confirmed by a neurologist ( sjgl ) . patients also had to have an adequate proficiency in english and have completed a full neuropsychological assessment . ten patients in this study ( 5 pd with anxiety ; 5 pd without anxiety ) were taking psychotropic drugs ( i.e. , benzodiazepine or selective serotonin reuptake inhibitor ) . patients were also excluded if they had other neurological disorders , psychiatric disorders other than affective disorders ( such as anxiety ) , or if they reported a score greater than six on the depression subscale of the hospital anxiety and depression scale ( hads ) . thus , all participants who scored within a depressed ( hads - d > 6 ) range were excluded from this study , in attempt to examine a refined sample of pd patients with and without anxiety in order to determine the independent effect of anxiety on cognition . this research was approved by the human research ethics committee of the university of sydney , and written informed consent was obtained from all participants . self - reported hads was used to assess anxiety in pd and has been previously shown to be a useful measure of clinical anxiety in pd . a cut - off score of > 8 on the anxiety subscale of the hads ( hads - a ) was used to identify pd cases with anxiety ( pda+ ) , while a cut - off score of < 6 on the hads - a was used to identify pd cases without anxiety ( pda ) . this criterion was more stringent than usual ( > 7 cut - off score ) , in effort to create distinct patient groups . the neurological evaluation rated participants according to hoehn and yahr ( h&y ) stages and assessed their motor symptoms using part iii of the revised mds task force unified parkinson 's disease rating scale ( updrs ) . in a similar way this was determined by calculating a total left and right score from rigidity items 3035 , voluntary movement items 3643 , and tremor items 5057 from the mds - updrs part iii ( see table 1 ) . processing speed was assessed using the trail making test , part a ( tmt - a , z - score ) . attentional set - shifting was measured using the trail making test , part b ( tmt - b , z - score ) . working memory was assessed using the digit span forward and backward subtest of the wechsler memory scale - iii ( raw scores ) . language was assessed with semantic and phonemic verbal fluency via the controlled oral word associated test ( cowat animals and letters , z - score ) . the ability to retain learned verbal memory was assessed using the logical memory subtest from the wechsler memory scale - iii ( lm - i z - score , lm - ii z - score , % lm retention z - score ) . the mini - mental state examination ( mmse ) demographic , clinical , and neuropsychological variables were compared between the two groups with the independent t - test or mann whitney u test , depending on whether the variable met parametric assumptions . chi - square tests were used to examine gender and symptom laterality differences between groups . all analyses employed an alpha level of p < 0.05 and were two - tailed . spearman correlations were performed separately in each group to examine associations between anxiety and/or depression ratings and cognitive functions . as expected , the pda+ group reported significant greater levels of anxiety on the hads - a ( u = 0 , p < 0.001 ) and higher total score on the hads ( u = 1 , p < 0.001 ) compared to the pda group ( table 1 ) . groups were matched in age ( t(48 ) = 1.31 , p = 0.20 ) , disease duration ( u = 259 , p = 0.66 ) , updrs - iii score ( u = 250.5 , p = 0.65 ) , h&y ( u = 245 , p = 0.43 ) , ledd ( u = 159.5 , p = 0.80 ) , and depression ( hads - d ) ( u = 190.5 , p = 0.06 ) . additionally , all groups were matched in the distribution of gender ( = 0.098 , p = 0.75 ) and side - affected ( = 0.765 , p = 0.38 ) . there were no group differences for tmt - a performance ( u = 256 , p = 0.62 ) ( table 2 ) ; however , the pda+ group had worse performance on the trail making test part b ( t(46 ) = 2.03 , p = 0.048 ) compared to the pda group ( figure 1 ) . the pda+ group also demonstrated significantly worse performance on the digit span forward subtest ( t(48 ) = 2.22 , p = 0.031 ) and backward subtest ( u = 190.5 , p = 0.016 ) compared to the pda group ( figures 2(a ) and 2(b ) ) . neither semantic verbal fluency ( t(47 ) = 0.70 , p = 0.49 ) nor phonemic verbal fluency ( t(47 ) = 0.39 , p = 0.70 ) differed between groups . logical memory i immediate recall test ( u = 176 , p = 0.059 ) showed a trend that the pda+ group had worse new verbal learning and immediate recall abilities than the pda group . however , logical memory ii test performance ( u = 219 , p = 0.204 ) and logical memory % retention ( u = 242.5 , p = 0.434 ) did not differ between groups . there were also no differences between groups in global cognition ( mmse ) ( u = 222.5 , p = 0.23 ) . participants were split into lpd and rpd , and then further group differences were examined between pda+ and pda. importantly , the groups remained matched in age , disease duration , updrs - iii , dde , h&y stage , and depression but remained significantly different on self - reported anxiety . lpda+ demonstrated worse performance on the digit span forward test ( t(19 ) = 2.29 , p = 0.033 ) compared to lpda , whereas rpda+ demonstrated worse performance on the digit span backward test ( u = 36.5 , p = 0.006 ) , lm - i immediate recall ( u = 37.5 , p = 0.008 ) , and lm - ii ( u = 45.0 , p = 0.021 ) but not lm % retention ( u = 75.5 , p = 0.39 ) compared to rpda. this study is the first to directly compare cognition between pd patients with and without anxiety . the findings confirmed our hypothesis that anxiety negatively influences attentional set - shifting and working memory in pd . more specifically , we found that pd patients with anxiety were more impaired on the trail making test part b which assessed attentional set - shifting , on both digit span tests which assessed working memory and attention , and to a lesser extent on the logical memory test which assessed memory and new verbal learning compared to pd patients without anxiety . taken together , these findings suggest that anxiety in pd may reduce processing capacity and impair processing efficiency , especially in the central executive and attentional systems of working memory in a similar way as seen in young healthy adults [ 26 , 27 ] . although the neurobiology of anxiety in pd remains unknown , many researchers have postulated that anxiety disorders are related to neurochemical changes that occur during the early , premotor stages of pd - related degeneration [ 37 , 38 ] such as nigrostriatal dopamine depletion , as well as cell loss within serotonergic and noradrenergic brainstem nuclei ( i.e. , raphe nuclei and locus coeruleus , resp . , which provide massive inputs to corticolimbic regions ) . over time , chronic dysregulation of adrenocortical and catecholamine functions can lead to hippocampal damage as well as dysfunctional prefrontal neural circuitries [ 39 , 40 ] , which play a key role in memory and attention . recent functional neuroimaging work has suggested that enhanced hippocampal activation during executive functioning and working memory tasks may represent compensatory processes for impaired frontostriatal functions in pd patients compared to controls . therefore , chronic stress from anxiety , for example , may disrupt compensatory processes in pd patients and explain the cognitive impairments specifically in working memory and attention seen in pd patients with anxiety . it has also been suggested that hyperactivation within the putamen may reflect a compensatory striatal mechanism to maintain normal working memory performance in pd patients ; however , losing this compensatory activation has been shown to contribute to poor working memory performance . anxiety in mild pd has been linked to reduced putamen dopamine uptake which becomes more extensive as the disease progresses . this further supports the notion that anxiety may disrupt compensatory striatal mechanisms as well , providing another possible explanation for the cognitive impairments observed in pd patients with anxiety in this study . noradrenergic and serotonergic systems should also be considered when trying to explain the mechanisms by which anxiety may influence cognition in pd . although these neurotransmitter systems are relatively understudied in pd cognition , treating the noradrenergic and serotonergic systems has shown beneficial effects on cognition in pd . selective serotonin reuptake inhibitor , citalopram , was shown to improve response inhibition deficits in pd , while noradrenaline reuptake blocker , atomoxetine , has been recently reported to have promising effects on cognition in pd [ 45 , 46 ] . overall , very few neuroimaging studies have been conducted in pd in order to understand the neural correlates of pd anxiety and its underlying neural pathology . future research should focus on relating anatomical changes and neurochemical changes to neural activation in order to gain a clearer understanding on how these pathologies affect anxiety in pd . to further understand how anxiety and cognitive dysfunction are related , future research should focus on using advanced structural and function imaging techniques to explain both cognitive and neural breakdowns that are associated with anxiety in pd patients . research has indicated that those with amnestic mild cognitive impairment who have more neuropsychiatric symptoms have a greater risk of developing dementia compared to those with fewer neuropsychiatric symptoms . future studies should also examine whether treating neuropsychiatric symptoms might impact the progression of cognitive decline and improve cognitive impairments in pd patients . previous studies have used pd symptom laterality as a window to infer asymmetrical dysfunction of neural circuits . for example , lpd patients have greater inferred right hemisphere pathology , whereas rpd patients have greater inferred left hemisphere pathology . thus , cognitive domains predominantly subserved by the left hemisphere ( e.g. , verbally mediated tasks of executive function and verbal memory ) might be hypothesized to be more affected in rpd than lpd ; however , this remains controversial . it has also been suggested that since anxiety is a common feature of left hemisphere involvement [ 48 , 49 ] , cognitive domains subserved by the left hemisphere may also be more strongly related to anxiety . results from this study showed selective verbal memory deficits in rpd patients with anxiety compared to rpd without anxiety , whereas lpd patients with anxiety had greater attentional / working memory deficits compared to lpd without anxiety . although these results align with previous research , interpretations of these findings should be made with caution due to the small sample size in the lpd comparison specifically . recent work has suggested that the hads questionnaire may underestimate the burden of anxiety related symptomology and therefore be a less sensitive measure of anxiety in pd [ 30 , 50 ] . in addition , our small sample size also limited the statistical power for detecting significant findings . based on these limitations , our findings are likely conservative and underrepresent the true impact anxiety has on cognition in pd . additionally , the current study employed a very brief neuropsychological assessment including one or two tests for each cognitive domain . future studies are encouraged to collect a more complex and comprehensive battery from a larger sample of pd participants in order to better understand the role anxiety plays on cognition in pd . another limitation of this study was the absence of diagnostic interviews to characterize participants ' psychiatric symptoms and specify the type of anxiety disorders included in this study . future studies should perform diagnostic interviews with participants ( e.g. , using dsm - v criteria ) rather than relying on self - reported measures to group participants , in order to better understand whether the type of anxiety disorder ( e.g. , social anxiety , phobias , panic disorders , and generalized anxiety ) influences cognitive performance differently in pd . one advantage the hads questionnaire provided over other anxiety scales was that it assessed both anxiety and depression simultaneously and allowed us to control for coexisting depression . although there was a trend that the pda+ group self - reported higher levels of depression than the pda group , all participants included in the study scored < 6 on the depression subscale of the hads . controlling for depression while assessing anxiety has been identified as a key shortcoming in the majority of recent work . considering many previous studies have investigated the influence of depression on cognition in pd without accounting for the presence of anxiety and the inconsistent findings reported to date , we recommend that future research should try to disentangle the influence of anxiety versus depression on cognitive impairments in pd . considering the growing number of clinical trials for treating depression , there are few if any for the treatment of anxiety in pd . anxiety is a key contributor to decreased quality of life in pd and greatly requires better treatment options . moreover , anxiety has been suggested to play a key role in freezing of gait ( fog ) , which is also related to attentional set - shifting [ 52 , 53 ] . future research should examine the link between anxiety , set - shifting , and fog , in order to determine whether treating anxiety might be a potential therapy for improving fog .""" import torch from transformers import AutoTokenizer, LongT5ForConditionalGeneration tokenizer = AutoTokenizer.from_pretrained("Stancld/longt5-tglobal-large-16384-pubmed-3k_steps") input_ids = tokenizer(LONG_ARTICLE, return_tensors="pt").input_ids.to("cuda") model = LongT5ForConditionalGeneration.from_pretrained("Stancld/longt5-tglobal-large-16384-pubmed-3k_steps", return_dict_in_generate=True).to("cuda") sequences = model.generate(input_ids).sequences summary = tokenizer.batch_decode(sequences) ```
prithivida/passive_to_active_styletransfer
81b7ef1c02f244ac9030d928f2c5a01a037c2430
2021-06-23T13:45:25.000Z
[ "pytorch", "t5", "text2text-generation", "transformers", "autotrain_compatible" ]
text2text-generation
false
prithivida
null
prithivida/passive_to_active_styletransfer
940
3
transformers
1,811
## This model belongs to the Styleformer project [Please refer to github page](https://github.com/PrithivirajDamodaran/Styleformer)
Helsinki-NLP/opus-mt-cy-en
775c85089bc7a55c8203bff544e9fa34cd4ba7ca
2021-09-09T21:29:44.000Z
[ "pytorch", "marian", "text2text-generation", "cy", "en", "transformers", "translation", "license:apache-2.0", "autotrain_compatible" ]
translation
false
Helsinki-NLP
null
Helsinki-NLP/opus-mt-cy-en
938
null
transformers
1,812
--- tags: - translation license: apache-2.0 --- ### opus-mt-cy-en * source languages: cy * target languages: en * OPUS readme: [cy-en](https://github.com/Helsinki-NLP/OPUS-MT-train/blob/master/models/cy-en/README.md) * dataset: opus * model: transformer-align * pre-processing: normalization + SentencePiece * download original weights: [opus-2019-12-18.zip](https://object.pouta.csc.fi/OPUS-MT-models/cy-en/opus-2019-12-18.zip) * test set translations: [opus-2019-12-18.test.txt](https://object.pouta.csc.fi/OPUS-MT-models/cy-en/opus-2019-12-18.test.txt) * test set scores: [opus-2019-12-18.eval.txt](https://object.pouta.csc.fi/OPUS-MT-models/cy-en/opus-2019-12-18.eval.txt) ## Benchmarks | testset | BLEU | chr-F | |-----------------------|-------|-------| | Tatoeba.cy.en | 33.0 | 0.525 |
nreimers/MiniLMv2-L6-H768-distilled-from-RoBERTa-Large
242150e6be5fb4f7cdb66dbc6bffac542ff828ca
2021-06-20T19:02:48.000Z
[ "pytorch", "roberta", "fill-mask", "transformers", "autotrain_compatible" ]
fill-mask
false
nreimers
null
nreimers/MiniLMv2-L6-H768-distilled-from-RoBERTa-Large
935
null
transformers
1,813
# MiniLMv2 This is a MiniLMv2 model from: [https://github.com/microsoft/unilm](https://github.com/microsoft/unilm/tree/master/minilm)
MoritzLaurer/DeBERTa-v3-xsmall-mnli-fever-anli-ling-binary
e239423547914eda65121a26121768656f7a6400
2022-07-28T16:23:45.000Z
[ "pytorch", "deberta-v2", "text-classification", "en", "dataset:multi_nli", "dataset:anli", "dataset:fever", "dataset:lingnli", "arxiv:2104.07179", "arxiv:2111.09543", "transformers", "zero-shot-classification", "license:mit" ]
zero-shot-classification
false
MoritzLaurer
null
MoritzLaurer/DeBERTa-v3-xsmall-mnli-fever-anli-ling-binary
934
null
transformers
1,814
--- language: - en license: mit tags: - text-classification - zero-shot-classification metrics: - accuracy datasets: - multi_nli - anli - fever - lingnli pipeline_tag: zero-shot-classification --- # DeBERTa-v3-xsmall-mnli-fever-anli-ling-binary ## Model description This model was trained on 782 357 hypothesis-premise pairs from 4 NLI datasets: [MultiNLI](https://huggingface.co/datasets/multi_nli), [Fever-NLI](https://github.com/easonnie/combine-FEVER-NSMN/blob/master/other_resources/nli_fever.md), [LingNLI](https://arxiv.org/abs/2104.07179) and [ANLI](https://github.com/facebookresearch/anli). Note that the model was trained on binary NLI to predict either "entailment" or "not-entailment". This is specifically designed for zero-shot classification, where the difference between "neutral" and "contradiction" is irrelevant. The base model is [DeBERTa-v3-xsmall from Microsoft](https://huggingface.co/microsoft/deberta-v3-xsmall). The v3 variant of DeBERTa substantially outperforms previous versions of the model by including a different pre-training objective, see the [DeBERTa-V3 paper](https://arxiv.org/abs/2111.09543). For highest performance (but less speed), I recommend using https://huggingface.co/MoritzLaurer/DeBERTa-v3-large-mnli-fever-anli-ling-wanli. ## Intended uses & limitations #### How to use the model ```python from transformers import AutoTokenizer, AutoModelForSequenceClassification import torch device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu") model_name = "MoritzLaurer/DeBERTa-v3-xsmall-mnli-fever-anli-ling-binary" tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForSequenceClassification.from_pretrained(model_name) premise = "I first thought that I liked the movie, but upon second thought it was actually disappointing." hypothesis = "The movie was good." input = tokenizer(premise, hypothesis, truncation=True, return_tensors="pt") output = model(input["input_ids"].to(device)) # device = "cuda:0" or "cpu" prediction = torch.softmax(output["logits"][0], -1).tolist() label_names = ["entailment", "not_entailment"] prediction = {name: round(float(pred) * 100, 1) for pred, name in zip(prediction, label_names)} print(prediction) ``` ### Training data This model was trained on 782 357 hypothesis-premise pairs from 4 NLI datasets: [MultiNLI](https://huggingface.co/datasets/multi_nli), [Fever-NLI](https://github.com/easonnie/combine-FEVER-NSMN/blob/master/other_resources/nli_fever.md), [LingNLI](https://arxiv.org/abs/2104.07179) and [ANLI](https://github.com/facebookresearch/anli). ### Training procedure DeBERTa-v3-xsmall-mnli-fever-anli-ling-binary was trained using the Hugging Face trainer with the following hyperparameters. ``` training_args = TrainingArguments( num_train_epochs=5, # total number of training epochs learning_rate=2e-05, per_device_train_batch_size=32, # batch size per device during training per_device_eval_batch_size=32, # batch size for evaluation warmup_ratio=0.1, # number of warmup steps for learning rate scheduler weight_decay=0.06, # strength of weight decay fp16=True # mixed precision training ) ``` ### Eval results The model was evaluated using the binary test sets for MultiNLI, ANLI, LingNLI and the binary dev set for Fever-NLI (two classes instead of three). The metric used is accuracy. dataset | mnli-m-2c | mnli-mm-2c | fever-nli-2c | anli-all-2c | anli-r3-2c | lingnli-2c --------|---------|----------|---------|----------|----------|------ accuracy | 0.925 | 0.922 | 0.892 | 0.676 | 0.665 | 0.888 speed (text/sec, CPU, 128 batch) | 6.0 | 6.3 | 3.0 | 5.8 | 5.0 | 7.6 speed (text/sec, GPU Tesla P100, 128 batch) | 473 | 487 | 230 | 390 | 340 | 586 ## Limitations and bias Please consult the original DeBERTa paper and literature on different NLI datasets for potential biases. ## Citation If you use this model, please cite: Laurer, Moritz, Wouter van Atteveldt, Andreu Salleras Casas, and Kasper Welbers. 2022. ‘Less Annotating, More Classifying – Addressing the Data Scarcity Issue of Supervised Machine Learning with Deep Transfer Learning and BERT - NLI’. Preprint, June. Open Science Framework. https://osf.io/74b8k. ### Ideas for cooperation or questions? If you have questions or ideas for cooperation, contact me at m{dot}laurer{at}vu{dot}nl or [LinkedIn](https://www.linkedin.com/in/moritz-laurer/) ### Debugging and issues Note that DeBERTa-v3 was released on 06.12.21 and older versions of HF Transformers seem to have issues running the model (e.g. resulting in an issue with the tokenizer). Using Transformers>=4.13 might solve some issues.
microsoft/swin-base-patch4-window12-384-in22k
c2c8cfc218cfcf3f43091c4476137ed4f2fed9a2
2022-05-16T18:01:06.000Z
[ "pytorch", "tf", "swin", "image-classification", "dataset:imagenet-21k", "arxiv:2103.14030", "transformers", "vision", "license:apache-2.0" ]
image-classification
false
microsoft
null
microsoft/swin-base-patch4-window12-384-in22k
932
null
transformers
1,815
--- license: apache-2.0 tags: - vision - image-classification datasets: - imagenet-21k widget: - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/tiger.jpg example_title: Tiger - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/teapot.jpg example_title: Teapot - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/palace.jpg example_title: Palace --- # Swin Transformer (large-sized model) Swin Transformer model pre-trained on ImageNet-21k (14 million images, 21,841 classes) at resolution 384x384. It was introduced in the paper [Swin Transformer: Hierarchical Vision Transformer using Shifted Windows](https://arxiv.org/abs/2103.14030) by Liu et al. and first released in [this repository](https://github.com/microsoft/Swin-Transformer). Disclaimer: The team releasing Swin Transformer did not write a model card for this model so this model card has been written by the Hugging Face team. ## Model description The Swin Transformer is a type of Vision Transformer. It builds hierarchical feature maps by merging image patches (shown in gray) in deeper layers and has linear computation complexity to input image size due to computation of self-attention only within each local window (shown in red). It can thus serve as a general-purpose backbone for both image classification and dense recognition tasks. In contrast, previous vision Transformers produce feature maps of a single low resolution and have quadratic computation complexity to input image size due to computation of self-attention globally. ![model image](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/swin_transformer_architecture.png) [Source](https://paperswithcode.com/method/swin-transformer) ## Intended uses & limitations You can use the raw model for image classification. See the [model hub](https://huggingface.co/models?search=swin) to look for fine-tuned versions on a task that interests you. ### How to use Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes: ```python from transformers import AutoFeatureExtractor, SwinForImageClassification from PIL import Image import requests url = "http://images.cocodataset.org/val2017/000000039769.jpg" image = Image.open(requests.get(url, stream=True).raw) feature_extractor = AutoFeatureExtractor.from_pretrained("microsoft/swin-base-patch4-window12-384-in22k") model = SwinForImageClassification.from_pretrained("microsoft/swin-base-patch4-window12-384-in22k") inputs = feature_extractor(images=image, return_tensors="pt") outputs = model(**inputs) logits = outputs.logits # model predicts one of the 1000 ImageNet classes predicted_class_idx = logits.argmax(-1).item() print("Predicted class:", model.config.id2label[predicted_class_idx]) ``` For more code examples, we refer to the [documentation](https://huggingface.co/transformers/model_doc/swin.html#). ### BibTeX entry and citation info ```bibtex @article{DBLP:journals/corr/abs-2103-14030, author = {Ze Liu and Yutong Lin and Yue Cao and Han Hu and Yixuan Wei and Zheng Zhang and Stephen Lin and Baining Guo}, title = {Swin Transformer: Hierarchical Vision Transformer using Shifted Windows}, journal = {CoRR}, volume = {abs/2103.14030}, year = {2021}, url = {https://arxiv.org/abs/2103.14030}, eprinttype = {arXiv}, eprint = {2103.14030}, timestamp = {Thu, 08 Apr 2021 07:53:26 +0200}, biburl = {https://dblp.org/rec/journals/corr/abs-2103-14030.bib}, bibsource = {dblp computer science bibliography, https://dblp.org} } ```
roberta-large-openai-detector
5002d695ecf610d8bbfb1fa0d14f1575185b4915
2022-07-22T08:07:41.000Z
[ "pytorch", "jax", "roberta", "text-classification", "en", "dataset:bookcorpus", "dataset:wikipedia", "arxiv:1904.09751", "arxiv:1910.09700", "transformers", "exbert", "license:mit" ]
text-classification
false
null
null
roberta-large-openai-detector
928
1
transformers
1,816
--- language: en license: mit tags: - exbert datasets: - bookcorpus - wikipedia --- # RoBERTa Large OpenAI Detector ## Table of Contents - [Model Details](#model-details) - [Uses](#uses) - [Risks, Limitations and Biases](#risks-limitations-and-biases) - [Training](#training) - [Evaluation](#evaluation) - [Environmental Impact](#environmental-impact) - [Technical Specifications](#technical-specifications) - [Citation Information](#citation-information) - [Model Card Authors](#model-card-authors) - [How To Get Started With the Model](#how-to-get-started-with-the-model) ## Model Details **Model Description:** RoBERTa large OpenAI Detector is the GPT-2 output detector model, obtained by fine-tuning a RoBERTa large model with the outputs of the 1.5B-parameter GPT-2 model. The model can be used to predict if text was generated by a GPT-2 model. This model was released by OpenAI at the same time as OpenAI released the weights of the [largest GPT-2 model](https://huggingface.co/gpt2-xl), the 1.5B parameter version. - **Developed by:** OpenAI, see [GitHub Repo](https://github.com/openai/gpt-2-output-dataset/tree/master/detector) and [associated paper](https://d4mucfpksywv.cloudfront.net/papers/GPT_2_Report.pdf) for full author list - **Model Type:** Fine-tuned transformer-based language model - **Language(s):** English - **License:** MIT - **Related Models:** [RoBERTa large](https://huggingface.co/roberta-large), [GPT-XL (1.5B parameter version)](https://huggingface.co/gpt2-xl), [GPT-Large (the 774M parameter version)](https://huggingface.co/gpt2-large), [GPT-Medium (the 355M parameter version)](https://huggingface.co/gpt2-medium) and [GPT-2 (the 124M parameter version)](https://huggingface.co/gpt2) - **Resources for more information:** - [Research Paper](https://d4mucfpksywv.cloudfront.net/papers/GPT_2_Report.pdf) (see, in particular, the section beginning on page 12 about Automated ML-based detection). - [GitHub Repo](https://github.com/openai/gpt-2-output-dataset/tree/master/detector) - [OpenAI Blog Post](https://openai.com/blog/gpt-2-1-5b-release/) - [Explore the detector model here](https://huggingface.co/openai-detector ) ## Uses #### Direct Use The model is a classifier that can be used to detect text generated by GPT-2 models. #### Downstream Use The model's developers have stated that they developed and released the model to help with research related to synthetic text generation, so the model could potentially be used for downstream tasks related to synthetic text generation. See the [associated paper](https://d4mucfpksywv.cloudfront.net/papers/GPT_2_Report.pdf) for further discussion. #### Misuse and Out-of-scope Use The model should not be used to intentionally create hostile or alienating environments for people. In addition, the model developers discuss the risk of adversaries using the model to better evade detection in their [associated paper](https://d4mucfpksywv.cloudfront.net/papers/GPT_2_Report.pdf), suggesting that using the model for evading detection or for supporting efforts to evade detection would be a misuse of the model. ## Risks, Limitations and Biases **CONTENT WARNING: Readers should be aware this section may contain content that is disturbing, offensive, and can propagate historical and current stereotypes.** Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. #### Risks and Limitations In their [associated paper](https://d4mucfpksywv.cloudfront.net/papers/GPT_2_Report.pdf), the model developers discuss the risk that the model may be used by bad actors to develop capabilities for evading detection, though one purpose of releasing the model is to help improve detection research. In a related [blog post](https://openai.com/blog/gpt-2-1-5b-release/), the model developers also discuss the limitations of automated methods for detecting synthetic text and the need to pair automated detection tools with other, non-automated approaches. They write: > We conducted in-house detection research and developed a detection model that has detection rates of ~95% for detecting 1.5B GPT-2-generated text. We believe this is not high enough accuracy for standalone detection and needs to be paired with metadata-based approaches, human judgment, and public education to be more effective. The model developers also [report](https://openai.com/blog/gpt-2-1-5b-release/) finding that classifying content from larger models is more difficult, suggesting that detection with automated tools like this model will be increasingly difficult as model sizes increase. The authors find that training detector models on the outputs of larger models can improve accuracy and robustness. #### Bias Significant research has explored bias and fairness issues with language models (see, e.g., [Sheng et al. (2021)](https://aclanthology.org/2021.acl-long.330.pdf) and [Bender et al. (2021)](https://dl.acm.org/doi/pdf/10.1145/3442188.3445922)). Predictions generated by RoBERTa large and GPT-2 1.5B (which this model is built/fine-tuned on) can include disturbing and harmful stereotypes across protected classes; identity characteristics; and sensitive, social, and occupational groups (see the [RoBERTa large](https://huggingface.co/roberta-large) and [GPT-2 XL](https://huggingface.co/gpt2-xl) model cards for more information). The developers of this model discuss these issues further in their [paper](https://d4mucfpksywv.cloudfront.net/papers/GPT_2_Report.pdf). ## Training #### Training Data The model is a sequence classifier based on RoBERTa large (see the [RoBERTa large model card](https://huggingface.co/roberta-large) for more details on the RoBERTa large training data) and then fine-tuned using the outputs of the 1.5B GPT-2 model (available [here](https://github.com/openai/gpt-2-output-dataset)). #### Training Procedure The model developers write that: > We based a sequence classifier on RoBERTaLARGE (355 million parameters) and fine-tuned it to classify the outputs from the 1.5B GPT-2 model versus WebText, the dataset we used to train the GPT-2 model. They later state: > To develop a robust detector model that can accurately classify generated texts regardless of the sampling method, we performed an analysis of the model’s transfer performance. See the [associated paper](https://d4mucfpksywv.cloudfront.net/papers/GPT_2_Report.pdf) for further details on the training procedure. ## Evaluation The following evaluation information is extracted from the [associated paper](https://d4mucfpksywv.cloudfront.net/papers/GPT_2_Report.pdf). #### Testing Data, Factors and Metrics The model is intended to be used for detecting text generated by GPT-2 models, so the model developers test the model on text datasets, measuring accuracy by: > testing 510-token test examples comprised of 5,000 samples from the WebText dataset and 5,000 samples generated by a GPT-2 model, which were not used during the training. #### Results The model developers [find](https://d4mucfpksywv.cloudfront.net/papers/GPT_2_Report.pdf): > Our classifier is able to detect 1.5 billion parameter GPT-2-generated text with approximately 95% accuracy...The model’s accuracy depends on sampling methods used when generating outputs, like temperature, Top-K, and nucleus sampling ([Holtzman et al., 2019](https://arxiv.org/abs/1904.09751). Nucleus sampling outputs proved most difficult to correctly classify, but a detector trained using nucleus sampling transfers well across other sampling methods. As seen in Figure 1 [in the paper], we found consistently high accuracy when trained on nucleus sampling. See the [associated paper](https://d4mucfpksywv.cloudfront.net/papers/GPT_2_Report.pdf), Figure 1 (on page 14) and Figure 2 (on page 16) for full results. ## Environmental Impact Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700). - **Hardware Type:** Unknown - **Hours used:** Unknown - **Cloud Provider:** Unknown - **Compute Region:** Unknown - **Carbon Emitted:** Unknown ## Technical Specifications The model developers write that: See the [associated paper](https://d4mucfpksywv.cloudfront.net/papers/GPT_2_Report.pdf) for further details on the modeling architecture and training details. ## Citation Information ```bibtex @article{solaiman2019release, title={Release strategies and the social impacts of language models}, author={Solaiman, Irene and Brundage, Miles and Clark, Jack and Askell, Amanda and Herbert-Voss, Ariel and Wu, Jeff and Radford, Alec and Krueger, Gretchen and Kim, Jong Wook and Kreps, Sarah and others}, journal={arXiv preprint arXiv:1908.09203}, year={2019} } ``` APA: - Solaiman, I., Brundage, M., Clark, J., Askell, A., Herbert-Voss, A., Wu, J., ... & Wang, J. (2019). Release strategies and the social impacts of language models. arXiv preprint arXiv:1908.09203. ## Model Card Authors This model card was written by the team at Hugging Face. ## How to Get Started with the Model More information needed
vinai/vinai-translate-vi2en
89ca166856afab4610d0fcc4bff495940b5200ad
2022-07-06T07:19:15.000Z
[ "pytorch", "tf", "mbart", "text2text-generation", "transformers", "autotrain_compatible" ]
text2text-generation
false
vinai
null
vinai/vinai-translate-vi2en
928
null
transformers
1,817
# A Vietnamese-English Neural Machine Translation System Our pre-trained VinAI Translate models `vinai/vinai-translate-vi2en` and `vinai/vinai-translate-en2vi` are state-of-the-art text translation models for Vietnamese-to-English and English-to-Vietnamese, respectively. The general architecture and experimental results of VinAI Translate can be found in [our paper](https://openreview.net/forum?id=CRg-RaxKnai): @inproceedings{vinaitranslate, title = {{A Vietnamese-English Neural Machine Translation System}}, author = {Thien Hai Nguyen and Tuan-Duy H. Nguyen and Duy Phung and Duy Tran-Cong Nguyen and Hieu Minh Tran and Manh Luong and Tin Duy Vo and Hung Hai Bui and Dinh Phung and Dat Quoc Nguyen}, booktitle = {Proceedings of the 23rd Annual Conference of the International Speech Communication Association: Show and Tell (INTERSPEECH)}, year = {2022} } Please **CITE** our paper whenever the pre-trained models or the system are used to help produce published results or incorporated into other software. For further information or requests, please go to [VinAI Translate's homepage](https://github.com/VinAIResearch/VinAI_Translate)!
thu-coai/LongLM-small
efadc09553dbe3bfc965dc82aeb9be3d1f224212
2021-11-24T05:12:01.000Z
[ "pytorch", "t5", "text2text-generation", "zh", "arxiv:2108.12960", "transformers", "lm-head", "autotrain_compatible" ]
text2text-generation
false
thu-coai
null
thu-coai/LongLM-small
925
1
transformers
1,818
--- language: - zh thumbnail: http://coai.cs.tsinghua.edu.cn/coai/img/logo.png?v=13923 tags: - pytorch - lm-head - zh datasets: metrics: widget: - text: "小咕噜对靳司寒完全是个自来熟,小家伙爬进他怀里小手搂着他的脖子,奶声奶气的要求:“靳蜀黎,你给咕噜讲故事好不好?”讲故事?童话故事吗?“我不会。”小家伙明显不信。嘟着小嘴大眼汪汪的盯着他,“哼。”小家伙轻轻哼了一声,靳司寒默了半晌,<extra_id_1>" - text: "美女亲自打招呼,这可是破天荒第一次,之前不管他献多少次殷勤,美女<extra_id_1>甩他,难道今天真是老天<extra_id_2>不敢<extra_id_3>的兄连滚带爬的来到<extra_id_4>身边队友都带着艳<extra_id_5>他,<extra_id_6>连计算机系的那票球友都在那儿不住地偷看MAGGIE,这种感觉真<extra_id_7>毙了!" inference: parameters: top_p: 0.9 --- ## LongLM ### 1. Parameters | Versions | $d_m$ | $d_{ff}$ | $d_{kv}$ | $n_h$ | $n_e/n_d$ | \# P | | ------------ | ----- | -------- | -------- | ----- | --------- | ---- | | LongLM-small | 512 | 2,048 | 64 | 8 | 6/6 | 60M | | LongLM-base | 768 | 3,072 | 64 | 12 | 12/12 | 223M | | LongLM-large | 1,536 | 3,072 | 64 | 12 | 24/32 | 1B | - $d_m$: the dimension of hidden states - $d_{ff}$: the dimension of feed forward layers - $d_{kv}$: the dimension of the keys/values in the self-attention layers - $n_h$: the number of attention heads - $n_e$: the number of hidden layers of the encoder - $n_d$: the number of hidden layers of the decoder - \#P: the number of parameters ### 2. Pretraining Tasks Encoder-decoder models are trained typically by maximizing the likelihood of the target output given an input. To improve the capacities of both the encoder and decoder, we propose to train LongLM with two pretraining tasks including text infilling (Raffel et al., 2020) and conditional continuation (Radford et al., 2019). For the first task, the input is a text where a number of spans are sampled and replaced by special tokens with unique IDs, while the output is the spans delimited by the special tokens used in the input. The lengths of masked spans are drawn from a Poisson distribution with λ=3 and all masked tokens compress 15% of the original texts. As for the second task, the input and output are respectively the front and back half of a text, which is split into two parts randomly. ### 3. Pretraining Data We collect 120G novels as the pretraining data for LongLM. ### 4. Checkpoints 1. **Model Loading:** ```python\ from transformers import T5Tokenizer, T5ForConditionalGeneration tokenizer = T5Tokenizer.from_pretrained('LongLM-large') model = T5ForConditionalGeneration.from_pretrained('LongLM-large') ``` 2. **Generation:** ```python input_ids = tokenizer("小咕噜对,<extra_id_1>",return_tensors="pt", padding=True, truncation=True, max_length=512).input_ids.to(device) gen = model.generate(input_ids, do_sample=True, decoder_start_token_id=1, top_p=0.9, max_length=512) ``` ### 5. Dependencies ``` datasets 1.6.2 deepspeed 0.3.16 huggingface-hub 0.0.8 jieba 0.42.1 jsonlines 2.0.0 nltk 3.5 numpy 1.19.5 pytorch-lightning 1.2.0 regex 2020.11.13 rouge 1.0.1 rouge-score 0.0.4 sacrebleu 1.5.0 scipy 1.5.4 sentencepiece 0.1.95 tokenizers 0.10.1 torch 1.8.1 torchaudio 0.8.0 torchmetrics 0.2.0 torchvision 0.9.0 transformers 4.6.1 ``` ### 6. Contributers [Jian Guan](https://jianguanthu.github.io/) at [thu-coai](http://coai.cs.tsinghua.edu.cn/) ## Citation ```txt @misc{guan2021lot, title={LOT: A Benchmark for Evaluating Chinese Long Text Understanding and Generation}, author={Jian Guan and Zhuoer Feng and Yamei Chen and Ruilin He and Xiaoxi Mao and Changjie Fan and Minlie Huang}, year={2021}, eprint={2108.12960}, archivePrefix={arXiv}, primaryClass={cs.CL} } ```
IDEA-CCNL/Randeng-Pegasus-523M-Summary-Chinese
7022713ba0b7754e6017d9acfa18d894fdaad847
2022-07-30T02:15:06.000Z
[ "pytorch", "pegasus", "text2text-generation", "zh", "transformers", "summarization", "autotrain_compatible" ]
summarization
false
IDEA-CCNL
null
IDEA-CCNL/Randeng-Pegasus-523M-Summary-Chinese
924
2
transformers
1,819
--- language: zh tags: - summarization inference: False --- IDEA-CCNL/Randeng-Pegasus-523M-Summary-Chinese model (Chinese) has 523M million parameter, pretrained on 180G Chinese data with GSG task which is stochastically sample important sentences with sampled gap sentence ratios by 25%. The pretraining task just as same as the paper PEGASUS: Pre-training with Extracted Gap-sentences for Abstractive Summarization mentioned. Different from the English version of pegasus, considering that the Chinese sentence piece is unstable, we use jieba and Bertokenizer as the tokenizer in chinese pegasus model. After pre-training, We use 8 summary datasets which we collect on the internet to do the supervised training. The 8 datasets include education_data, new2016zh_data, nlpcc, shence_data, sohu_data, thucnews_data and weibo_data, four million training samples in all. And then we use lcsts datasets to train and evalute this model, the results are shown below. | datasets | rouge-1 | rouge-2 | rouge-L | | ---- | ---- | ---- | ---- | | LCSTS | 48.00 | 35.24 | 44.70 | We also trained a base model, available with [IDEA-CCNL/Randeng-Pegasus-238M-Summary-Chinese](https://huggingface.co/IDEA-CCNL/Randeng-Pegasus-238M-Summary-Chinese) Task: Summarization ## Usage ```python from transformers import PegasusForConditionalGeneration # Need to download tokenizers_pegasus.py and other Python script from Fengshenbang-LM github repo in advance, # or you can download tokenizers_pegasus.py and data_utils.py in https://huggingface.co/IDEA-CCNL/Randeng_Pegasus_523M/tree/main # Strongly recommend you git clone the Fengshenbang-LM repo: # 1. git clone https://github.com/IDEA-CCNL/Fengshenbang-LM # 2. cd Fengshenbang-LM/fengshen/examples/pegasus/ # and then you will see the tokenizers_pegasus.py and data_utils.py which are needed by pegasus model from tokenizers_pegasus import PegasusTokenizer model = PegasusForConditionalGeneration.from_pretrained("IDEA-CCNL/Randeng-Pegasus-523M-Summary-Chinese") tokenizer = PegasusTokenizer.from_pretrained("IDEA-CCNL/Randeng-Pegasus-523M-Summary-Chinese") text = "据微信公众号“界面”报道,4日上午10点左右,中国发改委反垄断调查小组突击查访奔驰上海办事处,调取数据材料,并对多名奔驰高管进行了约谈。截止昨日晚9点,包括北京梅赛德斯-奔驰销售服务有限公司东区总经理在内的多名管理人员仍留在上海办公室内" inputs = tokenizer(text, max_length=1024, return_tensors="pt") # Generate Summary summary_ids = model.generate(inputs["input_ids"]) tokenizer.batch_decode(summary_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0] # model Output: 反垄断调查小组突击查访奔驰上海办事处,对多名奔驰高管进行约谈 ``` ## Citation If you find the resource is useful, please cite the following website in your paper. ``` @misc{Fengshenbang-LM, title={Fengshenbang-LM}, author={IDEA-CCNL}, year={2022}, howpublished={\url{https://github.com/IDEA-CCNL/Fengshenbang-LM}}, } ```
BSC-TeMU/roberta-base-biomedical-es
6e457abe0082958dc8cb7762c9ec8ed8b8a7b2c0
2021-10-21T10:28:29.000Z
[ "pytorch", "roberta", "fill-mask", "es", "arxiv:2109.03570", "arxiv:2109.07765", "transformers", "biomedical", "spanish", "license:apache-2.0", "autotrain_compatible" ]
fill-mask
false
BSC-TeMU
null
BSC-TeMU/roberta-base-biomedical-es
923
3
transformers
1,820
--- language: - es tags: - biomedical - spanish license: apache-2.0 metrics: - ppl widget: - text: "El único antecedente personal a reseñar era la <mask> arterial." - text: "Las radiologías óseas de cuerpo entero no detectan alteraciones <mask>, ni alteraciones vertebrales." - text: "En el <mask> toraco-abdómino-pélvico no se encontraron hallazgos patológicos de interés." --- **⚠️NOTICE⚠️: THIS MODEL HAS BEEN MOVED TO THE FOLLOWING URL AND WILL SOON BE REMOVED:** https://huggingface.co/PlanTL-GOB-ES/roberta-base-biomedical-es # Biomedical language model for Spanish Biomedical pretrained language model for Spanish. For more details about the corpus, the pretraining and the evaluation, check the official [repository](https://github.com/PlanTL-SANIDAD/lm-biomedical-clinical-es) and read our [preprint](https://arxiv.org/abs/2109.03570) "_Carrino, C. P., Armengol-Estapé, J., Gutiérrez-Fandiño, A., Llop-Palao, J., Pàmies, M., Gonzalez-Agirre, A., & Villegas, M. (2021). Biomedical and Clinical Language Models for Spanish: On the Benefits of Domain-Specific Pretraining in a Mid-Resource Scenario._". ## Tokenization and model pretraining This model is a [RoBERTa-based](https://github.com/pytorch/fairseq/tree/master/examples/roberta) model trained on a **biomedical** corpus in Spanish collected from several sources (see next section). The training corpus has been tokenized using a byte version of [Byte-Pair Encoding (BPE)](https://github.com/openai/gpt-2) used in the original [RoBERTA](https://github.com/pytorch/fairseq/tree/master/examples/roberta) model with a vocabulary size of 52,000 tokens. The pretraining consists of a masked language model training at the subword level following the approach employed for the RoBERTa base model with the same hyperparameters as in the original work. The training lasted a total of 48 hours with 16 NVIDIA V100 GPUs of 16GB DDRAM, using Adam optimizer with a peak learning rate of 0.0005 and an effective batch size of 2,048 sentences. ## Training corpora and preprocessing The training corpus is composed of several biomedical corpora in Spanish, collected from publicly available corpora and crawlers. To obtain a high-quality training corpus, a cleaning pipeline with the following operations has been applied: - data parsing in different formats - sentence splitting - language detection - filtering of ill-formed sentences - deduplication of repetitive contents - keep the original document boundaries Finally, the corpora are concatenated and further global deduplication among the corpora have been applied. The result is a medium-size biomedical corpus for Spanish composed of about 963M tokens. The table below shows some basic statistics of the individual cleaned corpora: | Name | No. tokens | Description | |-----------------------------------------------------------------------------------------|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Medical crawler](https://zenodo.org/record/4561970) | 745,705,946 | Crawler of more than 3,000 URLs belonging to Spanish biomedical and health domains. | | Clinical cases misc. | 102,855,267 | A miscellany of medical content, essentially clinical cases. Note that a clinical case report is a scientific publication where medical practitioners share patient cases and it is different from a clinical note or document. | | [Scielo](https://github.com/PlanTL-SANIDAD/SciELO-Spain-Crawler) | 60,007,289 | Publications written in Spanish crawled from the Spanish SciELO server in 2017. | | [BARR2_background](https://temu.bsc.es/BARR2/downloads/background_set.raw_text.tar.bz2) | 24,516,442 | Biomedical Abbreviation Recognition and Resolution (BARR2) containing Spanish clinical case study sections from a variety of clinical disciplines. | | Wikipedia_life_sciences | 13,890,501 | Wikipedia articles crawled 04/01/2021 with the [Wikipedia API python library](https://pypi.org/project/Wikipedia-API/) starting from the "Ciencias\_de\_la\_vida" category up to a maximum of 5 subcategories. Multiple links to the same articles are then discarded to avoid repeating content. | | Patents | 13,463,387 | Google Patent in Medical Domain for Spain (Spanish). The accepted codes (Medical Domain) for Json files of patents are: "A61B", "A61C","A61F", "A61H", "A61K", "A61L","A61M", "A61B", "A61P". | | [EMEA](http://opus.nlpl.eu/download.php?f=EMEA/v3/moses/en-es.txt.zip) | 5,377,448 | Spanish-side documents extracted from parallel corpora made out of PDF documents from the European Medicines Agency. | | [mespen_Medline](https://zenodo.org/record/3562536#.YTt1fH2xXbR) | 4,166,077 | Spanish-side articles extracted from a collection of Spanish-English parallel corpus consisting of biomedical scientific literature. The collection of parallel resources are aggregated from the MedlinePlus source. | | PubMed | 1,858,966 | Open-access articles from the PubMed repository crawled in 2017. | ## Evaluation and results The model has been evaluated on the Named Entity Recognition (NER) using the following datasets: - [PharmaCoNER](https://zenodo.org/record/4270158): is a track on chemical and drug mention recognition from Spanish medical texts (for more info see: https://temu.bsc.es/pharmaconer/). - [CANTEMIST](https://zenodo.org/record/3978041#.YTt5qH2xXbQ): is a shared task specifically focusing on named entity recognition of tumor morphology, in Spanish (for more info see: https://zenodo.org/record/3978041#.YTt5qH2xXbQ). - ICTUSnet: consists of 1,006 hospital discharge reports of patients admitted for stroke from 18 different Spanish hospitals. It contains more than 79,000 annotations for 51 different kinds of variables. The evaluation results are compared against the [mBERT](https://huggingface.co/bert-base-multilingual-cased) and [BETO](https://huggingface.co/dccuchile/bert-base-spanish-wwm-cased) models: | F1 - Precision - Recall | roberta-base-biomedical-es | mBERT | BETO | |---------------------------|----------------------------|-------------------------------|-------------------------| | PharmaCoNER | **89.48** - **87.85** - **91.18** | 87.46 - 86.50 - 88.46 | 88.18 - 87.12 - 89.28 | | CANTEMIST | **83.87** - **81.70** - **86.17** | 82.61 - 81.12 - 84.15 | 82.42 - 80.91 - 84.00 | | ICTUSnet | **88.12** - **85.56** - **90.83** | 86.75 - 83.53 - 90.23 | 85.95 - 83.10 - 89.02 | ## Intended uses & limitations The model is ready-to-use only for masked language modelling to perform the Fill Mask task (try the inference API or read the next section) However, the is intended to be fine-tuned on downstream tasks such as Named Entity Recognition or Text Classification. ## Cite If you use our models, please cite our latest preprint: ```bibtex @misc{carrino2021biomedical, title={Biomedical and Clinical Language Models for Spanish: On the Benefits of Domain-Specific Pretraining in a Mid-Resource Scenario}, author={Casimiro Pio Carrino and Jordi Armengol-Estapé and Asier Gutiérrez-Fandiño and Joan Llop-Palao and Marc Pàmies and Aitor Gonzalez-Agirre and Marta Villegas}, year={2021}, eprint={2109.03570}, archivePrefix={arXiv}, primaryClass={cs.CL} } ``` If you use our Medical Crawler corpus, please cite the preprint: ```bibtex @misc{carrino2021spanish, title={Spanish Biomedical Crawled Corpus: A Large, Diverse Dataset for Spanish Biomedical Language Models}, author={Casimiro Pio Carrino and Jordi Armengol-Estapé and Ona de Gibert Bonet and Asier Gutiérrez-Fandiño and Aitor Gonzalez-Agirre and Martin Krallinger and Marta Villegas}, year={2021}, eprint={2109.07765}, archivePrefix={arXiv}, primaryClass={cs.CL} } ``` --- ## How to use ```python from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("BSC-TeMU/roberta-base-biomedical-es") model = AutoModelForMaskedLM.from_pretrained("BSC-TeMU/roberta-base-biomedical-es") from transformers import pipeline unmasker = pipeline('fill-mask', model="BSC-TeMU/roberta-base-biomedical-es") unmasker("El único antecedente personal a reseñar era la <mask> arterial.") ``` ``` # Output [ { "sequence": " El único antecedente personal a reseñar era la hipertensión arterial.", "score": 0.9855039715766907, "token": 3529, "token_str": " hipertensión" }, { "sequence": " El único antecedente personal a reseñar era la diabetes arterial.", "score": 0.0039140828885138035, "token": 1945, "token_str": " diabetes" }, { "sequence": " El único antecedente personal a reseñar era la hipotensión arterial.", "score": 0.002484665485098958, "token": 11483, "token_str": " hipotensión" }, { "sequence": " El único antecedente personal a reseñar era la Hipertensión arterial.", "score": 0.0023484621196985245, "token": 12238, "token_str": " Hipertensión" }, { "sequence": " El único antecedente personal a reseñar era la presión arterial.", "score": 0.0008009297889657319, "token": 2267, "token_str": " presión" } ] ```
imxly/sentence_rtb3
ac6aefbe53994837a744006c493e9980874179c7
2021-05-19T20:21:34.000Z
[ "pytorch", "jax", "bert", "feature-extraction", "transformers" ]
feature-extraction
false
imxly
null
imxly/sentence_rtb3
923
null
transformers
1,821
Entry not found
UBC-NLP/AraT5-base
ed49be981b4df4040e83de16fd559e191b87429f
2022-05-26T18:25:19.000Z
[ "pytorch", "tf", "t5", "ar", "transformers", "Arabic T5", "MSA", "Twitter", "Arabic Dialect", "Arabic Machine Translation", "Arabic Text Summarization", "Arabic News Title and Question Generation", "Arabic Paraphrasing and Transliteration", "Arabic Code-Switched Translation" ]
null
false
UBC-NLP
null
UBC-NLP/AraT5-base
922
4
transformers
1,822
--- language: - ar tags: - Arabic T5 - MSA - Twitter - Arabic Dialect - Arabic Machine Translation - Arabic Text Summarization - Arabic News Title and Question Generation - Arabic Paraphrasing and Transliteration - Arabic Code-Switched Translation --- # AraT5-base # AraT5: Text-to-Text Transformers for Arabic Language Generation <img src="https://huggingface.co/UBC-NLP/AraT5-base/resolve/main/AraT5_CR_new.png" alt="AraT5" width="45%" height="35%" align="right"/> This is the repository accompanying our paper [AraT5: Text-to-Text Transformers for Arabic Language Understanding and Generation](https://aclanthology.org/2022.acl-long.47/). In this is the repository we Introduce **AraT5<sub>MSA</sub>**, **AraT5<sub>Tweet</sub>**, and **AraT5**: three powerful Arabic-specific text-to-text Transformer based models; --- # How to use AraT5 models Below is an example for fine-tuning **AraT5-base** for News Title Generation on the Aranews dataset ``` bash !python run_trainier_seq2seq_huggingface.py \ --learning_rate 5e-5 \ --max_target_length 128 --max_source_length 128 \ --per_device_train_batch_size 8 --per_device_eval_batch_size 8 \ --model_name_or_path "UBC-NLP/AraT5-base" \ --output_dir "/content/AraT5_FT_title_generation" --overwrite_output_dir \ --num_train_epochs 3 \ --train_file "/content/ARGEn_title_genration_sample_train.tsv" \ --validation_file "/content/ARGEn_title_genration_sample_valid.tsv" \ --task "title_generation" --text_column "document" --summary_column "title" \ --load_best_model_at_end --metric_for_best_model "eval_bleu" --greater_is_better True --evaluation_strategy epoch --logging_strategy epoch --predict_with_generate\ --do_train --do_eval ``` For more details about the fine-tuning example, please read this notebook [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://github.com/UBC-NLP/araT5/blob/main/examples/Fine_tuning_AraT5.ipynb) In addition, we release the fine-tuned checkpoint of the News Title Generation (NGT) which is described in the paper. The model available at Huggingface ([UBC-NLP/AraT5-base-title-generation](https://huggingface.co/UBC-NLP/AraT5-base-title-generation)). For more details, please visit our own [GitHub](https://github.com/UBC-NLP/araT5). # AraT5 Models Checkpoints AraT5 Pytorch and TensorFlow checkpoints are available on the Huggingface website for direct download and use ```exclusively for research```. ```For commercial use, please contact the authors via email @ (muhammad.mageed[at]ubc[dot]ca).``` | **Model** | **Link** | |---------|:------------------:| | **AraT5-base** | [https://huggingface.co/UBC-NLP/AraT5-base](https://huggingface.co/UBC-NLP/AraT5-base) | | **AraT5-msa-base** | [https://huggingface.co/UBC-NLP/AraT5-msa-base](https://huggingface.co/UBC-NLP/AraT5-msa-base) | | **AraT5-tweet-base** | [https://huggingface.co/UBC-NLP/AraT5-tweet-base](https://huggingface.co/UBC-NLP/AraT5-tweet-base) | | **AraT5-msa-small** | [https://huggingface.co/UBC-NLP/AraT5-msa-small](https://huggingface.co/UBC-NLP/AraT5-msa-small) | | **AraT5-tweet-small**| [https://huggingface.co/UBC-NLP/AraT5-tweet-small](https://huggingface.co/UBC-NLP/AraT5-tweet-small) | # BibTex If you use our models (Arat5-base, Arat5-msa-base, Arat5-tweet-base, Arat5-msa-small, or Arat5-tweet-small ) for your scientific publication, or if you find the resources in this repository useful, please cite our paper as follows (to be updated): ```bibtex @inproceedings{nagoudi2022_arat5, @inproceedings{nagoudi-etal-2022-arat5, title = "{A}ra{T}5: Text-to-Text Transformers for {A}rabic Language Generation", author = "Nagoudi, El Moatez Billah and Elmadany, AbdelRahim and Abdul-Mageed, Muhammad", booktitle = "Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)", month = may, year = "2022", address = "Dublin, Ireland", publisher = "Association for Computational Linguistics", url = "https://aclanthology.org/2022.acl-long.47", pages = "628--647", abstract = "Transfer learning with a unified Transformer framework (T5) that converts all language problems into a text-to-text format was recently proposed as a simple and effective transfer learning approach. Although a multilingual version of the T5 model (mT5) was also introduced, it is not clear how well it can fare on non-English tasks involving diverse data. To investigate this question, we apply mT5 on a language with a wide variety of dialects{--}Arabic. For evaluation, we introduce a novel benchmark for ARabic language GENeration (ARGEN), covering seven important tasks. For model comparison, we pre-train three powerful Arabic T5-style models and evaluate them on ARGEN. Although pre-trained with {\textasciitilde}49 less data, our new models perform significantly better than mT5 on all ARGEN tasks (in 52 out of 59 test sets) and set several new SOTAs. Our models also establish new SOTA on the recently-proposed, large Arabic language understanding evaluation benchmark ARLUE (Abdul-Mageed et al., 2021). Our new models are publicly available. We also link to ARGEN datasets through our repository: https://github.com/UBC-NLP/araT5.", } ## Acknowledgments We gratefully acknowledge support from the Natural Sciences and Engineering Research Council of Canada, the Social Sciences and Humanities Research Council of Canada, Canadian Foundation for Innovation, [ComputeCanada](www.computecanada.ca) and [UBC ARC-Sockeye](https://doi.org/10.14288/SOCKEYE). We also thank the [Google TensorFlow Research Cloud (TFRC)](https://www.tensorflow.org/tfrc) program for providing us with free TPU access.
jonatasgrosman/wav2vec2-large-xlsr-53-portuguese
6ec4ebf736ed4a6cb093a2b8665e16d55ba0fcc6
2022-07-27T23:38:25.000Z
[ "pytorch", "jax", "wav2vec2", "automatic-speech-recognition", "pt", "dataset:common_voice", "dataset:mozilla-foundation/common_voice_6_0", "transformers", "audio", "hf-asr-leaderboard", "mozilla-foundation/common_voice_6_0", "robust-speech-event", "speech", "xlsr-fine-tuning-week", "license:apache-2.0", "model-index" ]
automatic-speech-recognition
false
jonatasgrosman
null
jonatasgrosman/wav2vec2-large-xlsr-53-portuguese
922
7
transformers
1,823
--- language: pt license: apache-2.0 datasets: - common_voice - mozilla-foundation/common_voice_6_0 metrics: - wer - cer tags: - audio - automatic-speech-recognition - hf-asr-leaderboard - mozilla-foundation/common_voice_6_0 - pt - robust-speech-event - speech - xlsr-fine-tuning-week model-index: - name: XLSR Wav2Vec2 Portuguese by Jonatas Grosman results: - task: name: Automatic Speech Recognition type: automatic-speech-recognition dataset: name: Common Voice pt type: common_voice args: pt metrics: - name: Test WER type: wer value: 11.31 - name: Test CER type: cer value: 3.74 - name: Test WER (+LM) type: wer value: 9.01 - name: Test CER (+LM) type: cer value: 3.21 - task: name: Automatic Speech Recognition type: automatic-speech-recognition dataset: name: Robust Speech Event - Dev Data type: speech-recognition-community-v2/dev_data args: pt metrics: - name: Dev WER type: wer value: 42.1 - name: Dev CER type: cer value: 17.93 - name: Dev WER (+LM) type: wer value: 36.92 - name: Dev CER (+LM) type: cer value: 16.88 --- # Fine-tuned XLSR-53 large model for speech recognition in Portuguese Fine-tuned [facebook/wav2vec2-large-xlsr-53](https://huggingface.co/facebook/wav2vec2-large-xlsr-53) on Portuguese using the train and validation splits of [Common Voice 6.1](https://huggingface.co/datasets/common_voice). When using this model, make sure that your speech input is sampled at 16kHz. This model has been fine-tuned thanks to the GPU credits generously given by the [OVHcloud](https://www.ovhcloud.com/en/public-cloud/ai-training/) :) The script used for training can be found here: https://github.com/jonatasgrosman/wav2vec2-sprint ## Usage The model can be used directly (without a language model) as follows... Using the [HuggingSound](https://github.com/jonatasgrosman/huggingsound) library: ```python from huggingsound import SpeechRecognitionModel model = SpeechRecognitionModel("jonatasgrosman/wav2vec2-large-xlsr-53-portuguese") audio_paths = ["/path/to/file.mp3", "/path/to/another_file.wav"] transcriptions = model.transcribe(audio_paths) ``` Writing your own inference script: ```python import torch import librosa from datasets import load_dataset from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor LANG_ID = "pt" MODEL_ID = "jonatasgrosman/wav2vec2-large-xlsr-53-portuguese" SAMPLES = 10 test_dataset = load_dataset("common_voice", LANG_ID, split=f"test[:{SAMPLES}]") processor = Wav2Vec2Processor.from_pretrained(MODEL_ID) model = Wav2Vec2ForCTC.from_pretrained(MODEL_ID) # Preprocessing the datasets. # We need to read the audio files as arrays def speech_file_to_array_fn(batch): speech_array, sampling_rate = librosa.load(batch["path"], sr=16_000) batch["speech"] = speech_array batch["sentence"] = batch["sentence"].upper() return batch test_dataset = test_dataset.map(speech_file_to_array_fn) inputs = processor(test_dataset["speech"], sampling_rate=16_000, return_tensors="pt", padding=True) with torch.no_grad(): logits = model(inputs.input_values, attention_mask=inputs.attention_mask).logits predicted_ids = torch.argmax(logits, dim=-1) predicted_sentences = processor.batch_decode(predicted_ids) for i, predicted_sentence in enumerate(predicted_sentences): print("-" * 100) print("Reference:", test_dataset[i]["sentence"]) print("Prediction:", predicted_sentence) ``` | Reference | Prediction | | ------------- | ------------- | | NEM O RADAR NEM OS OUTROS INSTRUMENTOS DETECTARAM O BOMBARDEIRO STEALTH. | NEMHUM VADAN OS OLTWES INSTRUMENTOS DE TTÉÃN UM BOMBERDEIRO OSTER | | PEDIR DINHEIRO EMPRESTADO ÀS PESSOAS DA ALDEIA | E DIR ENGINHEIRO EMPRESTAR AS PESSOAS DA ALDEIA | | OITO | OITO | | TRANCÁ-LOS | TRANCAUVOS | | REALIZAR UMA INVESTIGAÇÃO PARA RESOLVER O PROBLEMA | REALIZAR UMA INVESTIGAÇÃO PARA RESOLVER O PROBLEMA | | O YOUTUBE AINDA É A MELHOR PLATAFORMA DE VÍDEOS. | YOUTUBE AINDA É A MELHOR PLATAFOMA DE VÍDEOS | | MENINA E MENINO BEIJANDO NAS SOMBRAS | MENINA E MENINO BEIJANDO NAS SOMBRAS | | EU SOU O SENHOR | EU SOU O SENHOR | | DUAS MULHERES QUE SENTAM-SE PARA BAIXO LENDO JORNAIS. | DUAS MIERES QUE SENTAM-SE PARA BAICLANE JODNÓI | | EU ORIGINALMENTE ESPERAVA | EU ORIGINALMENTE ESPERAVA | ## Evaluation 1. To evaluate on `mozilla-foundation/common_voice_6_0` with split `test` ```bash python eval.py --model_id jonatasgrosman/wav2vec2-large-xlsr-53-portuguese --dataset mozilla-foundation/common_voice_6_0 --config pt --split test ``` 2. To evaluate on `speech-recognition-community-v2/dev_data` ```bash python eval.py --model_id jonatasgrosman/wav2vec2-large-xlsr-53-portuguese --dataset speech-recognition-community-v2/dev_data --config pt --split validation --chunk_length_s 5.0 --stride_length_s 1.0 ``` ## Citation If you want to cite this model you can use this: ```bibtex @misc{grosman2021xlsr53-large-portuguese, title={Fine-tuned {XLSR}-53 large model for speech recognition in {P}ortuguese}, author={Grosman, Jonatas}, howpublished={\url{https://huggingface.co/jonatasgrosman/wav2vec2-large-xlsr-53-portuguese}}, year={2021} } ```
tscholak/3vnuv1vf
18d448ce4c0f85d8cf9c06ffae8e197d10515ec1
2022-01-10T21:49:25.000Z
[ "pytorch", "t5", "text2text-generation", "en", "dataset:spider", "arxiv:2109.05093", "transformers", "text2sql", "license:apache-2.0", "autotrain_compatible" ]
text2text-generation
false
tscholak
null
tscholak/3vnuv1vf
921
2
transformers
1,824
--- language: - en thumbnail: "https://repository-images.githubusercontent.com/401779782/c2f46be5-b74b-4620-ad64-57487be3b1ab" tags: - text2sql widget: - "How many singers do we have? | concert_singer | stadium : stadium_id, location, name, capacity, highest, lowest, average | singer : singer_id, name, country, song_name, song_release_year, age, is_male | concert : concert_id, concert_name, theme, stadium_id, year | singer_in_concert : concert_id, singer_id" license: "apache-2.0" datasets: - spider metrics: - spider --- ## tscholak/3vnuv1vf Fine-tuned weights for [PICARD - Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Models](https://arxiv.org/abs/2109.05093) based on [t5.1.1.lm100k.large](https://github.com/google-research/text-to-text-transfer-transformer/blob/main/released_checkpoints.md#lm-adapted-t511lm100k). ### Training Data The model has been fine-tuned on the 7000 training examples in the [Spider text-to-SQL dataset](https://yale-lily.github.io/spider). The model solves Spider's zero-shot text-to-SQL translation task, and that means that it can generalize to unseen SQL databases. ### Training Objective This model was initialized with [t5.1.1.lm100k.large](https://github.com/google-research/text-to-text-transfer-transformer/blob/main/released_checkpoints.md#lm-adapted-t511lm100k) and fine-tuned with the text-to-text generation objective. Questions are always grounded in a database schema, and the model is trained to predict the SQL query that would be used to answer the question. The input to the model is composed of the user's natural language question, the database identifier, and a list of tables and their columns: ``` [question] | [db_id] | [table] : [column] ( [content] , [content] ) , [column] ( ... ) , [...] | [table] : ... | ... ``` The model outputs the database identifier and the SQL query that will be executed on the database to answer the user's question: ``` [db_id] | [sql] ``` ### Performance Out of the box, this model achieves 71.2 % exact-set match accuracy and 74.4 % execution accuracy on the Spider development set. Using the PICARD constrained decoding method (see [the official PICARD implementation](https://github.com/ElementAI/picard)), the model's performance can be improved to **74.8 %** exact-set match accuracy and **79.2 %** execution accuracy on the Spider development set. ### Usage Please see [the official repository](https://github.com/ElementAI/picard) for scripts and docker images that support evaluation and serving of this model. ### References 1. [PICARD - Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Models](https://arxiv.org/abs/2109.05093) 2. [Official PICARD code](https://github.com/ElementAI/picard) ### Citation ```bibtex @inproceedings{Scholak2021:PICARD, author = {Torsten Scholak and Nathan Schucher and Dzmitry Bahdanau}, title = "{PICARD}: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Models", booktitle = "Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing", month = nov, year = "2021", publisher = "Association for Computational Linguistics", url = "https://aclanthology.org/2021.emnlp-main.779", pages = "9895--9901", } ```
StanfordAIMI/stanford-deidentifier-base
41f1cf1c95cb9c25643f625b5aeae663d7e07663
2022-07-18T03:38:21.000Z
[ "pytorch", "bert", "en", "dataset:radreports", "transformers", "token-classification", "sequence-tagger-model", "pubmedbert", "uncased", "radiology", "biomedical", "license:mit" ]
token-classification
false
StanfordAIMI
null
StanfordAIMI/stanford-deidentifier-base
921
1
transformers
1,825
--- widget: - text: "PROCEDURE: Chest xray. COMPARISON: last seen on 1/1/2020 and also record dated of March 1st, 2019. FINDINGS: patchy airspace opacities. IMPRESSION: The results of the chest xray of January 1 2020 are the most concerning ones. The patient was transmitted to another service of UH Medical Center under the responsability of Dr. Perez. We used the system MedClinical data transmitter and sent the data on 2/1/2020, under the ID 5874233. We received the confirmation of Dr Perez. He is reachable at 567-493-1234." - text: "Dr. Curt Langlotz chose to schedule a meeting on 06/23." tags: - token-classification - sequence-tagger-model - pytorch - transformers - pubmedbert - uncased - radiology - biomedical datasets: - radreports language: - en license: mit --- Stanford de-identifier was trained on a variety of radiology and biomedical documents with the goal of automatising the de-identification process while reaching satisfactory accuracy for use in production. Manuscript in-proceedings.
cross-encoder/stsb-TinyBERT-L-4
a0fde64e9dea230cae6957f45eaa3a4685620b01
2021-08-05T08:41:47.000Z
[ "pytorch", "jax", "bert", "text-classification", "transformers", "license:apache-2.0" ]
text-classification
false
cross-encoder
null
cross-encoder/stsb-TinyBERT-L-4
920
null
transformers
1,826
--- license: apache-2.0 --- # Cross-Encoder for Quora Duplicate Questions Detection This model was trained using [SentenceTransformers](https://sbert.net) [Cross-Encoder](https://www.sbert.net/examples/applications/cross-encoder/README.html) class. ## Training Data This model was trained on the [STS benchmark dataset](http://ixa2.si.ehu.eus/stswiki/index.php/STSbenchmark). The model will predict a score between 0 and 1 how for the semantic similarity of two sentences. ## Usage and Performance Pre-trained models can be used like this: ``` from sentence_transformers import CrossEncoder model = CrossEncoder('model_name') scores = model.predict([('Sentence 1', 'Sentence 2'), ('Sentence 3', 'Sentence 4')]) ``` The model will predict scores for the pairs `('Sentence 1', 'Sentence 2')` and `('Sentence 3', 'Sentence 4')`. You can use this model also without sentence_transformers and by just using Transformers ``AutoModel`` class
Helsinki-NLP/opus-mt-bn-en
1b349f7c24ee5f832ca19138d23cf78de5869e80
2021-01-18T07:51:55.000Z
[ "pytorch", "marian", "text2text-generation", "bn", "en", "transformers", "translation", "license:apache-2.0", "autotrain_compatible" ]
translation
false
Helsinki-NLP
null
Helsinki-NLP/opus-mt-bn-en
919
null
transformers
1,827
--- language: - bn - en tags: - translation license: apache-2.0 --- ### ben-eng * source group: Bengali * target group: English * OPUS readme: [ben-eng](https://github.com/Helsinki-NLP/Tatoeba-Challenge/tree/master/models/ben-eng/README.md) * model: transformer-align * source language(s): ben * target language(s): eng * model: transformer-align * pre-processing: normalization + SentencePiece (spm32k,spm32k) * download original weights: [opus-2020-06-17.zip](https://object.pouta.csc.fi/Tatoeba-MT-models/ben-eng/opus-2020-06-17.zip) * test set translations: [opus-2020-06-17.test.txt](https://object.pouta.csc.fi/Tatoeba-MT-models/ben-eng/opus-2020-06-17.test.txt) * test set scores: [opus-2020-06-17.eval.txt](https://object.pouta.csc.fi/Tatoeba-MT-models/ben-eng/opus-2020-06-17.eval.txt) ## Benchmarks | testset | BLEU | chr-F | |-----------------------|-------|-------| | Tatoeba-test.ben.eng | 49.7 | 0.641 | ### System Info: - hf_name: ben-eng - source_languages: ben - target_languages: eng - opus_readme_url: https://github.com/Helsinki-NLP/Tatoeba-Challenge/tree/master/models/ben-eng/README.md - original_repo: Tatoeba-Challenge - tags: ['translation'] - languages: ['bn', 'en'] - src_constituents: {'ben'} - tgt_constituents: {'eng'} - src_multilingual: False - tgt_multilingual: False - prepro: normalization + SentencePiece (spm32k,spm32k) - url_model: https://object.pouta.csc.fi/Tatoeba-MT-models/ben-eng/opus-2020-06-17.zip - url_test_set: https://object.pouta.csc.fi/Tatoeba-MT-models/ben-eng/opus-2020-06-17.test.txt - src_alpha3: ben - tgt_alpha3: eng - short_pair: bn-en - chrF2_score: 0.6409999999999999 - bleu: 49.7 - brevity_penalty: 0.976 - ref_len: 13978.0 - src_name: Bengali - tgt_name: English - train_date: 2020-06-17 - src_alpha2: bn - tgt_alpha2: en - prefer_old: False - long_pair: ben-eng - helsinki_git_sha: 480fcbe0ee1bf4774bcbe6226ad9f58e63f6c535 - transformers_git_sha: 2207e5d8cb224e954a7cba69fa4ac2309e9ff30b - port_machine: brutasse - port_time: 2020-08-21-14:41
google/t5-efficient-base
6b14ca76d201b73fe751ea16df730c5c999ef736
2022-02-15T10:49:53.000Z
[ "pytorch", "tf", "jax", "t5", "text2text-generation", "en", "dataset:c4", "arxiv:2109.10686", "transformers", "deep-narrow", "license:apache-2.0", "autotrain_compatible" ]
text2text-generation
false
google
null
google/t5-efficient-base
917
2
transformers
1,828
--- language: - en datasets: - c4 tags: - deep-narrow inference: false license: apache-2.0 --- # T5-Efficient-BASE (Deep-Narrow version) T5-Efficient-BASE is a variation of [Google's original T5](https://ai.googleblog.com/2020/02/exploring-transfer-learning-with-t5.html) following the [T5 model architecture](https://huggingface.co/docs/transformers/model_doc/t5). It is a *pretrained-only* checkpoint and was released with the paper **[Scale Efficiently: Insights from Pre-training and Fine-tuning Transformers](https://arxiv.org/abs/2109.10686)** by *Yi Tay, Mostafa Dehghani, Jinfeng Rao, William Fedus, Samira Abnar, Hyung Won Chung, Sharan Narang, Dani Yogatama, Ashish Vaswani, Donald Metzler*. In a nutshell, the paper indicates that a **Deep-Narrow** model architecture is favorable for **downstream** performance compared to other model architectures of similar parameter count. To quote the paper: > We generally recommend a DeepNarrow strategy where the model’s depth is preferentially increased > before considering any other forms of uniform scaling across other dimensions. This is largely due to > how much depth influences the Pareto-frontier as shown in earlier sections of the paper. Specifically, a > tall small (deep and narrow) model is generally more efficient compared to the base model. Likewise, > a tall base model might also generally more efficient compared to a large model. We generally find > that, regardless of size, even if absolute performance might increase as we continue to stack layers, > the relative gain of Pareto-efficiency diminishes as we increase the layers, converging at 32 to 36 > layers. Finally, we note that our notion of efficiency here relates to any one compute dimension, i.e., > params, FLOPs or throughput (speed). We report all three key efficiency metrics (number of params, > FLOPS and speed) and leave this decision to the practitioner to decide which compute dimension to > consider. To be more precise, *model depth* is defined as the number of transformer blocks that are stacked sequentially. A sequence of word embeddings is therefore processed sequentially by each transformer block. ## Details model architecture This model checkpoint - **t5-efficient-base** - is of model type **Base** with no variations. It has **222.93** million parameters and thus requires *ca.* **891.73 MB** of memory in full precision (*fp32*) or **445.86 MB** of memory in half precision (*fp16* or *bf16*). A summary of the *original* T5 model architectures can be seen here: | Model | nl (el/dl) | ff | dm | kv | nh | #Params| | ----| ---- | ---- | ---- | ---- | ---- | ----| | Tiny | 4/4 | 1024 | 256 | 32 | 4 | 16M| | Mini | 4/4 | 1536 | 384 | 32 | 8 | 31M| | Small | 6/6 | 2048 | 512 | 32 | 8 | 60M| | Base | 12/12 | 3072 | 768 | 64 | 12 | 220M| | Large | 24/24 | 4096 | 1024 | 64 | 16 | 738M| | Xl | 24/24 | 16384 | 1024 | 128 | 32 | 3B| | XXl | 24/24 | 65536 | 1024 | 128 | 128 | 11B| whereas the following abbreviations are used: | Abbreviation | Definition | | ----| ---- | | nl | Number of transformer blocks (depth) | | dm | Dimension of embedding vector (output vector of transformers block) | | kv | Dimension of key/value projection matrix | | nh | Number of attention heads | | ff | Dimension of intermediate vector within transformer block (size of feed-forward projection matrix) | | el | Number of transformer blocks in the encoder (encoder depth) | | dl | Number of transformer blocks in the decoder (decoder depth) | | sh | Signifies that attention heads are shared | | skv | Signifies that key-values projection matrices are tied | If a model checkpoint has no specific, *el* or *dl* than both the number of encoder- and decoder layers correspond to *nl*. ## Pre-Training The checkpoint was pretrained on the [Colossal, Cleaned version of Common Crawl (C4)](https://huggingface.co/datasets/c4) for 524288 steps using the span-based masked language modeling (MLM) objective. ## Fine-Tuning **Note**: This model is a **pretrained** checkpoint and has to be fine-tuned for practical usage. The checkpoint was pretrained in English and is therefore only useful for English NLP tasks. You can follow on of the following examples on how to fine-tune the model: *PyTorch*: - [Summarization](https://github.com/huggingface/transformers/tree/master/examples/pytorch/summarization) - [Question Answering](https://github.com/huggingface/transformers/blob/master/examples/pytorch/question-answering/run_seq2seq_qa.py) - [Text Classification](https://github.com/huggingface/transformers/tree/master/examples/pytorch/text-classification) - *Note*: You will have to slightly adapt the training example here to make it work with an encoder-decoder model. *Tensorflow*: - [Summarization](https://github.com/huggingface/transformers/tree/master/examples/tensorflow/summarization) - [Text Classification](https://github.com/huggingface/transformers/tree/master/examples/tensorflow/text-classification) - *Note*: You will have to slightly adapt the training example here to make it work with an encoder-decoder model. *JAX/Flax*: - [Summarization](https://github.com/huggingface/transformers/tree/master/examples/flax/summarization) - [Text Classification](https://github.com/huggingface/transformers/tree/master/examples/flax/text-classification) - *Note*: You will have to slightly adapt the training example here to make it work with an encoder-decoder model. ## Downstream Performance TODO: Add table if available ## Computational Complexity TODO: Add table if available ## More information We strongly recommend the reader to go carefully through the original paper **[Scale Efficiently: Insights from Pre-training and Fine-tuning Transformers](https://arxiv.org/abs/2109.10686)** to get a more nuanced understanding of this model checkpoint. As explained in the following [issue](https://github.com/google-research/google-research/issues/986#issuecomment-1035051145), checkpoints including the *sh* or *skv* model architecture variations have *not* been ported to Transformers as they are probably of limited practical usage and are lacking a more detailed description. Those checkpoints are kept [here](https://huggingface.co/NewT5SharedHeadsSharedKeyValues) as they might be ported potentially in the future.
M-CLIP/XLM-Roberta-Large-Vit-L-14
ad70f9333ca5fc97d85b1491b939cf721cd2bad8
2022-06-02T23:25:42.000Z
[ "pytorch", "tf", "multilingual" ]
null
false
M-CLIP
null
M-CLIP/XLM-Roberta-Large-Vit-L-14
917
null
null
1,829
--- language: multilingual --- ## Multilingual-clip: XLM-Roberta-Large-Vit-L-14 Multilingual-CLIP extends OpenAI's English text encoders to multiple other languages. This model *only* contains the multilingual text encoder. The corresponding image model `ViT-L-14` can be retrieved via instructions found on OpenAI's [CLIP repository on Github](https://github.com/openai/CLIP). We provide a usage example below. ## Requirements To use both the multilingual text encoder and corresponding image encoder, we need to install the packages [`multilingual-clip`](https://github.com/FreddeFrallan/Multilingual-CLIP) and [`clip`](https://github.com/openai/CLIP). ``` pip install multilingual-clip pip install git+https://github.com/openai/CLIP.git ``` ## Usage Extracting embeddings from the text encoder can be done in the following way: ```python from multilingual_clip import pt_multilingual_clip import transformers texts = [ 'Three blind horses listening to Mozart.', 'Älgen är skogens konung!', 'Wie leben Eisbären in der Antarktis?', 'Вы знали, что все белые медведи левши?' ] model_name = 'M-CLIP/XLM-Roberta-Large-Vit-L-14' # Load Model & Tokenizer model = pt_multilingual_clip.MultilingualCLIP.from_pretrained(model_name) tokenizer = transformers.AutoTokenizer.from_pretrained(model_name) embeddings = model.forward(texts, tokenizer) print("Text features shape:", embeddings.shape) ``` Extracting embeddings from the corresponding image encoder: ```python import torch import clip import requests from PIL import Image device = "cuda" if torch.cuda.is_available() else "cpu" model, preprocess = clip.load("ViT-L/14", device=device) url = "http://images.cocodataset.org/val2017/000000039769.jpg" image = Image.open(requests.get(url, stream=True).raw) image = preprocess(image).unsqueeze(0).to(device) with torch.no_grad(): image_features = model.encode_image(image) print("Image features shape:", image_features.shape) ``` ## Evaluation results None of the M-CLIP models have been extensivly evaluated, but testing them on Txt2Img retrieval on the humanly translated MS-COCO dataset, we see the following **R@10** results: | Name | En | De | Es | Fr | Zh | It | Pl | Ko | Ru | Tr | Jp | | ----------------------------------|:-----: |:-----: |:-----: |:-----: | :-----: |:-----: |:-----: |:-----: |:-----: |:-----: |:-----: | | [OpenAI CLIP Vit-B/32](https://github.com/openai/CLIP)| 90.3 | - | - | - | - | - | - | - | - | - | - | | [OpenAI CLIP Vit-L/14](https://github.com/openai/CLIP)| 91.8 | - | - | - | - | - | - | - | - | - | - | | [OpenCLIP ViT-B-16+-](https://github.com/openai/CLIP)| 94.3 | - | - | - | - | - | - | - | - | - | - | | [LABSE Vit-L/14](https://huggingface.co/M-CLIP/LABSE-Vit-L-14)| 91.6 | 89.6 | 89.5 | 89.9 | 88.9 | 90.1 | 89.8 | 80.8 | 85.5 | 89.8 | 73.9 | | [XLM-R Large Vit-B/32](https://huggingface.co/M-CLIP/XLM-Roberta-Large-Vit-B-32)| 91.8 | 88.7 | 89.1 | 89.4 | 89.3 | 89.8| 91.4 | 82.1 | 86.1 | 88.8 | 81.0 | | [XLM-R Vit-L/14](https://huggingface.co/M-CLIP/XLM-Roberta-Large-Vit-L-14)| 92.4 | 90.6 | 91.0 | 90.0 | 89.7 | 91.1 | 91.3 | 85.2 | 85.8 | 90.3 | 81.9 | | [XLM-R Large Vit-B/16+](https://huggingface.co/M-CLIP/XLM-Roberta-Large-Vit-B-16Plus)| **95.0** | **93.0** | **93.6** | **93.1** | **94.0** | **93.1** | **94.4** | **89.0** | **90.0** | **93.0** | **84.2** | ## Training/Model details Further details about the model training and data can be found in the [model card](https://github.com/FreddeFrallan/Multilingual-CLIP/blob/main/larger_mclip.md).
RuRI/Talkmodel01
bd6f30cb7839b3955919959f5d58ebca366563f8
2021-09-17T00:34:28.000Z
[ "pytorch", "gpt2", "text-generation", "transformers" ]
text-generation
false
RuRI
null
RuRI/Talkmodel01
911
null
transformers
1,830
Entry not found
mrm8488/mobilebert-finetuned-pos
54dad38c9125524220389490ce914b9c85d598da
2021-03-12T08:08:35.000Z
[ "pytorch", "rust", "mobilebert", "token-classification", "en", "transformers", "pos", "license:mit", "autotrain_compatible" ]
token-classification
false
mrm8488
null
mrm8488/mobilebert-finetuned-pos
911
4
transformers
1,831
--- language: en tags: - mobilebert - pos license: mit ---
pszemraj/led-large-book-summary
16ef34e1d8d5c43c1e5025463848f30531a12077
2022-07-21T09:03:04.000Z
[ "pytorch", "led", "text2text-generation", "en", "dataset:kmfoda/booksum", "arxiv:2105.08209", "transformers", "summarization", "summary", "longformer", "booksum", "long-document", "long-form", "license:apache-2.0", "model-index", "autotrain_compatible" ]
summarization
false
pszemraj
null
pszemraj/led-large-book-summary
911
3
transformers
1,832
--- language: - en tags: - summarization - led - summary - longformer - booksum - long-document - long-form license: apache-2.0 datasets: - kmfoda/booksum metrics: - rouge widget: - text: large earthquakes along a given fault segment do not occur at random intervals because it takes time to accumulate the strain energy for the rupture. The rates at which tectonic plates move and accumulate strain at their boundaries are approximately uniform. Therefore, in first approximation, one may expect that large ruptures of the same fault segment will occur at approximately constant time intervals. If subsequent main shocks have different amounts of slip across the fault, then the recurrence time may vary, and the basic idea of periodic mainshocks must be modified. For great plate boundary ruptures the length and slip often vary by a factor of 2. Along the southern segment of the San Andreas fault the recurrence interval is 145 years with variations of several decades. The smaller the standard deviation of the average recurrence interval, the more specific could be the long term prediction of a future mainshock. example_title: earthquakes - text: " A typical feed-forward neural field algorithm. Spatiotemporal coordinates\ \ are fed into a neural network that predicts values in the reconstructed domain.\ \ Then, this domain is mapped to the sensor domain where sensor measurements are\ \ available as supervision. Class and Section Problems Addressed Generalization\ \ (Section 2) Inverse problems, ill-posed problems, editability; symmetries. Hybrid\ \ Representations (Section 3) Computation & memory efficiency, representation\ \ capacity, editability: Forward Maps (Section 4) Inverse problems Network Architecture\ \ (Section 5) Spectral bias, integration & derivatives. Manipulating Neural Fields\ \ (Section 6) Edit ability, constraints, regularization. Table 2: The five classes\ \ of techniques in the neural field toolbox each addresses problems that arise\ \ in learning, inference, and control. (Section 3). We can supervise reconstruction\ \ via differentiable forward maps that transform Or project our domain (e.g, 3D\ \ reconstruction via 2D images; Section 4) With appropriate network architecture\ \ choices, we can overcome neural network spectral biases (blurriness) and efficiently\ \ compute derivatives and integrals (Section 5). Finally, we can manipulate neural\ \ fields to add constraints and regularizations, and to achieve editable representations\ \ (Section 6). Collectively, these classes constitute a 'toolbox' of techniques\ \ to help solve problems with neural fields There are three components in a conditional\ \ neural field: (1) An encoder or inference function \u20AC that outputs the conditioning\ \ latent variable 2 given an observation 0 E(0) =2. 2 is typically a low-dimensional\ \ vector, and is often referred to aS a latent code Or feature code_ (2) A mapping\ \ function 4 between Z and neural field parameters O: Y(z) = O; (3) The neural\ \ field itself $. The encoder \u20AC finds the most probable z given the observations\ \ O: argmaxz P(2/0). The decoder maximizes the inverse conditional probability\ \ to find the most probable 0 given Z: arg- max P(Olz). We discuss different encoding\ \ schemes with different optimality guarantees (Section 2.1.1), both global and\ \ local conditioning (Section 2.1.2), and different mapping functions Y (Section\ \ 2.1.3) 2. Generalization Suppose we wish to estimate a plausible 3D surface\ \ shape given a partial or noisy point cloud. We need a suitable prior over the\ \ sur- face in its reconstruction domain to generalize to the partial observations.\ \ A neural network expresses a prior via the function space of its architecture\ \ and parameters 0, and generalization is influenced by the inductive bias of\ \ this function space (Section 5)." example_title: scientific paper - text: ' the big variety of data coming from diverse sources is one of the key properties of the big data phenomenon. It is, therefore, beneficial to understand how data is generated in various environments and scenarios, before looking at what should be done with this data and how to design the best possible architecture to accomplish this The evolution of IT architectures, described in Chapter 2, means that the data is no longer processed by a few big monolith systems, but rather by a group of services In parallel to the processing layer, the underlying data storage has also changed and became more distributed This, in turn, required a significant paradigm shift as the traditional approach to transactions (ACID) could no longer be supported. On top of this, cloud computing is becoming a major approach with the benefits of reducing costs and providing on-demand scalability but at the same time introducing concerns about privacy, data ownership, etc In the meantime the Internet continues its exponential growth: Every day both structured and unstructured data is published and available for processing: To achieve competitive advantage companies have to relate their corporate resources to external services, e.g. financial markets, weather forecasts, social media, etc While several of the sites provide some sort of API to access the data in a more orderly fashion; countless sources require advanced web mining and Natural Language Processing (NLP) processing techniques: Advances in science push researchers to construct new instruments for observing the universe O conducting experiments to understand even better the laws of physics and other domains. Every year humans have at their disposal new telescopes, space probes, particle accelerators, etc These instruments generate huge streams of data, which need to be stored and analyzed. The constant drive for efficiency in the industry motivates the introduction of new automation techniques and process optimization: This could not be done without analyzing the precise data that describe these processes. As more and more human tasks are automated, machines provide rich data sets, which can be analyzed in real-time to drive efficiency to new levels. Finally, it is now evident that the growth of the Internet of Things is becoming a major source of data. More and more of the devices are equipped with significant computational power and can generate a continuous data stream from their sensors. In the subsequent sections of this chapter, we will look at the domains described above to see what they generate in terms of data sets. We will compare the volumes but will also look at what is characteristic and important from their respective points of view. 3.1 The Internet is undoubtedly the largest database ever created by humans. While several well described; cleaned, and structured data sets have been made available through this medium, most of the resources are of an ambiguous, unstructured, incomplete or even erroneous nature. Still, several examples in the areas such as opinion mining, social media analysis, e-governance, etc, clearly show the potential lying in these resources. Those who can successfully mine and interpret the Internet data can gain unique insight and competitive advantage in their business An important area of data analytics on the edge of corporate IT and the Internet is Web Analytics.' example_title: data science textbook - text: "Transformer-based models have shown to be very useful for many NLP tasks.\ \ However, a major limitation of transformers-based models is its O(n^2)O(n 2)\ \ time & memory complexity (where nn is sequence length). Hence, it's computationally\ \ very expensive to apply transformer-based models on long sequences n > 512n>512.\ \ Several recent papers, e.g. Longformer, Performer, Reformer, Clustered attention\ \ try to remedy this problem by approximating the full attention matrix. You can\ \ checkout \U0001F917's recent blog post in case you are unfamiliar with these\ \ models.\nBigBird (introduced in paper) is one of such recent models to address\ \ this issue. BigBird relies on block sparse attention instead of normal attention\ \ (i.e. BERT's attention) and can handle sequences up to a length of 4096 at a\ \ much lower computational cost compared to BERT. It has achieved SOTA on various\ \ tasks involving very long sequences such as long documents summarization, question-answering\ \ with long contexts.\nBigBird RoBERTa-like model is now available in \U0001F917\ Transformers. The goal of this post is to give the reader an in-depth understanding\ \ of big bird implementation & ease one's life in using BigBird with \U0001F917\ Transformers. But, before going into more depth, it is important to remember that\ \ the BigBird's attention is an approximation of BERT's full attention and therefore\ \ does not strive to be better than BERT's full attention, but rather to be more\ \ efficient. It simply allows to apply transformer-based models to much longer\ \ sequences since BERT's quadratic memory requirement quickly becomes unbearable.\ \ Simply put, if we would have \u221E compute & \u221E time, BERT's attention\ \ would be preferred over block sparse attention (which we are going to discuss\ \ in this post).\nIf you wonder why we need more compute when working with longer\ \ sequences, this blog post is just right for you!\nSome of the main questions\ \ one might have when working with standard BERT-like attention include:\nDo all\ \ tokens really have to attend to all other tokens? Why not compute attention\ \ only over important tokens? How to decide what tokens are important? How to\ \ attend to just a few tokens in a very efficient way? In this blog post, we will\ \ try to answer those questions.\nWhat tokens should be attended to? We will give\ \ a practical example of how attention works by considering the sentence 'BigBird\ \ is now available in HuggingFace for extractive question answering'. In BERT-like\ \ attention, every word would simply attend to all other tokens.\nLet's think\ \ about a sensible choice of key tokens that a queried token actually only should\ \ attend to by writing some pseudo-code. Will will assume that the token available\ \ is queried and build a sensible list of key tokens to attend to.\n>>> # let's\ \ consider following sentence as an example >>> example = ['BigBird', 'is', 'now',\ \ 'available', 'in', 'HuggingFace', 'for', 'extractive', 'question', 'answering']\n\ >>> # further let's assume, we're trying to understand the representation of 'available'\ \ i.e. >>> query_token = 'available' >>> # We will initialize an empty `set` and\ \ fill up the tokens of our interest as we proceed in this section. >>> key_tokens\ \ = [] # => currently 'available' token doesn't have anything to attend Nearby\ \ tokens should be important because, in a sentence (sequence of words), the current\ \ word is highly dependent on neighboring past & future tokens. This intuition\ \ is the idea behind the concept of sliding attention." example_title: bigbird blog intro - text: 'The majority of available text summarization datasets include short-form source documents that lack long-range causal and temporal dependencies, and often contain strong layout and stylistic biases. While relevant, such datasets will offer limited challenges for future generations of text summarization systems. We address these issues by introducing BookSum, a collection of datasets for long-form narrative summarization. Our dataset covers source documents from the literature domain, such as novels, plays and stories, and includes highly abstractive, human written summaries on three levels of granularity of increasing difficulty: paragraph-, chapter-, and book-level. The domain and structure of our dataset poses a unique set of challenges for summarization systems, which include: processing very long documents, non-trivial causal and temporal dependencies, and rich discourse structures. To facilitate future work, we trained and evaluated multiple extractive and abstractive summarization models as baselines for our dataset.' example_title: BookSum Abstract inference: parameters: max_length: 64 min_length: 8 no_repeat_ngram_size: 3 early_stopping: true repetition_penalty: 3.5 length_penalty: 0.3 encoder_no_repeat_ngram_size: 3 num_beams: 4 model-index: - name: pszemraj/led-large-book-summary results: - task: type: summarization name: Summarization dataset: name: kmfoda/booksum type: kmfoda/booksum config: kmfoda--booksum split: test metrics: - name: ROUGE-1 type: rouge value: 31.7308 verified: true - name: ROUGE-2 type: rouge value: 5.3311 verified: true - name: ROUGE-L type: rouge value: 16.1465 verified: true - name: ROUGE-LSUM type: rouge value: 29.0883 verified: true - name: loss type: loss value: 4.815707206726074 verified: true - name: gen_len type: gen_len value: 154.9036 verified: true - task: type: summarization name: Summarization dataset: name: samsum type: samsum config: samsum split: test metrics: - name: ROUGE-1 type: rouge value: 33.4484 verified: true - name: ROUGE-2 type: rouge value: 10.4249 verified: true - name: ROUGE-L type: rouge value: 24.5802 verified: true - name: ROUGE-LSUM type: rouge value: 29.8226 verified: true - name: loss type: loss value: 4.176078796386719 verified: true - name: gen_len type: gen_len value: 65.4005 verified: true --- # Longformer Encoder-Decoder (LED) fine-tuned on Booksum - This model is a fine-tuned version of [allenai/led-large-16384](https://huggingface.co/allenai/led-large-16384) on the booksum dataset. - the goal was to create a model that can generalize well and is useful in summarizing lots of text in academic and daily usage. - [I don't want to read anymore give me a notebook implementation](https://colab.research.google.com/gist/pszemraj/3eba944ddc9fc9a4a1bfb21e83b57620/summarization-token-batching.ipynb) - all the parameters for generation on the API are the same as [the base model](https://huggingface.co/pszemraj/led-base-book-summary) for easy comparison between versions. - works well on lots of text, can hand 16384 tokens/batch. > Note: the API is set to generate a max of 64 tokens for runtime reasons, so the summaries may be truncated (depending on length of input text). For best results use python as below. --- # Usage - Basics - it is recommended to use `encoder_no_repeat_ngram_size=3` when calling the pipeline object to improve summary quality. - this param forces the model to use new vocabulary and create an abstractive summary, otherwise it may compile the best _extractive_ summary from the input provided. - create the pipeline object: ``` from transformers import AutoModelForSeq2SeqLM, AutoTokenizer from transformers import pipeline hf_name = 'pszemraj/led-large-book-summary' _model = AutoModelForSeq2SeqLM.from_pretrained( hf_name, low_cpu_mem_usage=True, ) _tokenizer = AutoTokenizer.from_pretrained( hf_name ) summarizer = pipeline( "summarization", model=_model, tokenizer=_tokenizer ) ``` - put words into the pipeline object: ``` wall_of_text = "your words here" result = summarizer( wall_of_text, min_length=16, max_length=256, no_repeat_ngram_size=3, encoder_no_repeat_ngram_size =3, clean_up_tokenization_spaces=True, repetition_penalty=3.7, num_beams=4, early_stopping=True, ) ``` - **Important:** To generate the best quality summaries, you should use the global attention mask when decoding, as demonstrated in [this community notebook here](https://colab.research.google.com/drive/12INTTR6n64TzS4RrXZxMSXfrOd9Xzamo?usp=sharing), see the definition of `generate_answer(batch)`. - If you run into compute constraints, try the base version [`pszemraj/led-base-book-summary`](https://huggingface.co/pszemraj/led-base-book-summary) ## Training and evaluation data - the [booksum](https://arxiv.org/abs/2105.08209) dataset - During training, the input text was the text of the `chapter`, and the output was `summary_text` - Eval results can be found [here](https://huggingface.co/datasets/autoevaluate/autoeval-staging-eval-project-kmfoda__booksum-79c1c0d8-10905463) with metrics on the sidebar. ## Training procedure - Training completed on the BookSum dataset for 13 total epochs - **The final four epochs combined the training and validation sets as 'train' in an effort to increase generalization.** ### Training hyperparameters #### Initial Three Epochs The following hyperparameters were used during training: - learning_rate: 5e-05 - train_batch_size: 1 - eval_batch_size: 1 - seed: 42 - distributed_type: multi-GPU - gradient_accumulation_steps: 4 - total_train_batch_size: 4 - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 - lr_scheduler_type: linear - num_epochs: 3 #### In-between Epochs Unfortunately, don't have all records on-hand for middle epochs, the following should be representative: - learning_rate: 4e-05 - train_batch_size: 2 - eval_batch_size: 2 - seed: 42 - distributed_type: multi-GPU - gradient_accumulation_steps: 16 - total_train_batch_size: 32 - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 - lr_scheduler_type: cosine - lr_scheduler_warmup_ratio: 0.05 - num_epochs: 6 (in addition to prior model) #### Final Two Epochs The following hyperparameters were used during training: - learning_rate: 2e-05 - train_batch_size: 1 - eval_batch_size: 1 - seed: 42 - distributed_type: multi-GPU - gradient_accumulation_steps: 16 - total_train_batch_size: 16 - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 - lr_scheduler_type: cosine - lr_scheduler_warmup_ratio: 0.03 - num_epochs: 2 (in addition to prior model) ### Framework versions - Transformers 4.19.2 - Pytorch 1.11.0+cu113 - Datasets 2.2.2 - Tokenizers 0.12.1
EleutherAI/enformer-official-rough
affe5713ae9017460706a44108289b13c5fee16c
2022-06-12T20:46:42.000Z
[ "pytorch", "enformer", "transformers", "license:cc-by-4.0" ]
null
false
EleutherAI
null
EleutherAI/enformer-official-rough
910
4
transformers
1,833
--- license: cc-by-4.0 inference: false --- # Enformer Enformer model. It was introduced in the paper [Effective gene expression prediction from sequence by integrating long-range interactions.](https://www.nature.com/articles/s41592-021-01252-x) by Avsec et al. and first released in [this repository](https://github.com/deepmind/deepmind-research/tree/master/enformer). This repo contains the official weights released by Deepmind, ported over to Pytorch. ## Model description Enformer is a neural network architecture based on the Transformer that led to greatly increased accuracy in predicting gene expression from DNA sequence. We refer to the [paper](https://www.nature.com/articles/s41592-021-01252-x) published in Nature for details. ### How to use Refer to the README of [enformer-pytorch](https://github.com/lucidrains/enformer-pytorch) regarding usage. ### Citation info ``` Avsec, Ž., Agarwal, V., Visentin, D. et al. Effective gene expression prediction from sequence by integrating long-range interactions. Nat Methods 18, 1196–1203 (2021). https://doi.org/10.1038/s41592-021-01252-x ```
microsoft/DialogRPT-human-vs-machine
735475522c2e95409e38a6f7ce714ca72a6bb219
2021-05-23T09:16:47.000Z
[ "pytorch", "gpt2", "text-classification", "arxiv:2009.06978", "transformers" ]
text-classification
false
microsoft
null
microsoft/DialogRPT-human-vs-machine
908
null
transformers
1,834
# Demo Please try this [➤➤➤ Colab Notebook Demo (click me!)](https://colab.research.google.com/drive/1cAtfkbhqsRsT59y3imjR1APw3MHDMkuV?usp=sharing) | Context | Response | `human_vs_machine` score | | :------ | :------- | :------------: | | I love NLP! | I'm not sure if it's a good idea. | 0.000 | | I love NLP! | Me too! | 0.605 | The `human_vs_machine` score predicts how likely the response is from a human rather than a machine. # DialogRPT-human-vs-machine ### Dialog Ranking Pretrained Transformers > How likely a dialog response is upvoted 👍 and/or gets replied 💬? This is what [**DialogRPT**](https://github.com/golsun/DialogRPT) is learned to predict. It is a set of dialog response ranking models proposed by [Microsoft Research NLP Group](https://www.microsoft.com/en-us/research/group/natural-language-processing/) trained on 100 + millions of human feedback data. It can be used to improve existing dialog generation model (e.g., [DialoGPT](https://huggingface.co/microsoft/DialoGPT-medium)) by re-ranking the generated response candidates. Quick Links: * [EMNLP'20 Paper](https://arxiv.org/abs/2009.06978/) * [Dataset, training, and evaluation](https://github.com/golsun/DialogRPT) * [Colab Notebook Demo](https://colab.research.google.com/drive/1cAtfkbhqsRsT59y3imjR1APw3MHDMkuV?usp=sharing) We considered the following tasks and provided corresponding pretrained models. |Task | Description | Pretrained model | | :------------- | :----------- | :-----------: | | **Human feedback** | **given a context and its two human responses, predict...**| | `updown` | ... which gets more upvotes? | [model card](https://huggingface.co/microsoft/DialogRPT-updown) | | `width`| ... which gets more direct replies? | [model card](https://huggingface.co/microsoft/DialogRPT-width) | | `depth`| ... which gets longer follow-up thread? | [model card](https://huggingface.co/microsoft/DialogRPT-depth) | | **Human-like** (human vs fake) | **given a context and one human response, distinguish it with...** | | `human_vs_rand`| ... a random human response | [model card](https://huggingface.co/microsoft/DialogRPT-human-vs-rand) | | `human_vs_machine`| ... a machine generated response | this model | ### Contact: Please create an issue on [our repo](https://github.com/golsun/DialogRPT) ### Citation: ``` @inproceedings{gao2020dialogrpt, title={Dialogue Response RankingTraining with Large-Scale Human Feedback Data}, author={Xiang Gao and Yizhe Zhang and Michel Galley and Chris Brockett and Bill Dolan}, year={2020}, booktitle={EMNLP} } ```
facebook/levit-128S
dd3c14ead498eab264fe0ed2053dc30940393467
2022-06-01T13:20:18.000Z
[ "pytorch", "levit", "image-classification", "dataset:imagenet-1k", "arxiv:2104.01136", "transformers", "vision", "license:apache-2.0" ]
image-classification
false
facebook
null
facebook/levit-128S
906
1
transformers
1,835
--- license: apache-2.0 tags: - vision - image-classification datasets: - imagenet-1k widget: - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/tiger.jpg example_title: Tiger - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/teapot.jpg example_title: Teapot - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/palace.jpg example_title: Palace --- # LeViT LeViT-128S model pre-trained on ImageNet-1k at resolution 224x224. It was introduced in the paper [LeViT: a Vision Transformer in ConvNet's Clothing for Faster Inference ](https://arxiv.org/abs/2104.01136) by Graham et al. and first released in [this repository](https://github.com/facebookresearch/LeViT). Disclaimer: The team releasing LeViT did not write a model card for this model so this model card has been written by the Hugging Face team. ## Usage Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes: ```python from transformers import LevitFeatureExtractor, LevitForImageClassificationWithTeacher from PIL import Image import requests url = 'http://images.cocodataset.org/val2017/000000039769.jpg' image = Image.open(requests.get(url, stream=True).raw) feature_extractor = LevitFeatureExtractor.from_pretrained('facebook/levit-128S') model = LevitForImageClassificationWithTeacher.from_pretrained('facebook/levit-128S') inputs = feature_extractor(images=image, return_tensors="pt") outputs = model(**inputs) logits = outputs.logits # model predicts one of the 1000 ImageNet classes predicted_class_idx = logits.argmax(-1).item() print("Predicted class:", model.config.id2label[predicted_class_idx]) ```
PlanTL-GOB-ES/bsc-bio-es
623c437d1f056466142fd2e73b4e905dc2ef07ff
2022-04-11T11:02:40.000Z
[ "pytorch", "roberta", "fill-mask", "es", "transformers", "biomedical", "clinical", "spanish", "license:apache-2.0", "autotrain_compatible" ]
fill-mask
false
PlanTL-GOB-ES
null
PlanTL-GOB-ES/bsc-bio-es
905
null
transformers
1,836
--- language: - es tags: - biomedical - clinical - spanish license: apache-2.0 metrics: - ppl widget: - text: "El único antecedente personal a reseñar era la <mask> arterial." - text: "Las radiologías óseas de cuerpo entero no detectan alteraciones <mask>, ni alteraciones vertebrales." - text: "En el <mask> toraco-abdómino-pélvico no se encontraron hallazgos patológicos de interés." --- # Biomedical language model for Spanish Biomedical pretrained language model for Spanish. For more details about the corpus, the pretraining and the evaluation, check the official [repository](https://github.com/PlanTL-GOB-ES/lm-biomedical-clinical-es). ## Tokenization and model pretraining This model is a [RoBERTa-based](https://github.com/pytorch/fairseq/tree/master/examples/roberta) model trained on a **biomedical** corpus in Spanish collected from several sources (see next section). The training corpus has been tokenized using a byte version of [Byte-Pair Encoding (BPE)](https://github.com/openai/gpt-2) used in the original [RoBERTA](https://github.com/pytorch/fairseq/tree/master/examples/roberta) model with a vocabulary size of 52,000 tokens. The pretraining consists of a masked language model training at the subword level following the approach employed for the RoBERTa base model with the same hyperparameters as in the original work. The training lasted a total of 48 hours with 16 NVIDIA V100 GPUs of 16GB DDRAM, using Adam optimizer with a peak learning rate of 0.0005 and an effective batch size of 2,048 sentences. ## Training corpora and preprocessing The training corpus is composed of several biomedical corpora in Spanish, collected from publicly available corpora and crawlers. To obtain a high-quality training corpus, a cleaning pipeline with the following operations has been applied: - data parsing in different formats - sentence splitting - language detection - filtering of ill-formed sentences - deduplication of repetitive contents - keep the original document boundaries Finally, the corpora are concatenated and further global deduplication among the corpora has been applied. The result is a medium-size biomedical corpus for Spanish composed of about 963M tokens. The table below shows some basic statistics of the individual cleaned corpora: | Name | No. tokens | Description | |-----------------------------------------------------------------------------------------|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Medical crawler](https://zenodo.org/record/4561970) | 903,558,136 | Crawler of more than 3,000 URLs belonging to Spanish biomedical and health domains. | | Clinical cases misc. | 102,855,267 | A miscellany of medical content, essentially clinical cases. Note that a clinical case report is a scientific publication where medical practitioners share patient cases and it is different from a clinical note or document. | | [Scielo](https://zenodo.org/record/2541681#.YlP1DshBwio) | 60,007,289 | Publications written in Spanish crawled from the Spanish SciELO server in 2017. | | [BARR2_background](https://temu.bsc.es/BARR2/downloads/background_set.raw_text.tar.bz2) | 24,516,442 | Biomedical Abbreviation Recognition and Resolution (BARR2) containing Spanish clinical case study sections from a variety of clinical disciplines. | | Wikipedia_life_sciences | 13,890,501 | Wikipedia articles crawled 04/01/2021 with the [Wikipedia API python library](https://pypi.org/project/Wikipedia-API/) starting from the "Ciencias\_de\_la\_vida" category up to a maximum of 5 subcategories. Multiple links to the same articles are then discarded to avoid repeating content. | | Patents | 13,463,387 | Google Patent in Medical Domain for Spain (Spanish). The accepted codes (Medical Domain) for Json files of patents are: "A61B", "A61C","A61F", "A61H", "A61K", "A61L","A61M", "A61B", "A61P". | | [EMEA](http://opus.nlpl.eu/download.php?f=EMEA/v3/moses/en-es.txt.zip) | 5,377,448 | Spanish-side documents extracted from parallel corpora made out of PDF documents from the European Medicines Agency. | | [mespen_Medline](https://zenodo.org/record/3562536#.YTt1fH2xXbR) | 4,166,077 | Spanish-side articles extracted from a collection of Spanish-English parallel corpus consisting of biomedical scientific literature. The collection of parallel resources is aggregated from the MedlinePlus source. | | PubMed | 1,858,966 | Open-access articles from the PubMed repository crawled in 2017. | ## Evaluation and results The model has been fine-tuned on three Named Entity Recognition (NER) tasks using three clinical NER datasets: - [PharmaCoNER](https://zenodo.org/record/4270158): is a track on chemical and drug mention recognition from Spanish medical texts (for more info see: https://temu.bsc.es/pharmaconer/). - [CANTEMIST](https://zenodo.org/record/3978041#.YTt5qH2xXbQ): is a shared task specifically focusing on named entity recognition of tumour morphology, in Spanish (for more info see: https://zenodo.org/record/3978041#.YTt5qH2xXbQ). - ICTUSnet: consists of 1,006 hospital discharge reports of patients admitted for stroke from 18 different Spanish hospitals. It contains more than 79,000 annotations for 51 different kinds of variables. We addressed the NER task as a token classification problem using a standard linear layer along with the BIO tagging schema. We compared our models with the general-domain Spanish [roberta-base-bne](https://huggingface.co/PlanTL-GOB-ES/roberta-base-bne), the general-domain multilingual model that supports Spanish [mBERT](https://huggingface.co/bert-base-multilingual-cased), the domain-specific English model [BioBERT](https://huggingface.co/dmis-lab/biobert-base-cased-v1.2), and three domain-specific models based on continual pre-training, [mBERT-Galén](https://ieeexplore.ieee.org/document/9430499), [XLM-R-Galén](https://ieeexplore.ieee.org/document/9430499) and [BETO-Galén](https://ieeexplore.ieee.org/document/9430499). The table below shows the F1 scores obtained: | Tasks/Models | bsc-bio-es | XLM-R-Galén | BETO-Galén | mBERT-Galén | mBERT | BioBERT | roberta-base-bne | |--------------|----------------|--------------------|--------------|--------------|--------------|--------------|------------------| | PharmaCoNER | **0.8907** | 0.8754 | 0.8537 | 0.8594 | 0.8671 | 0.8545 | 0.8474 | | CANTEMIST | **0.8220** | 0.8078 | 0.8153 | 0.8168 | 0.8116 | 0.8070 | 0.7875 | | ICTUSnet | **0.8727** | 0.8716 | 0.8498 | 0.8509 | 0.8631 | 0.8521 | 0.8677 | The fine-tuning scripts can be found in the official GitHub [repository](https://github.com/PlanTL-GOB-ES/lm-biomedical-clinical-es). ## Intended uses & limitations The model is ready-to-use only for masked language modelling to perform the Fill Mask task (try the inference API or read the next section) However, the is intended to be fine-tuned on downstream tasks such as Named Entity Recognition or Text Classification. ## Cite To be announced soon. --- ## Funding This work was funded by the Spanish State Secretariat for Digitalization and Artificial Intelligence (SEDIA) within the framework of the Plan-TL. ## Disclaimer The models published in this repository are intended for a generalist purpose and are available to third parties. These models may have bias and/or any other undesirable distortions. When third parties, deploy or provide systems and/or services to other parties using any of these models (or using systems based on these models) or become users of the models, they should note that it is their responsibility to mitigate the risks arising from their use and, in any event, to comply with applicable regulations, including regulations regarding the use of artificial intelligence. In no event shall the owner of the models (SEDIA – State Secretariat for digitalization and artificial intelligence) nor the creator (BSC – Barcelona Supercomputing Center) be liable for any results arising from the use made by third parties of these models.
benjamin/gerpt2
76b77997c1a715c3cf61a8d086fb75baa3816ded
2022-05-11T09:17:11.000Z
[ "pytorch", "tf", "jax", "gpt2", "text-generation", "de", "transformers", "license:mit" ]
text-generation
false
benjamin
null
benjamin/gerpt2
904
2
transformers
1,837
--- language: de widget: - text: "In einer schockierenden Entdeckung fanden Wissenschaftler eine Herde Einhörner, die in einem abgelegenen, zuvor unerforschten Tal in den Anden lebten." license: mit --- # GerPT2 German large and small versions of GPT2: - https://huggingface.co/benjamin/gerpt2 - https://huggingface.co/benjamin/gerpt2-large See the [GPT2 model card](https://huggingface.co/gpt2) for considerations on limitations and bias. See the [GPT2 documentation](https://huggingface.co/transformers/model_doc/gpt2.html) for details on GPT2. ## Comparison to [dbmdz/german-gpt2](https://huggingface.co/dbmdz/german-gpt2) I evaluated both GerPT2-large and the other German GPT2, [dbmdz/german-gpt2](https://huggingface.co/dbmdz/german-gpt2) on the [CC-100](http://data.statmt.org/cc-100/) dataset and on the German Wikipedia: | | CC-100 (PPL) | Wikipedia (PPL) | |-------------------|--------------|-----------------| | dbmdz/german-gpt2 | 49.47 | 62.92 | | GerPT2 | 24.78 | 35.33 | | GerPT2-large | __16.08__ | __23.26__ | | | | | See the script `evaluate.py` in the [GerPT2 Github repository](https://github.com/bminixhofer/gerpt2) for the code. ## Usage ```python from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline tokenizer = AutoTokenizer.from_pretrained("benjamin/gerpt2-large") model = AutoModelForCausalLM.from_pretrained("benjamin/gerpt2-large") prompt = "<your prompt>" pipe = pipeline("text-generation", model=model, tokenizer=tokenizer) print(pipe(prompt)[0]["generated_text"]) ``` Also, two tricks might improve the generated text: ```python output = model.generate( # during training an EOS token was used to mark the beginning of each text # so it can help to insert it at the start torch.tensor( [tokenizer.eos_token_id] + tokenizer.encode(prompt) ).unsqueeze(0), do_sample=True, # try setting bad_words_ids=[[0]] to disallow generating an EOS token, without this the model is # prone to ending generation early because a significant number of texts from the training corpus # is quite short bad_words_ids=[[0]], max_length=max_length, )[0] print(tokenizer.decode(output)) ``` ## Training details GerPT2-large is trained on the entire German data from the [CC-100 Corpus](http://data.statmt.org/cc-100/) and weights were initialized from the [English GPT2 model](https://huggingface.co/gpt2-large). GerPT2-large was trained with: - a batch size of 256 - using OneCycle learning rate with a maximum of 5e-3 - with AdamW with a weight decay of 0.01 - for 2 epochs Training took roughly 12 days on 8 TPUv3 cores. To train GerPT2-large, follow these steps. Scripts are located in the [Github repository](https://github.com/bminixhofer/gerpt2): 0. Download and unzip training data from http://data.statmt.org/cc-100/. 1. Train a tokenizer using `prepare/train_tokenizer.py`. As training data for the tokenizer I used a random subset of 5% of the CC-100 data. 2. (optionally) generate a German input embedding matrix with `prepare/generate_aligned_wte.py`. This uses a neat trick to semantically map tokens from the English tokenizer to tokens from the German tokenizer using aligned word embeddings. E. g.: ``` ĠMinde -> Ġleast Ġjed -> Ġwhatsoever flughafen -> Air vermittlung -> employment teilung -> ignment ĠInterpretation -> Ġinterpretation Ġimport -> Ġimported hansa -> irl genehmigungen -> exempt ĠAuflist -> Ġlists Ġverschwunden -> Ġdisappeared ĠFlyers -> ĠFlyers Kanal -> Channel Ġlehr -> Ġteachers Ġnahelie -> Ġconvenient gener -> Generally mitarbeiter -> staff ``` This helps a lot on a trial run I did, although I wasn't able to do a full comparison due to budget and time constraints. To use this WTE matrix it can be passed via the `wte_path` to the training script. Credit to [this blogpost](https://medium.com/@pierre_guillou/faster-than-training-from-scratch-fine-tuning-the-english-gpt-2-in-any-language-with-hugging-f2ec05c98787) for the idea of initializing GPT2 from English weights. 3. Tokenize the corpus using `prepare/tokenize_text.py`. This generates files for train and validation tokens in JSON Lines format. 4. Run the training script `train.py`! `run.sh` shows how this was executed for the full run with config `configs/tpu_large.json`. ## License GerPT2 is licensed under the MIT License. ## Citing Please cite GerPT2 as follows: ``` @misc{Minixhofer_GerPT2_German_large_2020, author = {Minixhofer, Benjamin}, doi = {10.5281/zenodo.5509984}, month = {12}, title = {{GerPT2: German large and small versions of GPT2}}, url = {https://github.com/bminixhofer/gerpt2}, year = {2020} } ``` ## Acknowledgements Thanks to [Hugging Face](https://huggingface.co) for awesome tools and infrastructure. Huge thanks to [Artus Krohn-Grimberghe](https://twitter.com/artuskg) at [LYTiQ](https://www.lytiq.de/) for making this possible by sponsoring the resources used for training.
JorisCos/ConvTasNet_Libri2Mix_sepnoisy_16k
98b76c842d1fae9868f74b331b298a92eee3c12e
2021-09-23T15:48:58.000Z
[ "pytorch", "dataset:Libri2Mix", "dataset:sep_noisy", "asteroid", "audio", "ConvTasNet", "audio-to-audio", "license:cc-by-sa-4.0" ]
audio-to-audio
false
JorisCos
null
JorisCos/ConvTasNet_Libri2Mix_sepnoisy_16k
903
null
asteroid
1,838
--- tags: - asteroid - audio - ConvTasNet - audio-to-audio datasets: - Libri2Mix - sep_noisy license: cc-by-sa-4.0 --- ## Asteroid model `JorisCos/ConvTasNet_Libri2Mix_sepnoisy_16k` Description: This model was trained by Joris Cosentino using the librimix recipe in [Asteroid](https://github.com/asteroid-team/asteroid). It was trained on the `sep_noisy` task of the Libri2Mix dataset. Training config: ```yml data: n_src: 2 sample_rate: 16000 segment: 3 task: sep_noisy train_dir: data/wav16k/min/train-360 valid_dir: data/wav16k/min/dev filterbank: kernel_size: 32 n_filters: 512 stride: 16 masknet: bn_chan: 128 hid_chan: 512 mask_act: relu n_blocks: 8 n_repeats: 3 n_src: 2 skip_chan: 128 optim: lr: 0.001 optimizer: adam weight_decay: 0.0 training: batch_size: 6 early_stop: true epochs: 200 half_lr: true num_workers: 4 ``` Results: On Libri2Mix min test set : ```yml si_sdr: 10.617130949793383 si_sdr_imp: 12.551811412989263 sdr: 11.231867464482065 sdr_imp: 13.059765009747343 sir: 24.461138352988346 sir_imp: 24.371856452307703 sar: 11.5649982725426 sar_imp: 4.662525705768228 stoi: 0.8701085138712695 stoi_imp: 0.2245418019822898 ``` License notice: This work "ConvTasNet_Libri2Mix_sepnoisy_16k" is a derivative of [LibriSpeech ASR corpus](http://www.openslr.org/12) by Vassil Panayotov, used under[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/); of The WSJ0 Hipster Ambient Mixtures dataset by [Whisper.ai](http://wham.whisper.ai/), used under [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/) (Research only). "ConvTasNet_Libri2Mix_sepnoisy_16k" is licensed under [Attribution-ShareAlike 3.0 Unported](https://creativecommons.org/licenses/by-sa/3.0/) by Joris Cosentino
facebook/dino-vitb8
745a5a92b1e313ab3c2e95a558df5566b5b8e253
2021-08-25T17:40:41.000Z
[ "pytorch", "vit", "feature-extraction", "dataset:imagenet-1k", "arxiv:2010.11929", "arxiv:2104.14294", "transformers", "dino", "license:apache-2.0" ]
feature-extraction
false
facebook
null
facebook/dino-vitb8
903
2
transformers
1,839
--- license: apache-2.0 tags: - dino datasets: - imagenet-1k --- # Vision Transformer (base-sized model, patch size 8) trained using DINO Vision Transformer (ViT) model trained using the DINO method. It was introduced in the paper [Emerging Properties in Self-Supervised Vision Transformers](https://arxiv.org/abs/2010.11929) by Mathilde Caron, Hugo Touvron, Ishan Misra, Hervé Jégou, Julien Mairal, Piotr Bojanowski, Armand Joulin and first released in [this repository](https://github.com/facebookresearch/dino). Disclaimer: The team releasing DINO did not write a model card for this model so this model card has been written by the Hugging Face team. ## Model description The Vision Transformer (ViT) is a transformer encoder model (BERT-like) pretrained on a large collection of images in a self-supervised fashion, namely ImageNet-1k, at a resolution of 224x224 pixels. Images are presented to the model as a sequence of fixed-size patches (resolution 8x8), which are linearly embedded. One also adds a [CLS] token to the beginning of a sequence to use it for classification tasks. One also adds absolute position embeddings before feeding the sequence to the layers of the Transformer encoder. Note that this model does not include any fine-tuned heads. By pre-training the model, it learns an inner representation of images that can then be used to extract features useful for downstream tasks: if you have a dataset of labeled images for instance, you can train a standard classifier by placing a linear layer on top of the pre-trained encoder. One typically places a linear layer on top of the [CLS] token, as the last hidden state of this token can be seen as a representation of an entire image. ## Intended uses & limitations You can use the raw model for image classification. See the [model hub](https://huggingface.co/models?search=google/vit) to look for fine-tuned versions on a task that interests you. ### How to use Here is how to use this model: ```python from transformers import ViTFeatureExtractor, ViTModel from PIL import Image import requests url = 'http://images.cocodataset.org/val2017/000000039769.jpg' image = Image.open(requests.get(url, stream=True).raw) feature_extractor = ViTFeatureExtractor.from_pretrained('facebook/dino-vitb8') model = ViTModel.from_pretrained('facebook/dino-vitb8') inputs = feature_extractor(images=image, return_tensors="pt") outputs = model(**inputs) last_hidden_states = outputs.last_hidden_state ``` ### BibTeX entry and citation info ```bibtex @article{DBLP:journals/corr/abs-2104-14294, author = {Mathilde Caron and Hugo Touvron and Ishan Misra and Herv{\'{e}} J{\'{e}}gou and Julien Mairal and Piotr Bojanowski and Armand Joulin}, title = {Emerging Properties in Self-Supervised Vision Transformers}, journal = {CoRR}, volume = {abs/2104.14294}, year = {2021}, url = {https://arxiv.org/abs/2104.14294}, archivePrefix = {arXiv}, eprint = {2104.14294}, timestamp = {Tue, 04 May 2021 15:12:43 +0200}, biburl = {https://dblp.org/rec/journals/corr/abs-2104-14294.bib}, bibsource = {dblp computer science bibliography, https://dblp.org} } ```
speechbrain/lang-id-voxlingua107-ecapa
9835356c3e7d6525f9182813b4b229e9226d53fc
2022-06-25T03:42:48.000Z
[ "multilingual", "dataset:VoxLingua107", "arxiv:2106.04624", "speechbrain", "audio-classification", "embeddings", "Language", "Identification", "pytorch", "ECAPA-TDNN", "TDNN", "VoxLingua107", "license:apache-2.0" ]
audio-classification
false
speechbrain
null
speechbrain/lang-id-voxlingua107-ecapa
903
6
speechbrain
1,840
--- language: multilingual thumbnail: tags: - audio-classification - speechbrain - embeddings - Language - Identification - pytorch - ECAPA-TDNN - TDNN - VoxLingua107 license: "apache-2.0" datasets: - VoxLingua107 metrics: - Accuracy widget: - example_title: English Sample src: https://cdn-media.huggingface.co/speech_samples/LibriSpeech_61-70968-0000.flac --- # VoxLingua107 ECAPA-TDNN Spoken Language Identification Model ## Model description This is a spoken language recognition model trained on the VoxLingua107 dataset using SpeechBrain. The model uses the ECAPA-TDNN architecture that has previously been used for speaker recognition. However, it uses more fully connected hidden layers after the embedding layer, and cross-entropy loss was used for training. We observed that this improved the performance of extracted utterance embeddings for downstream tasks. The system is trained with recordings sampled at 16kHz (single channel). The code will automatically normalize your audio (i.e., resampling + mono channel selection) when calling *classify_file* if needed. The model can classify a speech utterance according to the language spoken. It covers 107 different languages ( Abkhazian, Afrikaans, Amharic, Arabic, Assamese, Azerbaijani, Bashkir, Belarusian, Bulgarian, Bengali, Tibetan, Breton, Bosnian, Catalan, Cebuano, Czech, Welsh, Danish, German, Greek, English, Esperanto, Spanish, Estonian, Basque, Persian, Finnish, Faroese, French, Galician, Guarani, Gujarati, Manx, Hausa, Hawaiian, Hindi, Croatian, Haitian, Hungarian, Armenian, Interlingua, Indonesian, Icelandic, Italian, Hebrew, Japanese, Javanese, Georgian, Kazakh, Central Khmer, Kannada, Korean, Latin, Luxembourgish, Lingala, Lao, Lithuanian, Latvian, Malagasy, Maori, Macedonian, Malayalam, Mongolian, Marathi, Malay, Maltese, Burmese, Nepali, Dutch, Norwegian Nynorsk, Norwegian, Occitan, Panjabi, Polish, Pushto, Portuguese, Romanian, Russian, Sanskrit, Scots, Sindhi, Sinhala, Slovak, Slovenian, Shona, Somali, Albanian, Serbian, Sundanese, Swedish, Swahili, Tamil, Telugu, Tajik, Thai, Turkmen, Tagalog, Turkish, Tatar, Ukrainian, Urdu, Uzbek, Vietnamese, Waray, Yiddish, Yoruba, Mandarin Chinese). ## Intended uses & limitations The model has two uses: - use 'as is' for spoken language recognition - use as an utterance-level feature (embedding) extractor, for creating a dedicated language ID model on your own data The model is trained on automatically collected YouTube data. For more information about the dataset, see [here](http://bark.phon.ioc.ee/voxlingua107/). #### How to use ```python import torchaudio from speechbrain.pretrained import EncoderClassifier language_id = EncoderClassifier.from_hparams(source="speechbrain/lang-id-voxlingua107-ecapa", savedir="tmp") # Download Thai language sample from Omniglot and cvert to suitable form signal = language_id.load_audio("https://omniglot.com/soundfiles/udhr/udhr_th.mp3") prediction = language_id.classify_batch(signal) print(prediction) # (tensor([[-2.8646e+01, -3.0346e+01, -2.0748e+01, -2.9562e+01, -2.2187e+01, # -3.2668e+01, -3.6677e+01, -3.3573e+01, -3.2545e+01, -2.4365e+01, # -2.4688e+01, -3.1171e+01, -2.7743e+01, -2.9918e+01, -2.4770e+01, # -3.2250e+01, -2.4727e+01, -2.6087e+01, -2.1870e+01, -3.2821e+01, # -2.2128e+01, -2.2822e+01, -3.0888e+01, -3.3564e+01, -2.9906e+01, # -2.2392e+01, -2.5573e+01, -2.6443e+01, -3.2429e+01, -3.2652e+01, # -3.0030e+01, -2.4607e+01, -2.2967e+01, -2.4396e+01, -2.8578e+01, # -2.5153e+01, -2.8475e+01, -2.6409e+01, -2.5230e+01, -2.7957e+01, # -2.6298e+01, -2.3609e+01, -2.5863e+01, -2.8225e+01, -2.7225e+01, # -3.0486e+01, -2.1185e+01, -2.7938e+01, -3.3155e+01, -1.9076e+01, # -2.9181e+01, -2.2160e+01, -1.8352e+01, -2.5866e+01, -3.3636e+01, # -4.2016e+00, -3.1581e+01, -3.1894e+01, -2.7834e+01, -2.5429e+01, # -3.2235e+01, -3.2280e+01, -2.8786e+01, -2.3366e+01, -2.6047e+01, # -2.2075e+01, -2.3770e+01, -2.2518e+01, -2.8101e+01, -2.5745e+01, # -2.6441e+01, -2.9822e+01, -2.7109e+01, -3.0225e+01, -2.4566e+01, # -2.9268e+01, -2.7651e+01, -3.4221e+01, -2.9026e+01, -2.6009e+01, # -3.1968e+01, -3.1747e+01, -2.8156e+01, -2.9025e+01, -2.7756e+01, # -2.8052e+01, -2.9341e+01, -2.8806e+01, -2.1636e+01, -2.3992e+01, # -2.3794e+01, -3.3743e+01, -2.8332e+01, -2.7465e+01, -1.5085e-02, # -2.9094e+01, -2.1444e+01, -2.9780e+01, -3.6046e+01, -3.7401e+01, # -3.0888e+01, -3.3172e+01, -1.8931e+01, -2.2679e+01, -3.0225e+01, # -2.4995e+01, -2.1028e+01]]), tensor([-0.0151]), tensor([94]), ['th']) # The scores in the prediction[0] tensor can be interpreted as log-likelihoods that # the given utterance belongs to the given language (i.e., the larger the better) # The linear-scale likelihood can be retrieved using the following: print(prediction[1].exp()) # tensor([0.9850]) # The identified language ISO code is given in prediction[3] print(prediction[3]) # ['th: Thai'] # Alternatively, use the utterance embedding extractor: emb = language_id.encode_batch(signal) print(emb.shape) # torch.Size([1, 1, 256]) ``` To perform inference on the GPU, add `run_opts={"device":"cuda"}` when calling the `from_hparams` method. The system is trained with recordings sampled at 16kHz (single channel). The code will automatically normalize your audio (i.e., resampling + mono channel selection) when calling *classify_file* if needed. Make sure your input tensor is compliant with the expected sampling rate if you use *encode_batch* and *classify_batch*. #### Limitations and bias Since the model is trained on VoxLingua107, it has many limitations and biases, some of which are: - Probably it's accuracy on smaller languages is quite limited - Probably it works worse on female speech than male speech (because YouTube data includes much more male speech) - Based on subjective experiments, it doesn't work well on speech with a foreign accent - Probably it doesn't work well on children's speech and on persons with speech disorders ## Training data The model is trained on [VoxLingua107](http://bark.phon.ioc.ee/voxlingua107/). VoxLingua107 is a speech dataset for training spoken language identification models. The dataset consists of short speech segments automatically extracted from YouTube videos and labeled according the language of the video title and description, with some post-processing steps to filter out false positives. VoxLingua107 contains data for 107 languages. The total amount of speech in the training set is 6628 hours. The average amount of data per language is 62 hours. However, the real amount per language varies a lot. There is also a seperate development set containing 1609 speech segments from 33 languages, validated by at least two volunteers to really contain the given language. ## Training procedure See the [SpeechBrain recipe](https://github.com/speechbrain/speechbrain/tree/voxlingua107/recipes/VoxLingua107/lang_id). ## Evaluation results Error rate: 6.7% on the VoxLingua107 development dataset #### Referencing SpeechBrain ```bibtex @misc{speechbrain, title={{SpeechBrain}: A General-Purpose Speech Toolkit}, author={Mirco Ravanelli and Titouan Parcollet and Peter Plantinga and Aku Rouhe and Samuele Cornell and Loren Lugosch and Cem Subakan and Nauman Dawalatabad and Abdelwahab Heba and Jianyuan Zhong and Ju-Chieh Chou and Sung-Lin Yeh and Szu-Wei Fu and Chien-Feng Liao and Elena Rastorgueva and François Grondin and William Aris and Hwidong Na and Yan Gao and Renato De Mori and Yoshua Bengio}, year={2021}, eprint={2106.04624}, archivePrefix={arXiv}, primaryClass={eess.AS}, note={arXiv:2106.04624} } ``` ### Referencing VoxLingua107 ```bibtex @inproceedings{valk2021slt, title={{VoxLingua107}: a Dataset for Spoken Language Recognition}, author={J{\"o}rgen Valk and Tanel Alum{\"a}e}, booktitle={Proc. IEEE SLT Workshop}, year={2021}, } ``` #### About SpeechBrain SpeechBrain is an open-source and all-in-one speech toolkit. It is designed to be simple, extremely flexible, and user-friendly. Competitive or state-of-the-art performance is obtained in various domains. Website: https://speechbrain.github.io/ GitHub: https://github.com/speechbrain/speechbrain
navteca/bart-large-mnli
c39c03bcf29d1dab341409eee0b8cd3d7fa68b8a
2021-08-06T13:59:01.000Z
[ "pytorch", "jax", "bart", "text-classification", "en", "dataset:multi_nli", "arxiv:1909.00161", "transformers", "zero-shot-classification", "license:mit" ]
zero-shot-classification
false
navteca
null
navteca/bart-large-mnli
902
2
transformers
1,841
--- datasets: - multi_nli language: en license: mit pipeline_tag: zero-shot-classification tags: - bart - zero-shot-classification --- # Bart large model for NLI-based Zero Shot Text Classification This model uses [bart-large](https://huggingface.co/facebook/bart-large). ## Training Data This model was trained on the [MultiNLI (MNLI)](https://huggingface.co/datasets/multi_nli) dataset in the manner originally described in [Yin et al. 2019](https://arxiv.org/abs/1909.00161). It can be used to predict whether a topic label can be assigned to a given sequence, whether or not the label has been seen before. ## Usage and Performance The trained model can be used like this: ```python from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline # Load model & tokenizer bart_model = AutoModelForSequenceClassification.from_pretrained('navteca/bart-large-mnli') bart_tokenizer = AutoTokenizer.from_pretrained('navteca/bart-large-mnli') # Get predictions nlp = pipeline('zero-shot-classification', model=bart_model, tokenizer=bart_tokenizer) sequence = 'One day I will see the world.' candidate_labels = ['cooking', 'dancing', 'travel'] result = nlp(sequence, candidate_labels, multi_label=True) print(result) #{ # "sequence": "One day I will see the world.", # "labels": [ # "travel", # "dancing", # "cooking" # ], # "scores": [ # 0.9941897988319397, # 0.0060537424869835, # 0.0020010927692056 # ] #} ```
CAMeL-Lab/bert-base-arabic-camelbert-mix
9be352797bdf28a9ae21e2ae582aaaca7abdb22d
2021-09-14T14:34:32.000Z
[ "pytorch", "tf", "jax", "bert", "fill-mask", "ar", "arxiv:2103.06678", "transformers", "Arabic", "Dialect", "Egyptian", "Gulf", "Levantine", "Classical Arabic", "MSA", "Modern Standard Arabic", "license:apache-2.0", "autotrain_compatible" ]
fill-mask
false
CAMeL-Lab
null
CAMeL-Lab/bert-base-arabic-camelbert-mix
901
6
transformers
1,842
--- language: - ar license: apache-2.0 tags: - Arabic - Dialect - Egyptian - Gulf - Levantine - Classical Arabic - MSA - Modern Standard Arabic widget: - text: "الهدف من الحياة هو [MASK] ." --- # CAMeLBERT: A collection of pre-trained models for Arabic NLP tasks ## Model description **CAMeLBERT** is a collection of BERT models pre-trained on Arabic texts with different sizes and variants. We release pre-trained language models for Modern Standard Arabic (MSA), dialectal Arabic (DA), and classical Arabic (CA), in addition to a model pre-trained on a mix of the three. We also provide additional models that are pre-trained on a scaled-down set of the MSA variant (half, quarter, eighth, and sixteenth). The details are described in the paper *"[The Interplay of Variant, Size, and Task Type in Arabic Pre-trained Language Models](https://arxiv.org/abs/2103.06678)."* This model card describes **CAMeLBERT-Mix** (`bert-base-arabic-camelbert-mix`), a model pre-trained on a mixture of these variants: MSA, DA, and CA. ||Model|Variant|Size|#Word| |-|-|:-:|-:|-:| |✔|`bert-base-arabic-camelbert-mix`|CA,DA,MSA|167GB|17.3B| ||`bert-base-arabic-camelbert-ca`|CA|6GB|847M| ||`bert-base-arabic-camelbert-da`|DA|54GB|5.8B| ||`bert-base-arabic-camelbert-msa`|MSA|107GB|12.6B| ||`bert-base-arabic-camelbert-msa-half`|MSA|53GB|6.3B| ||`bert-base-arabic-camelbert-msa-quarter`|MSA|27GB|3.1B| ||`bert-base-arabic-camelbert-msa-eighth`|MSA|14GB|1.6B| ||`bert-base-arabic-camelbert-msa-sixteenth`|MSA|6GB|746M| ## Intended uses You can use the released model for either masked language modeling or next sentence prediction. However, it is mostly intended to be fine-tuned on an NLP task, such as NER, POS tagging, sentiment analysis, dialect identification, and poetry classification. We release our fine-tuninig code [here](https://github.com/CAMeL-Lab/CAMeLBERT). #### How to use You can use this model directly with a pipeline for masked language modeling: ```python >>> from transformers import pipeline >>> unmasker = pipeline('fill-mask', model='CAMeL-Lab/bert-base-arabic-camelbert-mix') >>> unmasker("الهدف من الحياة هو [MASK] .") [{'sequence': '[CLS] الهدف من الحياة هو النجاح. [SEP]', 'score': 0.10861027985811234, 'token': 6232, 'token_str': 'النجاح'}, {'sequence': '[CLS] الهدف من الحياة هو.. [SEP]', 'score': 0.07626965641975403, 'token': 18, 'token_str': '.'}, {'sequence': '[CLS] الهدف من الحياة هو الحياة. [SEP]', 'score': 0.05131986364722252, 'token': 3696, 'token_str': 'الحياة'}, {'sequence': '[CLS] الهدف من الحياة هو الموت. [SEP]', 'score': 0.03734956309199333, 'token': 4295, 'token_str': 'الموت'}, {'sequence': '[CLS] الهدف من الحياة هو العمل. [SEP]', 'score': 0.027189988642930984, 'token': 2854, 'token_str': 'العمل'}] ``` *Note*: to download our models, you would need `transformers>=3.5.0`. Otherwise, you could download the models manually. Here is how to use this model to get the features of a given text in PyTorch: ```python from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained('CAMeL-Lab/bert-base-arabic-camelbert-mix') model = AutoModel.from_pretrained('CAMeL-Lab/bert-base-arabic-camelbert-mix') text = "مرحبا يا عالم." encoded_input = tokenizer(text, return_tensors='pt') output = model(**encoded_input) ``` and in TensorFlow: ```python from transformers import AutoTokenizer, TFAutoModel tokenizer = AutoTokenizer.from_pretrained('CAMeL-Lab/bert-base-arabic-camelbert-mix') model = TFAutoModel.from_pretrained('CAMeL-Lab/bert-base-arabic-camelbert-mix') text = "مرحبا يا عالم." encoded_input = tokenizer(text, return_tensors='tf') output = model(encoded_input) ``` ## Training data - MSA (Modern Standard Arabic) - [The Arabic Gigaword Fifth Edition](https://catalog.ldc.upenn.edu/LDC2011T11) - [Abu El-Khair Corpus](http://www.abuelkhair.net/index.php/en/arabic/abu-el-khair-corpus) - [OSIAN corpus](https://vlo.clarin.eu/search;jsessionid=31066390B2C9E8C6304845BA79869AC1?1&q=osian) - [Arabic Wikipedia](https://archive.org/details/arwiki-20190201) - The unshuffled version of the Arabic [OSCAR corpus](https://oscar-corpus.com/) - DA (dialectal Arabic) - A collection of dialectal Arabic data described in [our paper](https://arxiv.org/abs/2103.06678). - CA (classical Arabic) - [OpenITI (Version 2020.1.2)](https://zenodo.org/record/3891466#.YEX4-F0zbzc) ## Training procedure We use [the original implementation](https://github.com/google-research/bert) released by Google for pre-training. We follow the original English BERT model's hyperparameters for pre-training, unless otherwise specified. ### Preprocessing - After extracting the raw text from each corpus, we apply the following pre-processing. - We first remove invalid characters and normalize white spaces using the utilities provided by [the original BERT implementation](https://github.com/google-research/bert/blob/eedf5716ce1268e56f0a50264a88cafad334ac61/tokenization.py#L286-L297). - We also remove lines without any Arabic characters. - We then remove diacritics and kashida using [CAMeL Tools](https://github.com/CAMeL-Lab/camel_tools). - Finally, we split each line into sentences with a heuristics-based sentence segmenter. - We train a WordPiece tokenizer on the entire dataset (167 GB text) with a vocabulary size of 30,000 using [HuggingFace's tokenizers](https://github.com/huggingface/tokenizers). - We do not lowercase letters nor strip accents. ### Pre-training - The model was trained on a single cloud TPU (`v3-8`) for one million steps in total. - The first 90,000 steps were trained with a batch size of 1,024 and the rest was trained with a batch size of 256. - The sequence length was limited to 128 tokens for 90% of the steps and 512 for the remaining 10%. - We use whole word masking and a duplicate factor of 10. - We set max predictions per sequence to 20 for the dataset with max sequence length of 128 tokens and 80 for the dataset with max sequence length of 512 tokens. - We use a random seed of 12345, masked language model probability of 0.15, and short sequence probability of 0.1. - The optimizer used is Adam with a learning rate of 1e-4, \\(\beta_{1} = 0.9\\) and \\(\beta_{2} = 0.999\\), a weight decay of 0.01, learning rate warmup for 10,000 steps and linear decay of the learning rate after. ## Evaluation results - We evaluate our pre-trained language models on five NLP tasks: NER, POS tagging, sentiment analysis, dialect identification, and poetry classification. - We fine-tune and evaluate the models using 12 dataset. - We used Hugging Face's transformers to fine-tune our CAMeLBERT models. - We used transformers `v3.1.0` along with PyTorch `v1.5.1`. - The fine-tuning was done by adding a fully connected linear layer to the last hidden state. - We use \\(F_{1}\\) score as a metric for all tasks. - Code used for fine-tuning is available [here](https://github.com/CAMeL-Lab/CAMeLBERT). ### Results | Task | Dataset | Variant | Mix | CA | DA | MSA | MSA-1/2 | MSA-1/4 | MSA-1/8 | MSA-1/16 | | -------------------- | --------------- | ------- | ----- | ----- | ----- | ----- | ------- | ------- | ------- | -------- | | NER | ANERcorp | MSA | 80.8% | 67.9% | 74.1% | 82.4% | 82.0% | 82.1% | 82.6% | 80.8% | | POS | PATB (MSA) | MSA | 98.1% | 97.8% | 97.7% | 98.3% | 98.2% | 98.3% | 98.2% | 98.2% | | | ARZTB (EGY) | DA | 93.6% | 92.3% | 92.7% | 93.6% | 93.6% | 93.7% | 93.6% | 93.6% | | | Gumar (GLF) | DA | 97.3% | 97.7% | 97.9% | 97.9% | 97.9% | 97.9% | 97.9% | 97.9% | | SA | ASTD | MSA | 76.3% | 69.4% | 74.6% | 76.9% | 76.0% | 76.8% | 76.7% | 75.3% | | | ArSAS | MSA | 92.7% | 89.4% | 91.8% | 93.0% | 92.6% | 92.5% | 92.5% | 92.3% | | | SemEval | MSA | 69.0% | 58.5% | 68.4% | 72.1% | 70.7% | 72.8% | 71.6% | 71.2% | | DID | MADAR-26 | DA | 62.9% | 61.9% | 61.8% | 62.6% | 62.0% | 62.8% | 62.0% | 62.2% | | | MADAR-6 | DA | 92.5% | 91.5% | 92.2% | 91.9% | 91.8% | 92.2% | 92.1% | 92.0% | | | MADAR-Twitter-5 | MSA | 75.7% | 71.4% | 74.2% | 77.6% | 78.5% | 77.3% | 77.7% | 76.2% | | | NADI | DA | 24.7% | 17.3% | 20.1% | 24.9% | 24.6% | 24.6% | 24.9% | 23.8% | | Poetry | APCD | CA | 79.8% | 80.9% | 79.6% | 79.7% | 79.9% | 80.0% | 79.7% | 79.8% | ### Results (Average) | | Variant | Mix | CA | DA | MSA | MSA-1/2 | MSA-1/4 | MSA-1/8 | MSA-1/16 | | -------------------- | ------- | ----- | ----- | ----- | ----- | ------- | ------- | ------- | -------- | | Variant-wise-average<sup>[[1]](#footnote-1)</sup> | MSA | 82.1% | 75.7% | 80.1% | 83.4% | 83.0% | 83.3% | 83.2% | 82.3% | | | DA | 74.4% | 72.1% | 72.9% | 74.2% | 74.0% | 74.3% | 74.1% | 73.9% | | | CA | 79.8% | 80.9% | 79.6% | 79.7% | 79.9% | 80.0% | 79.7% | 79.8% | | Macro-Average | ALL | 78.7% | 74.7% | 77.1% | 79.2% | 79.0% | 79.2% | 79.1% | 78.6% | <a name="footnote-1">[1]</a>: Variant-wise-average refers to average over a group of tasks in the same language variant. ## Acknowledgements This research was supported with Cloud TPUs from Google’s TensorFlow Research Cloud (TFRC). ## Citation ```bibtex @inproceedings{inoue-etal-2021-interplay, title = "The Interplay of Variant, Size, and Task Type in {A}rabic Pre-trained Language Models", author = "Inoue, Go and Alhafni, Bashar and Baimukan, Nurpeiis and Bouamor, Houda and Habash, Nizar", booktitle = "Proceedings of the Sixth Arabic Natural Language Processing Workshop", month = apr, year = "2021", address = "Kyiv, Ukraine (Online)", publisher = "Association for Computational Linguistics", abstract = "In this paper, we explore the effects of language variants, data sizes, and fine-tuning task types in Arabic pre-trained language models. To do so, we build three pre-trained language models across three variants of Arabic: Modern Standard Arabic (MSA), dialectal Arabic, and classical Arabic, in addition to a fourth language model which is pre-trained on a mix of the three. We also examine the importance of pre-training data size by building additional models that are pre-trained on a scaled-down set of the MSA variant. We compare our different models to each other, as well as to eight publicly available models by fine-tuning them on five NLP tasks spanning 12 datasets. Our results suggest that the variant proximity of pre-training data to fine-tuning data is more important than the pre-training data size. We exploit this insight in defining an optimized system selection model for the studied tasks.", } ```
castorini/ance-msmarco-doc-maxp
95207533d035adaddeb195da8484cb6cfaa366f3
2021-05-20T15:17:50.000Z
[ "pytorch", "roberta", "arxiv:2007.00808", "transformers" ]
null
false
castorini
null
castorini/ance-msmarco-doc-maxp
901
null
transformers
1,843
This model is converted from the original ANCE [repo](https://github.com/microsoft/ANCE) and fitted into Pyserini: > Lee Xiong, Chenyan Xiong, Ye Li, Kwok-Fung Tang, Jialin Liu, Paul Bennett, Junaid Ahmed, Arnold Overwijk. [Approximate Nearest Neighbor Negative Contrastive Learning for Dense Text Retrieval](https://arxiv.org/pdf/2007.00808.pdf) For more details on how to use it, check our experiments in [Pyserini](https://github.com/castorini/pyserini/blob/master/docs/experiments-ance.md)
M-CLIP/M-BERT-Base-69
e5bf2855224ca5294be65b45344ddcd06219c41d
2021-05-18T21:33:14.000Z
[ "pytorch", "jax", "bert", "feature-extraction", "transformers" ]
feature-extraction
false
M-CLIP
null
M-CLIP/M-BERT-Base-69
900
null
transformers
1,844
<br /> <p align="center"> <h1 align="center">M-BERT Base 69</h1> <p align="center"> <a href="https://github.com/FreddeFrallan/Multilingual-CLIP/tree/main/Model%20Cards/M-BERT%20Base%2069">Github Model Card</a> </p> </p> ## Usage To use this model along with the original CLIP vision encoder you need to download the code and additional linear weights from the [Multilingual-CLIP Github](https://github.com/FreddeFrallan/Multilingual-CLIP). Once this is done, you can load and use the model with the following code ```python from src import multilingual_clip model = multilingual_clip.load_model('M-BERT-Base-40') embeddings = model(['Älgen är skogens konung!', 'Wie leben Eisbären in der Antarktis?', 'Вы знали, что все белые медведи левши?']) print(embeddings.shape) # Yields: torch.Size([3, 640]) ``` <!-- ABOUT THE PROJECT --> ## About A [BERT-base-multilingual](https://huggingface.co/bert-base-multilingual-cased) tuned to match the embedding space for [69 languages](https://github.com/FreddeFrallan/Multilingual-CLIP/blob/main/Model%20Cards/M-BERT%20Base%2069/Fine-Tune-Languages.md), to the embedding space of the CLIP text encoder which accompanies the Res50x4 vision encoder. <br> A full list of the 100 languages used during pre-training can be found [here](https://github.com/google-research/bert/blob/master/multilingual.md#list-of-languages), and a list of the 4069languages used during fine-tuning can be found in [SupportedLanguages.md](https://github.com/FreddeFrallan/Multilingual-CLIP/blob/main/Model%20Cards/M-BERT%20Base%2069/Fine-Tune-Languages.md). Training data pairs was generated by sampling 40k sentences for each language from the combined descriptions of [GCC](https://ai.google.com/research/ConceptualCaptions/) + [MSCOCO](https://cocodataset.org/#home) + [VizWiz](https://vizwiz.org/tasks-and-datasets/image-captioning/), and translating them into the corresponding language. All translation was done using the [AWS translate service](https://aws.amazon.com/translate/), the quality of these translations have currently not been analyzed, but one can assume the quality varies between the 69 languages.
SkolkovoInstitute/rubert-base-corruption-detector
27965caf27a4897bd0df76128dc8707ca7e212a7
2021-12-18T09:28:50.000Z
[ "pytorch", "bert", "text-classification", "ru", "transformers", "fluency" ]
text-classification
false
SkolkovoInstitute
null
SkolkovoInstitute/rubert-base-corruption-detector
900
null
transformers
1,845
--- language: - ru tags: - fluency --- This is a model for evaluation of naturalness of short Russian texts. It has been trained to distinguish human-written texts from their corrupted versions. Corruption sources: random replacement, deletion, addition, shuffling, and re-inflection of words and characters, random changes of capitalization, round-trip translation, filling random gaps with T5 and RoBERTA models. For each original text, we sampled three corrupted texts, so the model is uniformly biased towards the `unnatural` label. Data sources: web-corpora from [the Leipzig collection](https://wortschatz.uni-leipzig.de/en/download) (`rus_news_2020_100K`, `rus_newscrawl-public_2018_100K`, `rus-ru_web-public_2019_100K`, `rus_wikipedia_2021_100K`), comments from [OK](https://www.kaggle.com/alexandersemiletov/toxic-russian-comments) and [Pikabu](https://www.kaggle.com/blackmoon/russian-language-toxic-comments). On our private test dataset, the model has achieved 40% rank correlation with human judgements of naturalness, which is higher than GPT perplexity, another popular fluency metric.
monologg/koelectra-base-v2-finetuned-korquad
6cf15019cbd304a9cef33a1c94e66850814a66f9
2020-06-03T03:32:20.000Z
[ "pytorch", "electra", "question-answering", "transformers", "autotrain_compatible" ]
question-answering
false
monologg
null
monologg/koelectra-base-v2-finetuned-korquad
900
null
transformers
1,846
Entry not found
juliamendelsohn/framing_issue_generic
6b35ca7630b0b6fb208e600ed4f3c236f8abe042
2021-05-20T17:27:30.000Z
[ "pytorch", "roberta", "transformers" ]
null
false
juliamendelsohn
null
juliamendelsohn/framing_issue_generic
898
null
transformers
1,847
Entry not found
facebook/detr-resnet-101-panoptic
4297151a5e287d2ed673392d2c0a1c6d46142d5c
2022-06-27T08:34:50.000Z
[ "pytorch", "detr", "image-segmentation", "dataset:coco", "arxiv:2005.12872", "transformers", "vision", "license:apache-2.0" ]
image-segmentation
false
facebook
null
facebook/detr-resnet-101-panoptic
897
2
transformers
1,848
--- license: apache-2.0 tags: - image-segmentation - vision datasets: - coco widget: - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/dog-cat.jpg example_title: Dog & Cat - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/construction-site.jpg example_title: Construction Site - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/apple-orange.jpg example_title: Apple & Orange --- # DETR (End-to-End Object Detection) model with ResNet-101 backbone DEtection TRansformer (DETR) model trained end-to-end on COCO 2017 panoptic (118k annotated images). It was introduced in the paper [End-to-End Object Detection with Transformers](https://arxiv.org/abs/2005.12872) by Carion et al. and first released in [this repository](https://github.com/facebookresearch/detr). Disclaimer: The team releasing DETR did not write a model card for this model so this model card has been written by the Hugging Face team. ## Model description The DETR model is an encoder-decoder transformer with a convolutional backbone. Two heads are added on top of the decoder outputs in order to perform object detection: a linear layer for the class labels and a MLP (multi-layer perceptron) for the bounding boxes. The model uses so-called object queries to detect objects in an image. Each object query looks for a particular object in the image. For COCO, the number of object queries is set to 100. The model is trained using a "bipartite matching loss": one compares the predicted classes + bounding boxes of each of the N = 100 object queries to the ground truth annotations, padded up to the same length N (so if an image only contains 4 objects, 96 annotations will just have a "no object" as class and "no bounding box" as bounding box). The Hungarian matching algorithm is used to create an optimal one-to-one mapping between each of the N queries and each of the N annotations. Next, standard cross-entropy (for the classes) and a linear combination of the L1 and generalized IoU loss (for the bounding boxes) are used to optimize the parameters of the model. DETR can be naturally extended to perform panoptic segmentation, by adding a mask head on top of the decoder outputs. ## Intended uses & limitations You can use the raw model for panoptic segmentation. See the [model hub](https://huggingface.co/models?search=facebook/detr) to look for all available DETR models. ### How to use Here is how to use this model: ```python from transformers import DetrFeatureExtractor, DetrForSegmentation from PIL import Image import requests url = 'http://images.cocodataset.org/val2017/000000039769.jpg' image = Image.open(requests.get(url, stream=True).raw) feature_extractor = DetrFeatureExtractor.from_pretrained('facebook/detr-resnet-101-panoptic') model = DetrForSegmentation.from_pretrained('facebook/detr-resnet-101-panoptic') inputs = feature_extractor(images=image, return_tensors="pt") outputs = model(**inputs) # model predicts COCO classes, bounding boxes, and masks logits = outputs.logits bboxes = outputs.pred_boxes masks = outputs.pred_masks ``` Currently, both the feature extractor and model support PyTorch. ## Training data The DETR model was trained on [COCO 2017 panoptic](https://cocodataset.org/#download), a dataset consisting of 118k/5k annotated images for training/validation respectively. ## Training procedure ### Preprocessing The exact details of preprocessing of images during training/validation can be found [here](https://github.com/facebookresearch/detr/blob/master/datasets/coco_panoptic.py). Images are resized/rescaled such that the shortest side is at least 800 pixels and the largest side at most 1333 pixels, and normalized across the RGB channels with the ImageNet mean (0.485, 0.456, 0.406) and standard deviation (0.229, 0.224, 0.225). ### Training The model was trained for 300 epochs on 16 V100 GPUs. This takes 3 days, with 4 images per GPU (hence a total batch size of 64). ## Evaluation results This model achieves the following results on COCO 2017 validation: a box AP (average precision) of **40.1**, a segmentation AP (average precision) of **33** and a PQ (panoptic quality) of **45.1**. For more details regarding evaluation results, we refer to table 5 of the original paper. ### BibTeX entry and citation info ```bibtex @article{DBLP:journals/corr/abs-2005-12872, author = {Nicolas Carion and Francisco Massa and Gabriel Synnaeve and Nicolas Usunier and Alexander Kirillov and Sergey Zagoruyko}, title = {End-to-End Object Detection with Transformers}, journal = {CoRR}, volume = {abs/2005.12872}, year = {2020}, url = {https://arxiv.org/abs/2005.12872}, archivePrefix = {arXiv}, eprint = {2005.12872}, timestamp = {Thu, 28 May 2020 17:38:09 +0200}, biburl = {https://dblp.org/rec/journals/corr/abs-2005-12872.bib}, bibsource = {dblp computer science bibliography, https://dblp.org} } ```
allenai/PRIMERA-multixscience
69ef13b16f5edc76323f57af922c9b4c47bb7d5c
2022-07-25T18:17:07.000Z
[ "pytorch", "led", "text2text-generation", "transformers", "license:apache-2.0", "autotrain_compatible" ]
text2text-generation
false
allenai
null
allenai/PRIMERA-multixscience
896
1
transformers
1,849
--- license: apache-2.0 --- HF-version model for PRIMERA: Pyramid-based Masked Sentence Pre-training for Multi-document Summarization (ACL 2022). The original code can be found [here](https://github.com/allenai/PRIMER). You can find the script and notebook to train/evaluate the model in the original github repo. * Note: due to the difference between the implementations of the original Longformer and the Huggingface LED model, the results of converted models are slightly different. We run a sanity check on both fine-tuned and non fine-tuned models on the **MultiNews dataset**, and show the results below: | Model | Rouge-1 | Rouge-2 | Rouge-L | | --- | ----------- |----------- |----------- | | PRIMERA | 42.0 | 13.6 | 20.8| | PRIMERA-hf | 41.7 |13.6 | 20.5| | PRIMERA(finetuned) | 49.9 | 21.1 | 25.9| | PRIMERA-hf(finetuned) | 49.9 | 20.9 | 25.8| You can use it by ``` from transformers import ( AutoTokenizer, LEDConfig, LEDForConditionalGeneration, ) tokenizer = AutoTokenizer.from_pretrained('allenai/PRIMERA') config=LEDConfig.from_pretrained('allenai/PRIMERA') model = LEDForConditionalGeneration.from_pretrained('allenai/PRIMERA') ```
tner/roberta-large-tweetner-2020
768bf9f64587af66884cfb5053999594f341baa9
2022-07-08T11:45:18.000Z
[ "pytorch", "roberta", "token-classification", "transformers", "autotrain_compatible" ]
token-classification
false
tner
null
tner/roberta-large-tweetner-2020
896
null
transformers
1,850
Entry not found
ThomasNLG/t5-qa_squad2neg-en
41de3e39d518801383740526946e70880d096cd8
2021-07-09T07:44:39.000Z
[ "pytorch", "jax", "t5", "text2text-generation", "en", "dataset:squad_v2", "arxiv:2103.12693", "transformers", "qa", "question", "answering", "SQuAD", "metric", "nlg", "t5-small", "license:mit", "model-index", "autotrain_compatible" ]
text2text-generation
false
ThomasNLG
null
ThomasNLG/t5-qa_squad2neg-en
895
null
transformers
1,851
--- language: en tags: - qa - question - answering - SQuAD - metric - nlg - t5-small license: mit datasets: - squad_v2 model-index: - name: t5-qa_squad2neg-en results: - task: name: Question Answering type: extractive-qa widget: - text: "Who was Louis 14? </s> Louis 14 was a French King." --- # t5-qa_squad2neg-en ## Model description This model is a *Question Answering* model based on T5-small. It is actually a component of [QuestEval](https://github.com/ThomasScialom/QuestEval) metric but can be used independently as it is, for QA only. ## How to use ```python from transformers import T5Tokenizer, T5ForConditionalGeneration tokenizer = T5Tokenizer.from_pretrained("ThomasNLG/t5-qa_squad2neg-en") model = T5ForConditionalGeneration.from_pretrained("ThomasNLG/t5-qa_squad2neg-en") ``` You can play with the model using the inference API, the text input format should follow this template (accordingly to the training stage of the model): `text_input = "{QUESTION} </s> {CONTEXT}"` ## Training data The model was trained on: - SQuAD-v2 - SQuAD-v2 neg: in addition to the training data of SQuAD-v2, for each answerable example, a negative sampled example has been added with the label *unanswerable* to help the model learning when the question is not answerable given the context. For more details, see the [paper](https://arxiv.org/abs/2103.12693). ### Citation info ```bibtex @article{scialom2020QuestEval, title={QuestEval: Summarization Asks for Fact-based Evaluation}, author={Scialom, Thomas and Dray, Paul-Alexis and Gallinari, Patrick and Lamprier, Sylvain and Piwowarski, Benjamin and Staiano, Jacopo and Wang, Alex}, journal={arXiv preprint arXiv:2103.12693}, year={2021} } ```
OFA-Sys/OFA-base
01ecca4855f318a69ed4821957ee23d499d28cc3
2022-07-25T11:52:55.000Z
[ "pytorch", "ofa", "transformers", "license:apache-2.0" ]
null
false
OFA-Sys
null
OFA-Sys/OFA-base
893
2
transformers
1,852
--- license: apache-2.0 --- # OFA-base This is the **base** version of OFA pretrained model. OFA is a unified multimodal pretrained model that unifies modalities (i.e., cross-modality, vision, language) and tasks (e.g., image generation, visual grounding, image captioning, image classification, text generation, etc.) to a simple sequence-to-sequence learning framework. The directory includes 4 files, namely `config.json` which consists of model configuration, `vocab.json` and `merge.txt` for our OFA tokenizer, and lastly `pytorch_model.bin` which consists of model weights. There is no need to worry about the mismatch between Fairseq and transformers, since we have addressed the issue yet. To use it in transformers, please refer to https://github.com/OFA-Sys/OFA/tree/feature/add_transformers. Install the transformers and download the models as shown below. ``` git clone --single-branch --branch feature/add_transformers https://github.com/OFA-Sys/OFA.git pip install OFA/transformers/ git clone https://huggingface.co/OFA-Sys/OFA-base ``` After, refer the path to OFA-base to `ckpt_dir`, and prepare an image for the testing example below. Also, ensure that you have pillow and torchvision in your environment. ``` >>> from PIL import Image >>> from torchvision import transforms >>> from transformers import OFATokenizer, OFAModel >>> from generate import sequence_generator >>> mean, std = [0.5, 0.5, 0.5], [0.5, 0.5, 0.5] >>> resolution = 384 >>> patch_resize_transform = transforms.Compose([ lambda image: image.convert("RGB"), transforms.Resize((resolution, resolution), interpolation=Image.BICUBIC), transforms.ToTensor(), transforms.Normalize(mean=mean, std=std) ]) >>> tokenizer = OFATokenizer.from_pretrained(ckpt_dir) >>> txt = " what does the image describe?" >>> inputs = tokenizer([txt], return_tensors="pt").input_ids >>> img = Image.open(path_to_image) >>> patch_img = patch_resize_transform(img).unsqueeze(0) >>> # using the generator of fairseq version >>> model = OFAModel.from_pretrained(ckpt_dir, use_cache=True) >>> generator = sequence_generator.SequenceGenerator( tokenizer=tokenizer, beam_size=5, max_len_b=16, min_len=0, no_repeat_ngram_size=3, ) >>> data = {} >>> data["net_input"] = {"input_ids": inputs, 'patch_images': patch_img, 'patch_masks':torch.tensor([True])} >>> gen_output = generator.generate([model], data) >>> gen = [gen_output[i][0]["tokens"] for i in range(len(gen_output))] >>> # using the generator of huggingface version >>> model = OFAModel.from_pretrained(ckpt_dir, use_cache=False) >>> gen = model.generate(inputs, patch_images=patch_img, num_beams=5, no_repeat_ngram_size=3) >>> print(tokenizer.batch_decode(gen, skip_special_tokens=True)) ```
asahi417/relbert-roberta-large
07c0062eb062303e48c0fe2544148af5fd6c76a4
2021-07-05T13:39:36.000Z
[ "pytorch", "roberta", "feature-extraction", "transformers" ]
feature-extraction
false
asahi417
null
asahi417/relbert-roberta-large
892
null
transformers
1,853
# RelBERT RoBERTa finetuned on the contrastive loss for lexical relation. Please take a look [the official repository](https://github.com/asahi417/relbert).
barissayil/bert-sentiment-analysis-sst
969d390abf6b567c74ce1af74505b449734b4285
2021-06-11T09:47:14.000Z
[ "pytorch", "bert", "text-classification", "transformers" ]
text-classification
false
barissayil
null
barissayil/bert-sentiment-analysis-sst
891
null
transformers
1,854
Entry not found
MaryaAI/opus-mt-en-ar-finetuned-Math-13-10-en-to-ar
133d8b58a906746884d78764aeb064bad1871dae
2021-10-17T08:27:27.000Z
[ "pytorch", "tensorboard", "marian", "text2text-generation", "dataset:syssr_en_ar", "transformers", "generated_from_trainer", "license:apache-2.0", "model-index", "autotrain_compatible" ]
text2text-generation
false
MaryaAI
null
MaryaAI/opus-mt-en-ar-finetuned-Math-13-10-en-to-ar
890
null
transformers
1,855
--- license: apache-2.0 tags: - generated_from_trainer datasets: - syssr_en_ar model-index: - name: opus-mt-en-ar-finetuned-Math-13-10-en-to-ar results: [] --- <!-- This model card has been generated automatically according to the information the Trainer had access to. You should probably proofread and complete it, then remove this comment. --> # opus-mt-en-ar-finetuned-Math-13-10-en-to-ar This model is a fine-tuned version of [Helsinki-NLP/opus-mt-en-ar](https://huggingface.co/Helsinki-NLP/opus-mt-en-ar) on the syssr_en_ar dataset. ## Model description More information needed ## Intended uses & limitations More information needed ## Training and evaluation data More information needed ## Training procedure ### Training hyperparameters The following hyperparameters were used during training: - learning_rate: 2e-05 - train_batch_size: 16 - eval_batch_size: 16 - seed: 42 - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 - lr_scheduler_type: linear - num_epochs: 5 - mixed_precision_training: Native AMP ### Framework versions - Transformers 4.11.3 - Pytorch 1.9.0+cu111 - Datasets 1.13.0 - Tokenizers 0.10.3
textattack/distilbert-base-uncased-imdb
5b0f46c2fc4b86bf21f0ec0409bed77ee142b332
2020-07-06T16:34:50.000Z
[ "pytorch", "distilbert", "text-classification", "transformers" ]
text-classification
false
textattack
null
textattack/distilbert-base-uncased-imdb
889
null
transformers
1,856
## TextAttack Model Card This `distilbert-base-uncased` model was fine-tuned for sequence classification using TextAttack and the imdb dataset loaded using the `nlp` library. The model was fine-tuned for 5 epochs with a batch size of 16, a learning rate of 2e-05, and a maximum sequence length of 128. Since this was a classification task, the model was trained with a cross-entropy loss function. The best score the model achieved on this task was 0.88, as measured by the eval set accuracy, found after 2 epochs. For more information, check out [TextAttack on Github](https://github.com/QData/TextAttack).
tanmoyio/wav2vec2-large-xlsr-bengali
7447c623dca066b74d0299d0132dfca0674b6c8a
2021-09-23T16:39:27.000Z
[ "pytorch", "wav2vec2", "automatic-speech-recognition", "Bengali", "dataset:OpenSLR", "transformers", "audio", "speech", "xlsr-fine-tuning-week", "license:cc-by-sa-4.0", "model-index" ]
automatic-speech-recognition
false
tanmoyio
null
tanmoyio/wav2vec2-large-xlsr-bengali
888
2
transformers
1,857
--- language: Bengali datasets: - OpenSLR metrics: - wer tags: - audio - automatic-speech-recognition - speech - xlsr-fine-tuning-week license: cc-by-sa-4.0 model-index: - name: XLSR Wav2Vec2 Bengali by Tanmoy Sarkar results: - task: name: Speech Recognition type: automatic-speech-recognition dataset: name: OpenSLR type: OpenSLR args: ben metrics: - name: Test WER type: wer value: 88.58 --- # Wav2Vec2-Large-XLSR-Bengali Fine-tuned [facebook/wav2vec2-large-xlsr-53](https://huggingface.co/facebook/wav2vec2-large-xlsr-53) Bengali using the [Bengali ASR training data set containing ~196K utterances](https://www.openslr.org/53/). When using this model, make sure that your speech input is sampled at 16kHz. ## Usage Dataset must be downloaded from [this website](https://www.openslr.org/53/) and preprocessed accordingly. For example 1250 test samples has been chosen. ```python import pandas as pd test_dataset = pd.read_csv('utt_spk_text.tsv', sep='\\t', header=None)[60000:61250] test_dataset.columns = ["audio_path", "__", "label"] test_dataset = test_data.drop("__", axis=1) def add_file_path(text): path = "data/" + text[:2] + "/" + text + '.flac' return path test_dataset['audio_path'] = test_dataset['audio_path'].map(lambda x: add_file_path(x)) ``` The model can be used directly (without a language model) as follows: ```python import torch import torchaudio from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor processor = Wav2Vec2Processor.from_pretrained("tanmoyio/wav2vec2-large-xlsr-bengali") model = Wav2Vec2ForCTC.from_pretrained("tanmoyio/wav2vec2-large-xlsr-bengali") resampler = torchaudio.transforms.Resample(48_000, 16_000) # Preprocessing the datasets. # We need to read the aduio files as arrays def speech_file_to_array_fn(batch): speech_array, sampling_rate = torchaudio.load(batch["audio_path"]) batch["speech"] = resampler(speech_array).squeeze().numpy() return batch test_dataset = test_dataset.map(speech_file_to_array_fn) inputs = processor(test_dataset["speech"][:2], sampling_rate=16_000, return_tensors="pt", padding=True) with torch.no_grad(): logits = model(inputs.input_values, attention_mask=inputs.attention_mask).logits predicted_ids = torch.argmax(logits, dim=-1) print("Prediction:", processor.batch_decode(predicted_ids)) print("Reference:", test_dataset["label"][:2]) ``` ## Evaluation The model can be evaluated as follows on the Bengali test data of OpenSLR. ```python import torch import torchaudio from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor import re wer = load_metric("wer") processor = Wav2Vec2Processor.from_pretrained("tanmoyio/wav2vec2-large-xlsr-bengali") model = Wav2Vec2ForCTC.from_pretrained("tanmoyio/wav2vec2-large-xlsr-bengali") model.to("cuda") resampler = torchaudio.transforms.Resample(48_000, 16_000) # Preprocessing the datasets. # We need to read the aduio files as arrays def speech_file_to_array_fn(batch): batch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["label"]).lower() speech_array, sampling_rate = torchaudio.load(batch["path"]) batch["speech"] = resampler(speech_array).squeeze().numpy() return batch test_dataset = test_dataset.map(speech_file_to_array_fn) # Preprocessing the datasets. # We need to read the aduio files as arrays def evaluate(batch): inputs = processor(batch["speech"], sampling_rate=16_000, return_tensors="pt", padding=True) with torch.no_grad(): logits = model(inputs.input_values.to("cuda"), attention_mask=inputs.attention_mask.to("cuda")).logits pred_ids = torch.argmax(logits, dim=-1) batch["pred_strings"] = processor.batch_decode(pred_ids) return batch result = test_dataset.map(evaluate, batched=True, batch_size=8) print("WER: {:2f}".format(100 * wer.compute(predictions=result["pred_strings"], references=result["sentence"]))) ``` **Test Result**: 88.58 % ## Training The script used for training can be found [Bengali ASR Fine Tuning Wav2Vec2](https://colab.research.google.com/drive/1Bkc5C_cJV9BeS0FD0MuHyayl8hqcbdRZ?usp=sharing)
Helsinki-NLP/opus-mt-tc-big-en-es
26b349a9177b11b92b2b56b47344ebe73e515817
2022-06-01T12:59:20.000Z
[ "pytorch", "marian", "text2text-generation", "en", "es", "transformers", "translation", "opus-mt-tc", "license:cc-by-4.0", "model-index", "autotrain_compatible" ]
translation
false
Helsinki-NLP
null
Helsinki-NLP/opus-mt-tc-big-en-es
887
null
transformers
1,858
--- language: - en - es tags: - translation - opus-mt-tc license: cc-by-4.0 model-index: - name: opus-mt-tc-big-en-es results: - task: name: Translation eng-spa type: translation args: eng-spa dataset: name: flores101-devtest type: flores_101 args: eng spa devtest metrics: - name: BLEU type: bleu value: 28.5 - task: name: Translation eng-spa type: translation args: eng-spa dataset: name: news-test2008 type: news-test2008 args: eng-spa metrics: - name: BLEU type: bleu value: 30.1 - task: name: Translation eng-spa type: translation args: eng-spa dataset: name: tatoeba-test-v2021-08-07 type: tatoeba_mt args: eng-spa metrics: - name: BLEU type: bleu value: 57.2 - task: name: Translation eng-spa type: translation args: eng-spa dataset: name: tico19-test type: tico19-test args: eng-spa metrics: - name: BLEU type: bleu value: 53.0 - task: name: Translation eng-spa type: translation args: eng-spa dataset: name: newstest2009 type: wmt-2009-news args: eng-spa metrics: - name: BLEU type: bleu value: 30.2 - task: name: Translation eng-spa type: translation args: eng-spa dataset: name: newstest2010 type: wmt-2010-news args: eng-spa metrics: - name: BLEU type: bleu value: 37.6 - task: name: Translation eng-spa type: translation args: eng-spa dataset: name: newstest2011 type: wmt-2011-news args: eng-spa metrics: - name: BLEU type: bleu value: 38.9 - task: name: Translation eng-spa type: translation args: eng-spa dataset: name: newstest2012 type: wmt-2012-news args: eng-spa metrics: - name: BLEU type: bleu value: 39.5 - task: name: Translation eng-spa type: translation args: eng-spa dataset: name: newstest2013 type: wmt-2013-news args: eng-spa metrics: - name: BLEU type: bleu value: 35.9 --- # opus-mt-tc-big-en-es Neural machine translation model for translating from English (en) to Spanish (es). This model is part of the [OPUS-MT project](https://github.com/Helsinki-NLP/Opus-MT), an effort to make neural machine translation models widely available and accessible for many languages in the world. All models are originally trained using the amazing framework of [Marian NMT](https://marian-nmt.github.io/), an efficient NMT implementation written in pure C++. The models have been converted to pyTorch using the transformers library by huggingface. Training data is taken from [OPUS](https://opus.nlpl.eu/) and training pipelines use the procedures of [OPUS-MT-train](https://github.com/Helsinki-NLP/Opus-MT-train). * Publications: [OPUS-MT – Building open translation services for the World](https://aclanthology.org/2020.eamt-1.61/) and [The Tatoeba Translation Challenge – Realistic Data Sets for Low Resource and Multilingual MT](https://aclanthology.org/2020.wmt-1.139/) (Please, cite if you use this model.) ``` @inproceedings{tiedemann-thottingal-2020-opus, title = "{OPUS}-{MT} {--} Building open translation services for the World", author = {Tiedemann, J{\"o}rg and Thottingal, Santhosh}, booktitle = "Proceedings of the 22nd Annual Conference of the European Association for Machine Translation", month = nov, year = "2020", address = "Lisboa, Portugal", publisher = "European Association for Machine Translation", url = "https://aclanthology.org/2020.eamt-1.61", pages = "479--480", } @inproceedings{tiedemann-2020-tatoeba, title = "The Tatoeba Translation Challenge {--} Realistic Data Sets for Low Resource and Multilingual {MT}", author = {Tiedemann, J{\"o}rg}, booktitle = "Proceedings of the Fifth Conference on Machine Translation", month = nov, year = "2020", address = "Online", publisher = "Association for Computational Linguistics", url = "https://aclanthology.org/2020.wmt-1.139", pages = "1174--1182", } ``` ## Model info * Release: 2022-03-13 * source language(s): eng * target language(s): spa * model: transformer-big * data: opusTCv20210807+bt ([source](https://github.com/Helsinki-NLP/Tatoeba-Challenge)) * tokenization: SentencePiece (spm32k,spm32k) * original model: [opusTCv20210807+bt_transformer-big_2022-03-13.zip](https://object.pouta.csc.fi/Tatoeba-MT-models/eng-spa/opusTCv20210807+bt_transformer-big_2022-03-13.zip) * more information released models: [OPUS-MT eng-spa README](https://github.com/Helsinki-NLP/Tatoeba-Challenge/tree/master/models/eng-spa/README.md) ## Usage A short example code: ```python from transformers import MarianMTModel, MarianTokenizer src_text = [ "A wasp stung him and he had an allergic reaction.", "I love nature." ] model_name = "pytorch-models/opus-mt-tc-big-en-es" tokenizer = MarianTokenizer.from_pretrained(model_name) model = MarianMTModel.from_pretrained(model_name) translated = model.generate(**tokenizer(src_text, return_tensors="pt", padding=True)) for t in translated: print( tokenizer.decode(t, skip_special_tokens=True) ) # expected output: # Una avispa lo picó y tuvo una reacción alérgica. # Me encanta la naturaleza. ``` You can also use OPUS-MT models with the transformers pipelines, for example: ```python from transformers import pipeline pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-en-es") print(pipe("A wasp stung him and he had an allergic reaction.")) # expected output: Una avispa lo picó y tuvo una reacción alérgica. ``` ## Benchmarks * test set translations: [opusTCv20210807+bt_transformer-big_2022-03-13.test.txt](https://object.pouta.csc.fi/Tatoeba-MT-models/eng-spa/opusTCv20210807+bt_transformer-big_2022-03-13.test.txt) * test set scores: [opusTCv20210807+bt_transformer-big_2022-03-13.eval.txt](https://object.pouta.csc.fi/Tatoeba-MT-models/eng-spa/opusTCv20210807+bt_transformer-big_2022-03-13.eval.txt) * benchmark results: [benchmark_results.txt](benchmark_results.txt) * benchmark output: [benchmark_translations.zip](benchmark_translations.zip) | langpair | testset | chr-F | BLEU | #sent | #words | |----------|---------|-------|-------|-------|--------| | eng-spa | tatoeba-test-v2021-08-07 | 0.73863 | 57.2 | 16583 | 134710 | | eng-spa | flores101-devtest | 0.56440 | 28.5 | 1012 | 29199 | | eng-spa | newssyscomb2009 | 0.58415 | 31.5 | 502 | 12503 | | eng-spa | news-test2008 | 0.56707 | 30.1 | 2051 | 52586 | | eng-spa | newstest2009 | 0.57836 | 30.2 | 2525 | 68111 | | eng-spa | newstest2010 | 0.62357 | 37.6 | 2489 | 65480 | | eng-spa | newstest2011 | 0.62415 | 38.9 | 3003 | 79476 | | eng-spa | newstest2012 | 0.63031 | 39.5 | 3003 | 79006 | | eng-spa | newstest2013 | 0.60354 | 35.9 | 3000 | 70528 | | eng-spa | tico19-test | 0.73554 | 53.0 | 2100 | 66563 | ## Acknowledgements The work is supported by the [European Language Grid](https://www.european-language-grid.eu/) as [pilot project 2866](https://live.european-language-grid.eu/catalogue/#/resource/projects/2866), by the [FoTran project](https://www.helsinki.fi/en/researchgroups/natural-language-understanding-with-cross-lingual-grounding), funded by the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement No 771113), and the [MeMAD project](https://memad.eu/), funded by the European Union’s Horizon 2020 Research and Innovation Programme under grant agreement No 780069. We are also grateful for the generous computational resources and IT infrastructure provided by [CSC -- IT Center for Science](https://www.csc.fi/), Finland. ## Model conversion info * transformers version: 4.16.2 * OPUS-MT git hash: 3405783 * port time: Wed Apr 13 18:03:53 EEST 2022 * port machine: LM0-400-22516.local
shibing624/mengzi-t5-base-chinese-correction
091e91da1215be5f40ae8d2273a7fe0b93b5354f
2022-06-17T08:23:49.000Z
[ "pytorch", "t5", "text2text-generation", "zh", "transformers", "license:apache-2.0", "autotrain_compatible" ]
text2text-generation
false
shibing624
null
shibing624/mengzi-t5-base-chinese-correction
887
2
transformers
1,859
--- language: - zh tags: - t5 - pytorch - zh license: "apache-2.0" --- # T5 for Chinese Spelling Correction Model 中文拼写纠错模型 `shibing624/mengzi-t5-base-chinese-correction` evaluate SIGHAN2015 test data: - Sentence Level: precision:0.8321, recall:0.6390, f1:0.7229 训练使用的数据集为下方提供的“SIGHAN+Wang271K中文纠错数据集”,在SIGHAN2015的测试集上达到接近SOTA水平。 未改动模型结构,finetune中文纠错数据集,评估纠错效果很好,模型潜力巨大。 ## Usage 本项目开源在中文文本纠错项目:[pycorrector](https://github.com/shibing624/pycorrector),可支持t5模型,通过如下命令调用: ``` pip install -U pycorrector ``` run: ```python from pycorrector.t5.t5_corrector import T5Corrector nlp = T5Corrector("shibing624/mengzi-t5-base-chinese-correction").batch_t5_correct i = "今天新情很好" print(i, ' => ', nlp([i])) ``` output: ```shell 今天新情很好 => 今天心情很好 [('新', '心', 2, 3)] ``` 模型文件组成: ``` mengzi-t5-base-chinese-correction |-- config.json |-- pytorch_model.bin |-- special_tokens_map.json |-- spiece.model |-- tokenizer_config.json `-- tokenizer.json ``` 如果需要训练t5-correction,请参考[https://github.com/shibing624/pycorrector/tree/master/pycorrector/t5](https://github.com/shibing624/pycorrector/tree/master/pycorrector/t5) ### 训练数据集 #### SIGHAN+Wang271K中文纠错数据集 | 数据集 | 语料 | 下载链接 | 压缩包大小 | | :------- | :--------- | :---------: | :---------: | | **`SIGHAN+Wang271K中文纠错数据集`** | SIGHAN+Wang271K(27万条) | [百度网盘(密码01b9)](https://pan.baidu.com/s/1BV5tr9eONZCI0wERFvr0gQ)| 106M | | **`原始SIGHAN数据集`** | SIGHAN13 14 15 | [官方csc.html](http://nlp.ee.ncu.edu.tw/resource/csc.html)| 339K | | **`原始Wang271K数据集`** | Wang271K | [Automatic-Corpus-Generation dimmywang提供](https://github.com/wdimmy/Automatic-Corpus-Generation/blob/master/corpus/train.sgml)| 93M | SIGHAN+Wang271K中文纠错数据集,数据格式: ```json [ { "id": "B2-4029-3", "original_text": "晚间会听到嗓音,白天的时候大家都不会太在意,但是在睡觉的时候这嗓音成为大家的恶梦。", "wrong_ids": [ 5, 31 ], "correct_text": "晚间会听到噪音,白天的时候大家都不会太在意,但是在睡觉的时候这噪音成为大家的恶梦。" }, ] ``` ## Citation ```latex @software{pycorrector, author = {Xu Ming}, title = {pycorrector: Text Error Correction Tool}, year = {2021}, url = {https://github.com/shibing624/pycorrector}, } ```
moha/arabert_c19
eab96c316448fe535686332e35be64949f6ab7d7
2021-05-19T23:35:40.000Z
[ "pytorch", "jax", "bert", "fill-mask", "ar", "arxiv:2105.03143", "arxiv:2004.04315", "transformers", "autotrain_compatible" ]
fill-mask
false
moha
null
moha/arabert_c19
885
null
transformers
1,860
--- language: ar widget: - text: "لكي نتجنب فيروس [MASK]" --- # arabert_c19: An Arabert model pretrained on 1.5 million COVID-19 multi-dialect Arabic tweets **ARABERT COVID-19** [Arxiv URL](https://arxiv.org/pdf/2105.03143.pdf) is a pretrained (fine-tuned) version of the AraBERT v2 model (https://huggingface.co/aubmindlab/bert-base-arabertv02). The pretraining was done using 1.5 million multi-dialect Arabic tweets regarding the COVID-19 pandemic from the “Large Arabic Twitter Dataset on COVID-19” (https://arxiv.org/abs/2004.04315). The model can achieve better results for the tasks that deal with multi-dialect Arabic tweets in relation to the COVID-19 pandemic. # Classification results for multiple tasks including fake-news and hate speech detection when using arabert_c19 and mbert_ar_c19: For more details refer to the paper (link) | | arabert | mbert | distilbert multi | arabert Covid-19 | mbert Covid-19 | |------------------------------------|----------|----------|------------------|------------------|----------------| | Contains hate (Binary) | 0.8346 | 0.6675 | 0.7145 | `0.8649` | 0.8492 | | Talk about a cure (Binary) | 0.8193 | 0.7406 | 0.7127 | 0.9055 | `0.9176` | | News or opinion (Binary) | 0.8987 | 0.8332 | 0.8099 | `0.9163` | 0.9116 | | Contains fake information (Binary) | 0.6415 | 0.5428 | 0.4743 | `0.7739` | 0.7228 | # Preprocessing ```python from arabert.preprocess import ArabertPreprocessor model_name="moha/arabert_c19" arabert_prep = ArabertPreprocessor(model_name=model_name) text = "للوقايه من عدم انتشار كورونا عليك اولا غسل اليدين بالماء والصابون وتكون عملية الغسل دقيقه تشمل راحة اليد الأصابع التركيز على الإبهام" arabert_prep.preprocess(text) ``` # Citation Please cite as: ``` bibtex @misc{ameur2021aracovid19mfh, title={AraCOVID19-MFH: Arabic COVID-19 Multi-label Fake News and Hate Speech Detection Dataset}, author={Mohamed Seghir Hadj Ameur and Hassina Aliane}, year={2021}, eprint={2105.03143}, archivePrefix={arXiv}, primaryClass={cs.CL} } ``` # Contacts **Hadj Ameur**: [Github](https://github.com/MohamedHadjAmeur) | <[email protected]> | <[email protected]>
PlanTL-GOB-ES/roberta-base-biomedical-es
d672dee3226a354e0f9e5c11369fad6b6cb1f522
2022-04-08T14:10:27.000Z
[ "pytorch", "roberta", "fill-mask", "es", "arxiv:2109.03570", "arxiv:2109.07765", "transformers", "biomedical", "spanish", "license:apache-2.0", "autotrain_compatible" ]
fill-mask
false
PlanTL-GOB-ES
null
PlanTL-GOB-ES/roberta-base-biomedical-es
884
1
transformers
1,861
--- language: - es tags: - biomedical - spanish license: apache-2.0 metrics: - ppl widget: - text: "El único antecedente personal a reseñar era la <mask> arterial." - text: "Las radiologías óseas de cuerpo entero no detectan alteraciones <mask>, ni alteraciones vertebrales." - text: "En el <mask> toraco-abdómino-pélvico no se encontraron hallazgos patológicos de interés." --- # Biomedical language model for Spanish Biomedical pretrained language model for Spanish. For more details about the corpus, the pretraining and the evaluation, check the official [repository](https://github.com/PlanTL-SANIDAD/lm-biomedical-clinical-es) and read our [preprint](https://arxiv.org/abs/2109.03570) "_Carrino, C. P., Armengol-Estapé, J., Gutiérrez-Fandiño, A., Llop-Palao, J., Pàmies, M., Gonzalez-Agirre, A., & Villegas, M. (2021). Biomedical and Clinical Language Models for Spanish: On the Benefits of Domain-Specific Pretraining in a Mid-Resource Scenario._". ## Tokenization and model pretraining This model is a [RoBERTa-based](https://github.com/pytorch/fairseq/tree/master/examples/roberta) model trained on a **biomedical** corpus in Spanish collected from several sources (see next section). The training corpus has been tokenized using a byte version of [Byte-Pair Encoding (BPE)](https://github.com/openai/gpt-2) used in the original [RoBERTA](https://github.com/pytorch/fairseq/tree/master/examples/roberta) model with a vocabulary size of 52,000 tokens. The pretraining consists of a masked language model training at the subword level following the approach employed for the RoBERTa base model with the same hyperparameters as in the original work. The training lasted a total of 48 hours with 16 NVIDIA V100 GPUs of 16GB DDRAM, using Adam optimizer with a peak learning rate of 0.0005 and an effective batch size of 2,048 sentences. ## Training corpora and preprocessing The training corpus is composed of several biomedical corpora in Spanish, collected from publicly available corpora and crawlers. To obtain a high-quality training corpus, a cleaning pipeline with the following operations has been applied: - data parsing in different formats - sentence splitting - language detection - filtering of ill-formed sentences - deduplication of repetitive contents - keep the original document boundaries Finally, the corpora are concatenated and further global deduplication among the corpora have been applied. The result is a medium-size biomedical corpus for Spanish composed of about 963M tokens. The table below shows some basic statistics of the individual cleaned corpora: | Name | No. tokens | Description | |-----------------------------------------------------------------------------------------|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Medical crawler](https://zenodo.org/record/4561970) | 745,705,946 | Crawler of more than 3,000 URLs belonging to Spanish biomedical and health domains. | | Clinical cases misc. | 102,855,267 | A miscellany of medical content, essentially clinical cases. Note that a clinical case report is a scientific publication where medical practitioners share patient cases and it is different from a clinical note or document. | | [Scielo](https://github.com/PlanTL-SANIDAD/SciELO-Spain-Crawler) | 60,007,289 | Publications written in Spanish crawled from the Spanish SciELO server in 2017. | | [BARR2_background](https://temu.bsc.es/BARR2/downloads/background_set.raw_text.tar.bz2) | 24,516,442 | Biomedical Abbreviation Recognition and Resolution (BARR2) containing Spanish clinical case study sections from a variety of clinical disciplines. | | Wikipedia_life_sciences | 13,890,501 | Wikipedia articles crawled 04/01/2021 with the [Wikipedia API python library](https://pypi.org/project/Wikipedia-API/) starting from the "Ciencias\_de\_la\_vida" category up to a maximum of 5 subcategories. Multiple links to the same articles are then discarded to avoid repeating content. | | Patents | 13,463,387 | Google Patent in Medical Domain for Spain (Spanish). The accepted codes (Medical Domain) for Json files of patents are: "A61B", "A61C","A61F", "A61H", "A61K", "A61L","A61M", "A61B", "A61P". | | [EMEA](http://opus.nlpl.eu/download.php?f=EMEA/v3/moses/en-es.txt.zip) | 5,377,448 | Spanish-side documents extracted from parallel corpora made out of PDF documents from the European Medicines Agency. | | [mespen_Medline](https://zenodo.org/record/3562536#.YTt1fH2xXbR) | 4,166,077 | Spanish-side articles extracted from a collection of Spanish-English parallel corpus consisting of biomedical scientific literature. The collection of parallel resources are aggregated from the MedlinePlus source. | | PubMed | 1,858,966 | Open-access articles from the PubMed repository crawled in 2017. | ## Evaluation and results The model has been evaluated on the Named Entity Recognition (NER) using the following datasets: - [PharmaCoNER](https://zenodo.org/record/4270158): is a track on chemical and drug mention recognition from Spanish medical texts (for more info see: https://temu.bsc.es/pharmaconer/). - [CANTEMIST](https://zenodo.org/record/3978041#.YTt5qH2xXbQ): is a shared task specifically focusing on named entity recognition of tumor morphology, in Spanish (for more info see: https://zenodo.org/record/3978041#.YTt5qH2xXbQ). - ICTUSnet: consists of 1,006 hospital discharge reports of patients admitted for stroke from 18 different Spanish hospitals. It contains more than 79,000 annotations for 51 different kinds of variables. The evaluation results are compared against the [mBERT](https://huggingface.co/bert-base-multilingual-cased) and [BETO](https://huggingface.co/dccuchile/bert-base-spanish-wwm-cased) models: | F1 - Precision - Recall | roberta-base-biomedical-es | mBERT | BETO | |---------------------------|----------------------------|-------------------------------|-------------------------| | PharmaCoNER | **89.48** - **87.85** - **91.18** | 87.46 - 86.50 - 88.46 | 88.18 - 87.12 - 89.28 | | CANTEMIST | **83.87** - **81.70** - **86.17** | 82.61 - 81.12 - 84.15 | 82.42 - 80.91 - 84.00 | | ICTUSnet | **88.12** - **85.56** - **90.83** | 86.75 - 83.53 - 90.23 | 85.95 - 83.10 - 89.02 | ## Intended uses & limitations The model is ready-to-use only for masked language modelling to perform the Fill Mask task (try the inference API or read the next section) However, the is intended to be fine-tuned on downstream tasks such as Named Entity Recognition or Text Classification. ## Cite If you use our models, please cite our latest preprint: ```bibtex @misc{carrino2021biomedical, title={Biomedical and Clinical Language Models for Spanish: On the Benefits of Domain-Specific Pretraining in a Mid-Resource Scenario}, author={Casimiro Pio Carrino and Jordi Armengol-Estapé and Asier Gutiérrez-Fandiño and Joan Llop-Palao and Marc Pàmies and Aitor Gonzalez-Agirre and Marta Villegas}, year={2021}, eprint={2109.03570}, archivePrefix={arXiv}, primaryClass={cs.CL} } ``` If you use our Medical Crawler corpus, please cite the preprint: ```bibtex @misc{carrino2021spanish, title={Spanish Biomedical Crawled Corpus: A Large, Diverse Dataset for Spanish Biomedical Language Models}, author={Casimiro Pio Carrino and Jordi Armengol-Estapé and Ona de Gibert Bonet and Asier Gutiérrez-Fandiño and Aitor Gonzalez-Agirre and Martin Krallinger and Marta Villegas}, year={2021}, eprint={2109.07765}, archivePrefix={arXiv}, primaryClass={cs.CL} } ``` --- ## How to use ```python from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("BSC-TeMU/roberta-base-biomedical-es") model = AutoModelForMaskedLM.from_pretrained("BSC-TeMU/roberta-base-biomedical-es") from transformers import pipeline unmasker = pipeline('fill-mask', model="BSC-TeMU/roberta-base-biomedical-es") unmasker("El único antecedente personal a reseñar era la <mask> arterial.") ``` ``` # Output [ { "sequence": " El único antecedente personal a reseñar era la hipertensión arterial.", "score": 0.9855039715766907, "token": 3529, "token_str": " hipertensión" }, { "sequence": " El único antecedente personal a reseñar era la diabetes arterial.", "score": 0.0039140828885138035, "token": 1945, "token_str": " diabetes" }, { "sequence": " El único antecedente personal a reseñar era la hipotensión arterial.", "score": 0.002484665485098958, "token": 11483, "token_str": " hipotensión" }, { "sequence": " El único antecedente personal a reseñar era la Hipertensión arterial.", "score": 0.0023484621196985245, "token": 12238, "token_str": " Hipertensión" }, { "sequence": " El único antecedente personal a reseñar era la presión arterial.", "score": 0.0008009297889657319, "token": 2267, "token_str": " presión" } ] ```
twigs/bart-text2text-simplifier
f2071131fa949dda7dbc24734c13443efaa51da3
2022-07-18T21:21:06.000Z
[ "pytorch", "bart", "text2text-generation", "transformers", "autotrain_compatible" ]
text2text-generation
false
twigs
null
twigs/bart-text2text-simplifier
884
null
transformers
1,862
Entry not found
johngiorgi/declutr-sci-base
34a174c9f34455c1f2705060742d46785ee2de02
2022-03-11T14:47:33.000Z
[ "pytorch", "jax", "bert", "fill-mask", "arxiv:2006.03659", "transformers", "autotrain_compatible" ]
fill-mask
false
johngiorgi
null
johngiorgi/declutr-sci-base
882
3
transformers
1,863
# DeCLUTR-sci-base ## Model description This is the [allenai/scibert_scivocab_uncased](https://huggingface.co/allenai/scibert_scivocab_uncased) model, with extended pretraining on over 2 million scientific papers from [S2ORC](https://github.com/allenai/s2orc/) using the self-supervised training strategy presented in [DeCLUTR: Deep Contrastive Learning for Unsupervised Textual Representations](https://arxiv.org/abs/2006.03659). ## Intended uses & limitations The model is intended to be used as a sentence encoder, similar to [Google's Universal Sentence Encoder](https://tfhub.dev/google/universal-sentence-encoder/4) or [Sentence Transformers](https://github.com/UKPLab/sentence-transformers). It is particularly suitable for scientific text. #### How to use Please see [our repo](https://github.com/JohnGiorgi/DeCLUTR) for full details. A simple example is shown below. ##### With [SentenceTransformers](https://www.sbert.net/) ```python from scipy.spatial.distance import cosine from sentence_transformers import SentenceTransformer # Load the model model = SentenceTransformer("johngiorgi/declutr-sci-base") # Prepare some text to embed text = [ "Oncogenic KRAS mutations are common in cancer.", "Notably, c-Raf has recently been found essential for development of K-Ras-driven NSCLCs.", ] # Embed the text embeddings = model.encode(texts) # Compute a semantic similarity via the cosine distance semantic_sim = 1 - cosine(embeddings[0], embeddings[1]) ``` ##### With 🤗 Transformers ```python import torch from scipy.spatial.distance import cosine from transformers import AutoModel, AutoTokenizer # Load the model tokenizer = AutoTokenizer.from_pretrained("johngiorgi/declutr-sci-base") model = AutoModel.from_pretrained("johngiorgi/declutr-sci-base") # Prepare some text to embed text = [ "Oncogenic KRAS mutations are common in cancer.", "Notably, c-Raf has recently been found essential for development of K-Ras-driven NSCLCs.", ] inputs = tokenizer(text, padding=True, truncation=True, return_tensors="pt") # Embed the text with torch.no_grad(): sequence_output = model(**inputs)[0] # Mean pool the token-level embeddings to get sentence-level embeddings embeddings = torch.sum( sequence_output * inputs["attention_mask"].unsqueeze(-1), dim=1 ) / torch.clamp(torch.sum(inputs["attention_mask"], dim=1, keepdims=True), min=1e-9) # Compute a semantic similarity via the cosine distance semantic_sim = 1 - cosine(embeddings[0], embeddings[1]) ``` ### BibTeX entry and citation info ```bibtex @article{Giorgi2020DeCLUTRDC, title={DeCLUTR: Deep Contrastive Learning for Unsupervised Textual Representations}, author={John M Giorgi and Osvald Nitski and Gary D. Bader and Bo Wang}, journal={ArXiv}, year={2020}, volume={abs/2006.03659} } ```
Artem1/grammar_error_correcter_v1
376d3055b766ba13f6fc92152d6b5a25dd2f11e7
2022-07-14T18:54:45.000Z
[ "pytorch", "t5", "text2text-generation", "transformers", "autotrain_compatible" ]
text2text-generation
false
Artem1
null
Artem1/grammar_error_correcter_v1
882
null
transformers
1,864
Entry not found
hfl/chinese-electra-base-discriminator
44c5a47c42df39b11e9841ed602b2d49cdddd1af
2021-03-03T01:40:07.000Z
[ "pytorch", "tf", "electra", "zh", "arxiv:2004.13922", "transformers", "license:apache-2.0" ]
null
false
hfl
null
hfl/chinese-electra-base-discriminator
879
2
transformers
1,865
--- language: - zh license: "apache-2.0" --- **Please use `ElectraForPreTraining` for `discriminator` and `ElectraForMaskedLM` for `generator` if you are re-training these models.** ## Chinese ELECTRA Google and Stanford University released a new pre-trained model called ELECTRA, which has a much compact model size and relatively competitive performance compared to BERT and its variants. For further accelerating the research of the Chinese pre-trained model, the Joint Laboratory of HIT and iFLYTEK Research (HFL) has released the Chinese ELECTRA models based on the official code of ELECTRA. ELECTRA-small could reach similar or even higher scores on several NLP tasks with only 1/10 parameters compared to BERT and its variants. This project is based on the official code of ELECTRA: [https://github.com/google-research/electra](https://github.com/google-research/electra) You may also interested in, - Chinese BERT series: https://github.com/ymcui/Chinese-BERT-wwm - Chinese ELECTRA: https://github.com/ymcui/Chinese-ELECTRA - Chinese XLNet: https://github.com/ymcui/Chinese-XLNet - Knowledge Distillation Toolkit - TextBrewer: https://github.com/airaria/TextBrewer More resources by HFL: https://github.com/ymcui/HFL-Anthology ## Citation If you find our resource or paper is useful, please consider including the following citation in your paper. - https://arxiv.org/abs/2004.13922 ``` @inproceedings{cui-etal-2020-revisiting, title = "Revisiting Pre-Trained Models for {C}hinese Natural Language Processing", author = "Cui, Yiming and Che, Wanxiang and Liu, Ting and Qin, Bing and Wang, Shijin and Hu, Guoping", booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: Findings", month = nov, year = "2020", address = "Online", publisher = "Association for Computational Linguistics", url = "https://www.aclweb.org/anthology/2020.findings-emnlp.58", pages = "657--668", } ```
monologg/koelectra-base-v3-hate-speech
8938df1530df593b9fce6926d1ff963ad07d23a3
2020-12-31T12:56:18.000Z
[ "pytorch", "electra", "text-classification", "transformers" ]
text-classification
false
monologg
null
monologg/koelectra-base-v3-hate-speech
876
2
transformers
1,866
Entry not found
fnlp/cpt-large
d3df73c7677993da4e871d9fcb1239469e52127c
2022-07-18T08:01:01.000Z
[ "pytorch", "bart", "feature-extraction", "zh", "arxiv:2109.05729", "transformers", "fill-mask", "text2text-generation", "text-classification", "Summarization", "Chinese", "CPT", "BART", "BERT", "seq2seq" ]
text-classification
false
fnlp
null
fnlp/cpt-large
875
7
transformers
1,867
--- tags: - fill-mask - text2text-generation - fill-mask - text-classification - Summarization - Chinese - CPT - BART - BERT - seq2seq language: zh --- # Chinese CPT-Large ## Model description This is an implementation of CPT-Large. To use CPT, please import the file `modeling_cpt.py` (**Download** [Here](https://github.com/fastnlp/CPT/blob/master/finetune/modeling_cpt.py)) that define the architecture of CPT into your project. [**CPT: A Pre-Trained Unbalanced Transformer for Both Chinese Language Understanding and Generation**](https://arxiv.org/pdf/2109.05729.pdf) Yunfan Shao, Zhichao Geng, Yitao Liu, Junqi Dai, Fei Yang, Li Zhe, Hujun Bao, Xipeng Qiu **Github Link:** https://github.com/fastnlp/CPT ## Usage ```python >>> from modeling_cpt import CPTForConditionalGeneration >>> from transformers import BertTokenizer >>> tokenizer = BertTokenizer.from_pretrained("fnlp/cpt-large") >>> model = CPTForConditionalGeneration.from_pretrained("fnlp/cpt-large") >>> input_ids = tokenizer.encode("北京是[MASK]的首都", return_tensors='pt') >>> pred_ids = model.generate(input_ids, num_beams=4, max_length=20) >>> print(tokenizer.convert_ids_to_tokens(pred_ids[0])) ['[SEP]', '[CLS]', '北', '京', '是', '中', '国', '的', '首', '都', '[SEP]'] ``` **Note: Please use BertTokenizer for the model vocabulary. DO NOT use original BartTokenizer.** ## Citation ```bibtex @article{shao2021cpt, title={CPT: A Pre-Trained Unbalanced Transformer for Both Chinese Language Understanding and Generation}, author={Yunfan Shao and Zhichao Geng and Yitao Liu and Junqi Dai and Fei Yang and Li Zhe and Hujun Bao and Xipeng Qiu}, journal={arXiv preprint arXiv:2109.05729}, year={2021} } ```
leo123/BERT-Preguntas-Respuestas-Posgrados
b4e6cabe7b6b1abd9374b01283b24592c749a068
2022-07-14T23:20:25.000Z
[ "pytorch", "bert", "question-answering", "transformers", "license:apache-2.0", "autotrain_compatible" ]
question-answering
false
leo123
null
leo123/BERT-Preguntas-Respuestas-Posgrados
875
null
transformers
1,868
--- license: apache-2.0 ---
anas-awadalla/bert-tiny-finetuned-squad
a40bd3413dd077c303653a88626b66b73de0ee04
2022-05-21T08:11:40.000Z
[ "pytorch", "tensorboard", "bert", "question-answering", "dataset:squad", "transformers", "generated_from_trainer", "license:mit", "model-index", "autotrain_compatible" ]
question-answering
false
anas-awadalla
null
anas-awadalla/bert-tiny-finetuned-squad
874
null
transformers
1,869
--- license: mit tags: - generated_from_trainer datasets: - squad model-index: - name: bert-tiny-finetuned-squad results: [] --- <!-- This model card has been generated automatically according to the information the Trainer had access to. You should probably proofread and complete it, then remove this comment. --> # bert-tiny-finetuned-squad This model is a fine-tuned version of [prajjwal1/bert-tiny](https://huggingface.co/prajjwal1/bert-tiny) on the squad dataset. ## Model description More information needed ## Intended uses & limitations More information needed ## Training and evaluation data More information needed ## Training procedure ### Training hyperparameters The following hyperparameters were used during training: - learning_rate: 3e-05 - train_batch_size: 64 - eval_batch_size: 8 - seed: 42 - distributed_type: multi-GPU - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 - lr_scheduler_type: linear - num_epochs: 2.0 ### Training results ### Framework versions - Transformers 4.17.0 - Pytorch 1.11.0+cu113 - Datasets 2.0.0 - Tokenizers 0.11.6
shibing624/code-autocomplete-distilgpt2-python
4a0986fce0baf2b583080207b8539d3fa62002d7
2022-02-15T07:18:50.000Z
[ "pytorch", "gpt2", "text-generation", "en", "transformers", "code", "autocomplete", "license:apache-2.0" ]
text-generation
false
shibing624
null
shibing624/code-autocomplete-distilgpt2-python
874
7
transformers
1,870
--- language: - en tags: - code - autocomplete - pytorch - en license: "apache-2.0" --- # GPT2 for Code AutoComplete Model code-autocomplete, a code completion plugin for Python. **code-autocomplete** can automatically complete the code of lines and blocks with GPT2. ## Usage Open source repo:[code-autocomplete](https://github.com/shibing624/code-autocomplete),support GPT2 model, usage: ```python from autocomplete.gpt2_coder import GPT2Coder m = GPT2Coder("shibing624/code-autocomplete-distilgpt2-python") print(m.generate('import torch.nn as')[0]) ``` Also, use huggingface/transformers: *Please use 'GPT2' related functions to load this model!* ```python import os from transformers import GPT2Tokenizer, GPT2LMHeadModel os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE" tokenizer = GPT2Tokenizer.from_pretrained("shibing624/code-autocomplete-distilgpt2-python") model = GPT2LMHeadModel.from_pretrained("shibing624/code-autocomplete-distilgpt2-python") prompts = [ """from torch import nn class LSTM(Module): def __init__(self, *, n_tokens: int, embedding_size: int, hidden_size: int, n_layers: int):""", """import numpy as np import torch import torch.nn as""", "import java.util.ArrayList", "def factorial(n):", ] for prompt in prompts: input_ids = tokenizer.encode(prompt, add_special_tokens=False, return_tensors='pt') outputs = model.generate(input_ids=input_ids, max_length=64 + len(prompt), temperature=1.0, top_k=50, top_p=0.95, repetition_penalty=1.0, do_sample=True, num_return_sequences=1, length_penalty=2.0, early_stopping=True) decoded = tokenizer.decode(outputs[0], skip_special_tokens=True) print(decoded) print("=" * 20) ``` output: ```shell from torch import nn class LSTM(Module): def __init__(self, *, n_tokens: int, embedding_size: int, hidden_size: int, n_layers: int): self.embedding_size = embedding_size ==================== import numpy as np import torch import torch.nn as nn import torch.nn.functional as F ``` Model files: ``` code-autocomplete-distilgpt2-python ├── config.json ├── merges.txt ├── pytorch_model.bin ├── special_tokens_map.json ├── tokenizer_config.json └── vocab.json ``` ### Train data #### pytorch_awesome projects source code download [code-autocomplete](https://github.com/shibing624/code-autocomplete), ```shell cd autocomplete python create_dataset.py ``` If you want train code-autocomplete GPT2 model,refer [https://github.com/shibing624/code-autocomplete/blob/main/autocomplete/gpt2_coder.py](https://github.com/shibing624/code-autocomplete/blob/main/autocomplete/gpt2_coder.py) ### About GPT2 Test the whole generation capabilities here: https://transformer.huggingface.co/doc/gpt2-large Pretrained model on English language using a causal language modeling (CLM) objective. It was introduced in [this paper](https://d4mucfpksywv.cloudfront.net/better-language-models/language_models_are_unsupervised_multitask_learners.pdf) and first released at [this page](https://openai.com/blog/better-language-models/). Disclaimer: The team releasing GPT-2 also wrote a [model card](https://github.com/openai/gpt-2/blob/master/model_card.md) for their model. Content from this model card has been written by the Hugging Face team to complete the information they provided and give specific examples of bias. ## Citation ```latex @misc{code-autocomplete, author = {Xu Ming}, title = {code-autocomplete: Code AutoComplete with GPT model}, year = {2022}, publisher = {GitHub}, journal = {GitHub repository}, url = {https://github.com/shibing624/code-autocomplete}, } ```
squeezebert/squeezebert-mnli-headless
d90683f6cb548ca6019ce3366d03f8652d836b7e
2020-12-11T22:02:10.000Z
[ "pytorch", "squeezebert", "arxiv:2006.11316", "arxiv:1904.00962", "transformers" ]
null
false
squeezebert
null
squeezebert/squeezebert-mnli-headless
874
null
transformers
1,871
language: en license: bsd datasets: - bookcorpus - wikipedia --- # SqueezeBERT pretrained model This model, `squeezebert-mnli-headless`, has been pretrained for the English language using a masked language modeling (MLM) and Sentence Order Prediction (SOP) objective and finetuned on the [Multi-Genre Natural Language Inference (MNLI)](https://cims.nyu.edu/~sbowman/multinli/) dataset. This is a "headless" model with the final classification layer removed, and this will allow Transformers to automatically reinitialize the final classification layer before you begin finetuning on your data. SqueezeBERT was introduced in [this paper](https://arxiv.org/abs/2006.11316). This model is case-insensitive. The model architecture is similar to BERT-base, but with the pointwise fully-connected layers replaced with [grouped convolutions](https://blog.yani.io/filter-group-tutorial/). The authors found that SqueezeBERT is 4.3x faster than `bert-base-uncased` on a Google Pixel 3 smartphone. ## Pretraining ### Pretraining data - [BookCorpus](https://yknzhu.wixsite.com/mbweb), a dataset consisting of thousands of unpublished books - [English Wikipedia](https://en.wikipedia.org/wiki/English_Wikipedia) ### Pretraining procedure The model is pretrained using the Masked Language Model (MLM) and Sentence Order Prediction (SOP) tasks. (Author's note: If you decide to pretrain your own model, and you prefer to train with MLM only, that should work too.) From the SqueezeBERT paper: > We pretrain SqueezeBERT from scratch (without distillation) using the [LAMB](https://arxiv.org/abs/1904.00962) optimizer, and we employ the hyperparameters recommended by the LAMB authors: a global batch size of 8192, a learning rate of 2.5e-3, and a warmup proportion of 0.28. Following the LAMB paper's recommendations, we pretrain for 56k steps with a maximum sequence length of 128 and then for 6k steps with a maximum sequence length of 512. ## Finetuning The SqueezeBERT paper presents 2 approaches to finetuning the model: - "finetuning without bells and whistles" -- after pretraining the SqueezeBERT model, finetune it on each GLUE task - "finetuning with bells and whistles" -- after pretraining the SqueezeBERT model, finetune it on a MNLI with distillation from a teacher model. Then, use the MNLI-finetuned SqueezeBERT model as a student model to finetune on each of the other GLUE tasks (e.g. RTE, MRPC, …) with distillation from a task-specific teacher model. A detailed discussion of the hyperparameters used for finetuning is provided in the appendix of the [SqueezeBERT paper](https://arxiv.org/abs/2006.11316). Note that finetuning SqueezeBERT with distillation is not yet implemented in this repo. If the author (Forrest Iandola - [email protected]) gets enough encouragement from the user community, he will add example code to Transformers for finetuning SqueezeBERT with distillation. This model, `squeezebert/squeezebert-mnli-headless`, is the "finetuned with bells and whistles" MNLI-finetuned SqueezeBERT model. In this particular model, we have removed the final classification layer -- in other words, it is "headless." We recommend using this model if you intend to finetune the model on your own data. Using this model means that your final layer will automatically be reinitialized when you start finetuning on your data. ### How to finetune To try finetuning SqueezeBERT on the [MRPC](https://www.microsoft.com/en-us/download/details.aspx?id=52398) text classification task, you can run the following command: ``` ./utils/download_glue_data.py python examples/text-classification/run_glue.py \ --model_name_or_path squeezebert-base-headless \ --task_name mrpc \ --data_dir ./glue_data/MRPC \ --output_dir ./models/squeezebert_mrpc \ --overwrite_output_dir \ --do_train \ --do_eval \ --num_train_epochs 10 \ --learning_rate 3e-05 \ --per_device_train_batch_size 16 \ --save_steps 20000 ``` ## BibTeX entry and citation info ``` @article{2020_SqueezeBERT, author = {Forrest N. Iandola and Albert E. Shaw and Ravi Krishna and Kurt W. Keutzer}, title = {{SqueezeBERT}: What can computer vision teach NLP about efficient neural networks?}, journal = {arXiv:2006.11316}, year = {2020} } ```
akhooli/gpt2-small-arabic-poetry
7c384f4f774a83aae4c66251050528c4b33b36d3
2021-08-07T08:06:39.000Z
[ "pytorch", "jax", "gpt2", "text-generation", "ar", "dataset:Arabic poetry from several eras", "transformers" ]
text-generation
false
akhooli
null
akhooli/gpt2-small-arabic-poetry
873
3
transformers
1,872
--- language: "ar" tags: - text-generation datasets: - Arabic poetry from several eras --- # GPT2-Small-Arabic-Poetry ## Model description Fine-tuned model of Arabic poetry dataset based on gpt2-small-arabic. ## Intended uses & limitations #### How to use An example is provided in this [colab notebook](https://colab.research.google.com/drive/1mRl7c-5v-Klx27EEAEOAbrfkustL4g7a?usp=sharing). #### Limitations and bias Both the GPT2-small-arabic (trained on Arabic Wikipedia) and this model have several limitations in terms of coverage and training performance. Use them as demonstrations or proof of concepts but not as production code. ## Training data This pretrained model used the [Arabic Poetry dataset](https://www.kaggle.com/ahmedabelal/arabic-poetry) from 9 different eras with a total of around 40k poems. The dataset was trained (fine-tuned) based on the [gpt2-small-arabic](https://huggingface.co/akhooli/gpt2-small-arabic) transformer model. ## Training procedure Training was done using [Simple Transformers](https://github.com/ThilinaRajapakse/simpletransformers) library on Kaggle, using free GPU. ## Eval results Final perplexity reached ws 76.3, loss: 4.33 ### BibTeX entry and citation info ```bibtex @inproceedings{Abed Khooli, year={2020} } ```
nboost/pt-bert-large-msmarco
654bca99ecec6faf688b274cb9c99333e9251c3f
2021-05-20T01:25:29.000Z
[ "pytorch", "jax", "onnx", "bert", "transformers" ]
null
false
nboost
null
nboost/pt-bert-large-msmarco
873
1
transformers
1,873
Entry not found
MaryaAI/opus-mt-ar-en-finetuned-ar-to-en
bc61a529dce1ad153ed501e41997e97d44b24262
2021-09-07T07:26:24.000Z
[ "pytorch", "tensorboard", "marian", "text2text-generation", "dataset:opus_wikipedia", "transformers", "generated_from_trainer", "model-index", "autotrain_compatible" ]
text2text-generation
false
MaryaAI
null
MaryaAI/opus-mt-ar-en-finetuned-ar-to-en
872
null
transformers
1,874
--- tags: - generated_from_trainer datasets: - opus_wikipedia model-index: - name: opus-mt-ar-en-finetuned-ar-to-en results: - task: name: Sequence-to-sequence Language Modeling type: text2text-generation dataset: name: opus_wikipedia type: opus_wikipedia args: ar-en --- <!-- This model card has been generated automatically according to the information the Trainer had access to. You should probably proofread and complete it, then remove this comment. --> # opus-mt-ar-en-finetuned-ar-to-en This model is a fine-tuned version of [Helsinki-NLP/opus-mt-ar-en](https://huggingface.co/Helsinki-NLP/opus-mt-ar-en) on the opus_wikipedia dataset. ## Model description More information needed ## Intended uses & limitations More information needed ## Training and evaluation data More information needed ## Training procedure ### Training hyperparameters The following hyperparameters were used during training: - learning_rate: 2e-05 - train_batch_size: 16 - eval_batch_size: 16 - seed: 42 - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 - lr_scheduler_type: linear - num_epochs: 1 - mixed_precision_training: Native AMP ### Framework versions - Transformers 4.10.0 - Pytorch 1.9.0+cu102 - Datasets 1.11.0 - Tokenizers 0.10.3
microsoft/tapex-base
968109c940c8b270a3eaec1532d596ba6c923b6a
2022-05-17T08:25:49.000Z
[ "pytorch", "bart", "text2text-generation", "en", "arxiv:2107.07653", "transformers", "tapex", "table-question-answering", "license:mit", "autotrain_compatible" ]
table-question-answering
false
microsoft
null
microsoft/tapex-base
871
4
transformers
1,875
--- language: en tags: - tapex - table-question-answering license: mit --- # TAPEX (base-sized model) TAPEX was proposed in [TAPEX: Table Pre-training via Learning a Neural SQL Executor](https://arxiv.org/abs/2107.07653) by Qian Liu, Bei Chen, Jiaqi Guo, Morteza Ziyadi, Zeqi Lin, Weizhu Chen, Jian-Guang Lou. The original repo can be found [here](https://github.com/microsoft/Table-Pretraining). ## Model description TAPEX (**Ta**ble **P**re-training via **Ex**ecution) is a conceptually simple and empirically powerful pre-training approach to empower existing models with *table reasoning* skills. TAPEX realizes table pre-training by learning a neural SQL executor over a synthetic corpus, which is obtained by automatically synthesizing executable SQL queries. TAPEX is based on the BART architecture, the transformer encoder-encoder (seq2seq) model with a bidirectional (BERT-like) encoder and an autoregressive (GPT-like) decoder. ## Intended Uses You can use the raw model for simulating neural SQL execution, i.e., employ TAPEX to execute a SQL query on a given table. However, the model is mostly meant to be fine-tuned on a supervised dataset. Currently TAPEX can be fine-tuned to tackle table question answering tasks and table fact verification tasks. See the [model hub](https://huggingface.co/models?search=tapex) to look for fine-tuned versions on a task that interests you. ### How to Use Here is how to use this model in transformers: ```python from transformers import TapexTokenizer, BartForConditionalGeneration import pandas as pd tokenizer = TapexTokenizer.from_pretrained("microsoft/tapex-base") model = BartForConditionalGeneration.from_pretrained("microsoft/tapex-base") data = { "year": [1896, 1900, 1904, 2004, 2008, 2012], "city": ["athens", "paris", "st. louis", "athens", "beijing", "london"] } table = pd.DataFrame.from_dict(data) # tapex accepts uncased input since it is pre-trained on the uncased corpus query = "select year where city = beijing" encoding = tokenizer(table=table, query=query, return_tensors="pt") outputs = model.generate(**encoding) print(tokenizer.batch_decode(outputs, skip_special_tokens=True)) # ['2008'] ``` ### How to Fine-tuning Please find the fine-tuning script [here](https://github.com/SivilTaram/transformers/tree/add_tapex_bis/examples/research_projects/tapex). ### BibTeX entry and citation info ```bibtex @inproceedings{ liu2022tapex, title={{TAPEX}: Table Pre-training via Learning a Neural {SQL} Executor}, author={Qian Liu and Bei Chen and Jiaqi Guo and Morteza Ziyadi and Zeqi Lin and Weizhu Chen and Jian-Guang Lou}, booktitle={International Conference on Learning Representations}, year={2022}, url={https://openreview.net/forum?id=O50443AsCP} } ```
google/realm-cc-news-pretrained-scorer
a009929c7c945e823f1e0c4ee0ea3c737606a6de
2022-01-06T06:23:03.000Z
[ "pytorch", "realm", "en", "transformers", "license:apache-2.0" ]
null
false
google
null
google/realm-cc-news-pretrained-scorer
868
null
transformers
1,876
--- language: en license: apache-2.0 --- # realm-cc-news-pretrained-scorer ## Model description The REALM checkpoint pretrained with CC-News as target corpus and Wikipedia as knowledge corpus, converted from the TF checkpoint provided by Google Language. The original paper, code, and checkpoints can be found [here](https://github.com/google-research/language/tree/master/language/realm). ## Usage ```python from transformers import RealmScorer scorer = RealmScorer.from_pretrained("qqaatw/realm-cc-news-pretrained-scorer") ```
stefan-it/bort
3afaf7981024b80cfa229b2e271323f8c0aa1c6b
2021-05-20T07:14:56.000Z
[ "pytorch", "tf", "jax", "bert", "fill-mask", "transformers", "autotrain_compatible" ]
fill-mask
false
stefan-it
null
stefan-it/bort
863
null
transformers
1,877
Entry not found
lgrobol/flaubert-minuscule
b2761368313c6c178ae6d3ac10332632e9af8170
2021-08-17T13:19:07.000Z
[ "pytorch", "flaubert", "fill-mask", "transformers", "autotrain_compatible" ]
fill-mask
false
lgrobol
null
lgrobol/flaubert-minuscule
861
null
transformers
1,878
FlauBERT-minuscule ================== A ridiculously small model for testing purposes.
microsoft/resnet-101
c2bf50f68263a35f102eb5c84ca91fc7352ceff3
2022-07-01T17:33:19.000Z
[ "pytorch", "tf", "resnet", "image-classification", "dataset:imagenet-1k", "arxiv:1512.03385", "transformers", "vision", "license:apache-2.0" ]
image-classification
false
microsoft
null
microsoft/resnet-101
860
2
transformers
1,879
--- license: apache-2.0 tags: - vision - image-classification datasets: - imagenet-1k --- # ResNet-101 v1.5 ResNet model pre-trained on ImageNet-1k at resolution 224x224. It was introduced in the paper [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385) by He et al. Disclaimer: The team releasing ResNet did not write a model card for this model so this model card has been written by the Hugging Face team. ## Model description ResNet (Residual Network) is a convolutional neural network that democratized the concepts of residual learning and skip connections. This enables to train much deeper models. This is ResNet v1.5, which differs from the original model: in the bottleneck blocks which require downsampling, v1 has stride = 2 in the first 1x1 convolution, whereas v1.5 has stride = 2 in the 3x3 convolution. This difference makes ResNet50 v1.5 slightly more accurate (\~0.5% top1) than v1, but comes with a small performance drawback (~5% imgs/sec) according to [Nvidia](https://catalog.ngc.nvidia.com/orgs/nvidia/resources/resnet_50_v1_5_for_pytorch). ![model image](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/resnet_architecture.png) ## Intended uses & limitations You can use the raw model for image classification. See the [model hub](https://huggingface.co/models?search=resnet) to look for fine-tuned versions on a task that interests you. ### How to use Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes: ```python from transformers import AutoFeatureExtractor, ResNetForImageClassification import torch from datasets import load_dataset dataset = load_dataset("huggingface/cats-image") image = dataset["test"]["image"][0] feature_extractor = AutoFeatureExtractor.from_pretrained("microsoft/resnet-101") model = ResNetForImageClassification.from_pretrained("microsoft/resnet-101") inputs = feature_extractor(image, return_tensors="pt") with torch.no_grad(): logits = model(**inputs).logits # model predicts one of the 1000 ImageNet classes predicted_label = logits.argmax(-1).item() print(model.config.id2label[predicted_label]) ``` For more code examples, we refer to the [documentation](https://huggingface.co/docs/transformers/main/en/model_doc/resnet). ### BibTeX entry and citation info ```bibtex @inproceedings{he2016deep, title={Deep residual learning for image recognition}, author={He, Kaiming and Zhang, Xiangyu and Ren, Shaoqing and Sun, Jian}, booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition}, pages={770--778}, year={2016} } ```
SIC98/GPT2-python-code-generator
525aec7829d6b9606e01f979d58cf4125fb906e5
2021-05-21T11:13:58.000Z
[ "pytorch", "jax", "gpt2", "text-generation", "transformers" ]
text-generation
false
SIC98
null
SIC98/GPT2-python-code-generator
859
3
transformers
1,880
Github - https://github.com/SIC98/GPT2-python-code-generator
Helsinki-NLP/opus-mt-is-en
2334bf160857f518815cd97a0b7a3c5e81b7fa2e
2021-09-09T22:12:09.000Z
[ "pytorch", "marian", "text2text-generation", "is", "en", "transformers", "translation", "license:apache-2.0", "autotrain_compatible" ]
translation
false
Helsinki-NLP
null
Helsinki-NLP/opus-mt-is-en
858
1
transformers
1,881
--- tags: - translation license: apache-2.0 --- ### opus-mt-is-en * source languages: is * target languages: en * OPUS readme: [is-en](https://github.com/Helsinki-NLP/OPUS-MT-train/blob/master/models/is-en/README.md) * dataset: opus * model: transformer-align * pre-processing: normalization + SentencePiece * download original weights: [opus-2019-12-18.zip](https://object.pouta.csc.fi/OPUS-MT-models/is-en/opus-2019-12-18.zip) * test set translations: [opus-2019-12-18.test.txt](https://object.pouta.csc.fi/OPUS-MT-models/is-en/opus-2019-12-18.test.txt) * test set scores: [opus-2019-12-18.eval.txt](https://object.pouta.csc.fi/OPUS-MT-models/is-en/opus-2019-12-18.eval.txt) ## Benchmarks | testset | BLEU | chr-F | |-----------------------|-------|-------| | Tatoeba.is.en | 51.4 | 0.672 |
Lalita/marianmt-th-zh_cn
bab48cedd044cf1c5b9064943bf52a78728c9721
2021-06-29T14:06:47.000Z
[ "pytorch", "marian", "text2text-generation", "transformers", "translation", "torch==1.8.0", "autotrain_compatible" ]
translation
false
Lalita
null
Lalita/marianmt-th-zh_cn
858
null
transformers
1,882
--- tags: - translation - torch==1.8.0 widget: - text: "Inference Unavailable" --- ### marianmt-th-zh_cn * source languages: th * target languages: zh_cn * dataset: * model: transformer-align * pre-processing: normalization + SentencePiece * test set scores: 15.53 ## Training Training scripts from [LalitaDeelert/NLP-ZH_TH-Project](https://github.com/LalitaDeelert/NLP-ZH_TH-Project). Experiments tracked at [cstorm125/marianmt-th-zh_cn](https://wandb.ai/cstorm125/marianmt-th-zh_cn). ``` export WANDB_PROJECT=marianmt-th-zh_cn python train_model.py --input_fname ../data/v1/Train.csv \\\\\\\\ \\\\t--output_dir ../models/marianmt-th-zh_cn \\\\\\\\ \\\\t--source_lang th --target_lang zh \\\\\\\\ \\\\t--metric_tokenize zh --fp16 ``` ## Usage ``` from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("Lalita/marianmt-zh_cn-th") model = AutoModelForSeq2SeqLM.from_pretrained("Lalita/marianmt-zh_cn-th").cpu() src_text = [ 'ฉันรักคุณ', 'ฉันอยากกินข้าว', ] translated = model.generate(**tokenizer(src_text, return_tensors="pt", padding=True)) print([tokenizer.decode(t, skip_special_tokens=True) for t in translated]) > ['我爱你', '我想吃饭。'] ``` ## Requirements ``` transformers==4.6.0 torch==1.8.0 ```
savasy/bert-base-turkish-squad
0309abfbf39abc803db200667d25a003affd5112
2021-05-20T04:56:01.000Z
[ "pytorch", "jax", "bert", "question-answering", "tr", "transformers", "autotrain_compatible" ]
question-answering
false
savasy
null
savasy/bert-base-turkish-squad
857
5
transformers
1,883
--- language: tr --- # Turkish SQuAD Model : Question Answering I fine-tuned Turkish-Bert-Model for Question-Answering problem with Turkish version of SQuAD; TQuAD * BERT-base: https://huggingface.co/dbmdz/bert-base-turkish-uncased * TQuAD dataset: https://github.com/TQuad/turkish-nlp-qa-dataset # Training Code ``` !python3 run_squad.py \ --model_type bert \ --model_name_or_path dbmdz/bert-base-turkish-uncased\ --do_train \ --do_eval \ --train_file trainQ.json \ --predict_file dev1.json \ --per_gpu_train_batch_size 12 \ --learning_rate 3e-5 \ --num_train_epochs 5.0 \ --max_seq_length 384 \ --doc_stride 128 \ --output_dir "./model" ``` # Example Usage > Load Model ``` from transformers import AutoTokenizer, AutoModelForQuestionAnswering, pipeline import torch tokenizer = AutoTokenizer.from_pretrained("savasy/bert-base-turkish-squad") model = AutoModelForQuestionAnswering.from_pretrained("savasy/bert-base-turkish-squad") nlp=pipeline("question-answering", model=model, tokenizer=tokenizer) ``` > Apply the model ``` sait="ABASIYANIK, Sait Faik. Hikayeci (Adapazarı 23 Kasım 1906-İstanbul 11 Mayıs 1954). \ İlk öğrenimine Adapazarı’nda Rehber-i Terakki Mektebi’nde başladı. İki yıl kadar Adapazarı İdadisi’nde okudu.\ İstanbul Erkek Lisesi’nde devam ettiği orta öğrenimini Bursa Lisesi’nde tamamladı (1928). İstanbul Edebiyat \ Fakültesi’ne iki yıl devam ettikten sonra babasının isteği üzerine iktisat öğrenimi için İsviçre’ye gitti. \ Kısa süre sonra iktisat öğrenimini bırakarak Lozan’dan Grenoble’a geçti. Üç yıl başıboş bir edebiyat öğrenimi \ gördükten sonra babası tarafından geri çağrıldı (1933). Bir müddet Halıcıoğlu Ermeni Yetim Mektebi'nde Türkçe \ gurup dersleri öğretmenliği yaptı. Ticarete atıldıysa da tutunamadı. Bir ay Haber gazetesinde adliye muhabirliği\ yaptı (1942). Babasının ölümü üzerine aileden kalan emlakin geliri ile avare bir hayata başladı. Evlenemedi.\ Yazları Burgaz adasındaki köşklerinde, kışları Şişli’deki apartmanlarında annesi ile beraber geçen bu fazla \ içkili bohem hayatı ömrünün sonuna kadar sürdü." print(nlp(question="Ne zaman avare bir hayata başladı?", context=sait)) print(nlp(question="Sait Faik hangi Lisede orta öğrenimini tamamladı?", context=sait)) ``` ``` # Ask your self ! type your question print(nlp(question="...?", context=sait)) ``` Check My other Model https://huggingface.co/savasy
sshleifer/distilbart-xsum-12-3
1d2bfbc16dcdd28720f9f1d37be764e5cc5c78c8
2021-06-14T07:57:16.000Z
[ "pytorch", "jax", "bart", "text2text-generation", "en", "dataset:cnn_dailymail", "dataset:xsum", "transformers", "summarization", "license:apache-2.0", "autotrain_compatible" ]
summarization
false
sshleifer
null
sshleifer/distilbart-xsum-12-3
856
1
transformers
1,884
--- language: en tags: - summarization license: apache-2.0 datasets: - cnn_dailymail - xsum thumbnail: https://huggingface.co/front/thumbnails/distilbart_medium.png --- ### Usage This checkpoint should be loaded into `BartForConditionalGeneration.from_pretrained`. See the [BART docs](https://huggingface.co/transformers/model_doc/bart.html?#transformers.BartForConditionalGeneration) for more information. ### Metrics for DistilBART models | Model Name | MM Params | Inference Time (MS) | Speedup | Rouge 2 | Rouge-L | |:---------------------------|------------:|----------------------:|----------:|----------:|----------:| | distilbart-xsum-12-1 | 222 | 90 | 2.54 | 18.31 | 33.37 | | distilbart-xsum-6-6 | 230 | 132 | 1.73 | 20.92 | 35.73 | | distilbart-xsum-12-3 | 255 | 106 | 2.16 | 21.37 | 36.39 | | distilbart-xsum-9-6 | 268 | 136 | 1.68 | 21.72 | 36.61 | | bart-large-xsum (baseline) | 406 | 229 | 1 | 21.85 | 36.50 | | distilbart-xsum-12-6 | 306 | 137 | 1.68 | 22.12 | 36.99 | | bart-large-cnn (baseline) | 406 | 381 | 1 | 21.06 | 30.63 | | distilbart-12-3-cnn | 255 | 214 | 1.78 | 20.57 | 30.00 | | distilbart-12-6-cnn | 306 | 307 | 1.24 | 21.26 | 30.59 | | distilbart-6-6-cnn | 230 | 182 | 2.09 | 20.17 | 29.70 |
bhadresh-savani/distilbert-base-uncased-sentiment-sst2
b91676624bfec8bb96d31c4d0f1b13a491ebe65c
2022-06-15T11:48:33.000Z
[ "pytorch", "tf", "jax", "distilbert", "text-classification", "en", "dataset:sst2", "transformers", "license:apache-2.0" ]
text-classification
false
bhadresh-savani
null
bhadresh-savani/distilbert-base-uncased-sentiment-sst2
854
null
transformers
1,885
--- language: en license: apache-2.0 datasets: - sst2 --- # distilbert-base-uncased-sentiment-sst2 This model will be able to identify positivity or negativity present in the sentence ## Dataset: The Stanford Sentiment Treebank from GLUE ## Results: ``` ***** eval metrics ***** epoch = 3.0 eval_accuracy = 0.9094 eval_loss = 0.3514 eval_runtime = 0:00:03.60 eval_samples = 872 eval_samples_per_second = 242.129 eval_steps_per_second = 30.266 ```
tanlq/vit-base-patch16-224-in21k-finetuned-cifar10
b180bcaf51fdf309391ae08a72494bf9fbf7d64a
2022-04-04T08:20:16.000Z
[ "pytorch", "vit", "image-classification", "dataset:cifar10", "transformers", "generated_from_trainer", "license:apache-2.0", "model-index" ]
image-classification
false
tanlq
null
tanlq/vit-base-patch16-224-in21k-finetuned-cifar10
854
null
transformers
1,886
--- license: apache-2.0 tags: - generated_from_trainer datasets: - cifar10 metrics: - accuracy model-index: - name: vit-base-patch16-224-in21k-finetuned-cifar10 results: - task: name: Image Classification type: image-classification dataset: name: cifar10 type: cifar10 args: plain_text metrics: - name: Accuracy type: accuracy value: 0.9875 --- <!-- This model card has been generated automatically according to the information the Trainer had access to. You should probably proofread and complete it, then remove this comment. --> # vit-base-patch16-224-in21k-finetuned-cifar10 This model is a fine-tuned version of [google/vit-base-patch16-224-in21k](https://huggingface.co/google/vit-base-patch16-224-in21k) on the cifar10 dataset. It achieves the following results on the evaluation set: - Loss: 0.0503 - Accuracy: 0.9875 ## Model description More information needed ## Intended uses & limitations More information needed ## Training and evaluation data More information needed ## Training procedure ### Training hyperparameters The following hyperparameters were used during training: - learning_rate: 5e-05 - train_batch_size: 8 - eval_batch_size: 8 - seed: 42 - gradient_accumulation_steps: 4 - total_train_batch_size: 32 - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 - lr_scheduler_type: linear - lr_scheduler_warmup_ratio: 0.1 - num_epochs: 3 ### Training results | Training Loss | Epoch | Step | Validation Loss | Accuracy | |:-------------:|:-----:|:----:|:---------------:|:--------:| | 0.3118 | 1.0 | 1562 | 0.1135 | 0.9778 | | 0.2717 | 2.0 | 3124 | 0.0619 | 0.9867 | | 0.1964 | 3.0 | 4686 | 0.0503 | 0.9875 | ### Framework versions - Transformers 4.18.0.dev0 - Pytorch 1.11.0 - Datasets 2.0.0 - Tokenizers 0.11.6
gorkemgoknar/gpt2-small-turkish
cecfcbf3dfbb3c9df280386790c0ac45d21ad9d9
2021-09-22T08:29:21.000Z
[ "pytorch", "jax", "gpt2", "text-generation", "tr", "dataset:wikipedia-turkish", "transformers", "turkish", "license:apache-2.0" ]
text-generation
false
gorkemgoknar
null
gorkemgoknar/gpt2-small-turkish
852
1
transformers
1,887
--- language: - tr thumbnail: tags: - gpt2 - turkish license: apache-2.0 datasets: - wikipedia-turkish metrics: - perplexity - accuracy widget: - text: Bu yazıyı bir bilgisayar yazdı. Yazarken context: '' - text: İnternete kolay erişim sayesinde dünya daha da küçüldü. Bunun sonucunda context: '' --- # Turkish GPT2 Model Finetuned # Türkçe GPT2 Modeli ## Model description This is a GPT2-Small English based model finetuned and additionaly trainied with Wikipedia Articles in Turkish as of 28-10-2020 Live demo based on this work at : https://www.metayazar.com/ Fine tuned writer on this model: https://huggingface.co/gorkemgoknar/gpt2-turkish-writer Work has been done on Pierre Guillou tutorial as on this page. (https://github.com/piegu/fastai-projects/blob/master/finetuning-English-GPT2-any-language-Portuguese-HuggingFace-fastaiv2.ipynb) Code is converted to work with Fastai 2.X . Using Google Colab for training. Additional tutorial and source will be in https://github.com/gorkemgoknar in later stage. Current accuracy 33 % , Perplexity : 51.88 Models are available: * [gpt2-small-tuned-tr] (https://huggingface.co/gorkemgoknar/gpt2-small-turkish) * [gpt2-small-turkish-writer] (https://huggingface.co/gorkemgoknar/gpt2-turkish-writer) ## Intended uses & limitations #### How to use #### Install ```python from transformers import AutoTokenizer, AutoModelWithLMHead import torch tokenizer = AutoTokenizer.from_pretrained("gorkemgoknar/gpt2-small-turkish") model = AutoModelWithLMHead.from_pretrained("gorkemgoknar/gpt2-small-turkish") # Get sequence length max of 1024 tokenizer.model_max_length=1024 model.eval() # disable dropout (or leave in train mode to finetune) ``` #### Generate 1 word ```python # input sequence text = "Bu yazıyı bilgisayar yazdı." inputs = tokenizer(text, return_tensors="pt") # model output outputs = model(**inputs, labels=inputs["input_ids"]) loss, logits = outputs[:2] predicted_index = torch.argmax(logits[0, -1, :]).item() predicted_text = tokenizer.decode([predicted_index]) # results print('input text:', text) print('predicted text:', predicted_text) # input text: # predicted text: ``` #### Generate Full Sequence ```python # input sequence text = "Bu yazıyı bilgisayar yazdı." inputs = tokenizer(text, return_tensors="pt") # model output using Top-k sampling text generation method sample_outputs = model.generate(inputs.input_ids, pad_token_id=50256, do_sample=True, max_length=50, # put the token number you want top_k=40, num_return_sequences=1) # generated sequence for i, sample_output in enumerate(sample_outputs): print(">> Generated text {}\\\\ \\\\ {}".format(i+1, tokenizer.decode(sample_output.tolist()))) # >> Generated text # ``` #### Limitations and bias The training data used for this model come from Turkish Wikipedia. We know it contains a lot of unfiltered content from the internet, which is far from neutral. ## Training data Wikipedia Turkish article dump as of 28-10-2020 ## Training procedure ## Eval results | epoch\\\\t|train_loss\\\\t|valid_loss\\\\t|accuracy\\\\t|perplexity\\\\t|time | | ----- | -------- |--------- | ---------- | --------- | ----- | |0\\\\t|4.777015\\\\t|4.621834\\\\t|0.292547\\\\t|101.680367\\\\t|2:42:05| |1\\\\t|4.509412\\\\t|4.403999\\\\t|0.305574\\\\t|81.777267\\\\t|1:09:38| |2\\\\t|4.169529\\\\t|4.120755\\\\t|0.324908\\\\t|61.605747\\\\t|1:07:45| |3\\\\t|4.293973\\\\t|4.177899\\\\t|0.317211\\\\t|65.228653\\\\t|1:07:02| |4\\\\t|4.049848\\\\t|3.949103\\\\t|0.338347\\\\t|51.888783\\\\t|1:05:53| #Epoch 0 on Tesla T4, others on V100 ```
uclanlp/visualbert-nlvr2
2cb80570d2326bbb1f3a954f967a1cd5bed949b6
2021-05-31T11:09:59.000Z
[ "pytorch", "visual_bert", "transformers" ]
null
false
uclanlp
null
uclanlp/visualbert-nlvr2
852
null
transformers
1,888
Entry not found
KBLab/sentence-bert-swedish-cased
e5e754ac75b8dddc1c15f52e11ef7d326792fd1e
2022-07-28T14:18:47.000Z
[ "pytorch", "bert", "feature-extraction", "arxiv:2004.09813", "sentence-transformers", "sentence-similarity", "transformers" ]
sentence-similarity
false
KBLab
null
KBLab/sentence-bert-swedish-cased
851
3
sentence-transformers
1,889
--- pipeline_tag: sentence-similarity tags: - sentence-transformers - feature-extraction - sentence-similarity - transformers widget: - source_sentence: "Mannen åt mat." sentences: - "Han förtärde en närande och nyttig måltid." - "Det var ett sunkigt hak med ganska gott käk." - "Han inmundigade middagen tillsammans med ett glas rödvin." - "Potatischips är jättegoda." - "Tryck på knappen för att få tala med kundsupporten." example_title: "Mat" - source_sentence: "Kan jag deklarera digitalt från utlandet?" sentences: - "Du som befinner dig i utlandet kan deklarera digitalt på flera olika sätt." - "Du som har kvarskatt att betala ska göra en inbetalning till ditt skattekonto." - "Efter att du har deklarerat går vi igenom uppgifterna i din deklaration och räknar ut din skatt." - "I din deklaration som du får från oss har vi räknat ut vad du ska betala eller få tillbaka." - "Tryck på knappen för att få tala med kundsupporten." example_title: "Skatteverket FAQ" - source_sentence: "Hon kunde göra bakåtvolter." sentences: - "Hon var atletisk." - "Hon var bra på gymnastik." - "Hon var inte atletisk." - "Hon var oförmögen att flippa baklänges." example_title: "Gymnastik" --- # KBLab/sentence-bert-swedish-cased This is a [sentence-transformers](https://www.SBERT.net) model: It maps Swedish sentences & paragraphs to a 768 dimensional dense vector space and can be used for tasks like clustering or semantic search. This model is a bilingual Swedish-English model trained according to instructions in the paper [Making Monolingual Sentence Embeddings Multilingual using Knowledge Distillation](https://arxiv.org/pdf/2004.09813.pdf) and the [documentation](https://www.sbert.net/examples/training/multilingual/README.html) accompanying its companion python package. We have used the strongest available pretrained English Bi-Encoder ([paraphrase-mpnet-base-v2](https://www.sbert.net/docs/pretrained_models.html#sentence-embedding-models)) as a teacher model, and the pretrained Swedish [KB-BERT](https://huggingface.co/KB/bert-base-swedish-cased) as the student model. A more detailed description of the model can be found in an article we published on the [KBLab blog](https://kb-labb.github.io/posts/2021-08-23-a-swedish-sentence-transformer/). <!--- Describe your model here --> ## Usage (Sentence-Transformers) Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed: ``` pip install -U sentence-transformers ``` Then you can use the model like this: ```python from sentence_transformers import SentenceTransformer sentences = ["Det här är en exempelmening", "Varje exempel blir konverterad"] model = SentenceTransformer('KBLab/sentence-bert-swedish-cased') embeddings = model.encode(sentences) print(embeddings) ``` ## Usage (HuggingFace Transformers) Without [sentence-transformers](https://www.SBERT.net), you can use the model like this: First, you pass your input through the transformer model, then you have to apply the right pooling-operation on-top of the contextualized word embeddings. ```python from transformers import AutoTokenizer, AutoModel import torch #Mean Pooling - Take attention mask into account for correct averaging def mean_pooling(model_output, attention_mask): token_embeddings = model_output[0] #First element of model_output contains all token embeddings input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float() return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9) # Sentences we want sentence embeddings for sentences = ['Det här är en exempelmening', 'Varje exempel blir konverterad'] # Load model from HuggingFace Hub tokenizer = AutoTokenizer.from_pretrained('KBLab/sentence-bert-swedish-cased') model = AutoModel.from_pretrained('KBLab/sentence-bert-swedish-cased') # Tokenize sentences encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt') # Compute token embeddings with torch.no_grad(): model_output = model(**encoded_input) # Perform pooling. In this case, max pooling. sentence_embeddings = mean_pooling(model_output, encoded_input['attention_mask']) print("Sentence embeddings:") print(sentence_embeddings) ``` ## Evaluation Results <!--- Describe how your model was evaluated --> The model was primarily evaluated on [SweParaphrase v1.0](https://spraakbanken.gu.se/en/resources/sweparaphrase). This test set is part of [SuperLim](https://spraakbanken.gu.se/en/resources/superlim) -- a Swedish evaluation suite for natural langage understanding tasks. We calculated Pearson and Spearman correlation between predicted model similarity scores and the human similarity score labels. The model achieved a Pearson correlation coefficient of **0.918** and a Spearman's rank correlation coefficient of **0.911**. The following code snippet can be used to reproduce the above results: ```python from sentence_transformers import SentenceTransformer import pandas as pd df = pd.read_csv( "sweparaphrase-dev-165.csv", sep="\t", header=None, names=[ "original_id", "source", "type", "sentence_swe1", "sentence_swe2", "score", "sentence1", "sentence2", ], ) model = SentenceTransformer("KBLab/sentence-bert-swedish-cased") sentences1 = df["sentence_swe1"].tolist() sentences2 = df["sentence_swe2"].tolist() # Compute embedding for both lists embeddings1 = model.encode(sentences1, convert_to_tensor=True) embeddings2 = model.encode(sentences2, convert_to_tensor=True) # Compute cosine similarity after normalizing embeddings1 /= embeddings1.norm(dim=-1, keepdim=True) embeddings2 /= embeddings2.norm(dim=-1, keepdim=True) cosine_scores = embeddings1 @ embeddings2.t() sentence_pair_scores = cosine_scores.diag() df["model_score"] = sentence_pair_scores.cpu().tolist() print(df[["score", "model_score"]].corr(method="spearman")) print(df[["score", "model_score"]].corr(method="pearson")) ``` Examples how to evaluate the model on other test sets of the SuperLim suites can be found on the following links: [evaluate_faq.py](https://github.com/kb-labb/swedish-sbert/blob/main/evaluate_faq.py) (Swedish FAQ), [evaluate_swesat.py](https://github.com/kb-labb/swedish-sbert/blob/main/evaluate_swesat.py) (SweSAT synonyms), [evaluate_supersim.py](https://github.com/kb-labb/swedish-sbert/blob/main/evaluate_supersim.py) (SuperSim). ## Training An article with more details on data and the model can be found on the [KBLab blog](https://kb-labb.github.io/posts/2021-08-23-a-swedish-sentence-transformer/). Around 14.6 million sentences from English-Swedish parallel corpuses were used to train the model. Data was sourced from the [Open Parallel Corpus](https://opus.nlpl.eu/) (OPUS) and downloaded via the python package [opustools](https://pypi.org/project/opustools/). Datasets used were: JW300, Europarl, EUbookshop, EMEA, TED2020, Tatoeba and OpenSubtitles. The model was trained with the parameters: **DataLoader**: `torch.utils.data.dataloader.DataLoader` of length 227832 with parameters: ``` {'batch_size': 64, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'} ``` **Loss**: `sentence_transformers.losses.MSELoss.MSELoss` Parameters of the fit()-Method: ``` { "callback": null, "epochs": 7, "evaluation_steps": 1000, "evaluator": "sentence_transformers.evaluation.SequentialEvaluator.SequentialEvaluator", "max_grad_norm": 1, "optimizer_class": "<class 'transformers.optimization.AdamW'>", "optimizer_params": { "correct_bias": false, "eps": 1e-06, "lr": 2e-05 }, "scheduler": "WarmupLinear", "steps_per_epoch": null, "warmup_steps": 10000, "weight_decay": 0.01 } ``` ## Full Model Architecture ``` SentenceTransformer( (0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: BertModel (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False}) ) ``` ## Citing & Authors <!--- Describe where people can find more information --> This model was trained by KBLab, a data lab at the National Library of Sweden. You can cite the article on our blog: https://kb-labb.github.io/posts/2021-08-23-a-swedish-sentence-transformer/ . ``` @misc{rekathati2021introducing, author = {Rekathati, Faton}, title = {The KBLab Blog: Introducing a Swedish Sentence Transformer}, url = {https://kb-labb.github.io/posts/2021-08-23-a-swedish-sentence-transformer/}, year = {2021} } ``` ## Acknowledgements We gratefully acknowledge the HPC RIVR consortium ([www.hpc-rivr.si](https://www.hpc-rivr.si/)) and EuroHPC JU ([eurohpc-ju.europa.eu/](https://eurohpc-ju.europa.eu/)) for funding this research by providing computing resources of the HPC system Vega at the Institute of Information Science ([www.izum.si](https://www.izum.si/)).
YituTech/conv-bert-small
9a11330184f20d78feb3fd45edd1e8dad23205e8
2021-02-24T11:26:46.000Z
[ "pytorch", "tf", "convbert", "feature-extraction", "transformers" ]
feature-extraction
false
YituTech
null
YituTech/conv-bert-small
851
1
transformers
1,890
Entry not found
microsoft/markuplm-base
b907337efa18696ad8a213005d5db0946d5d2081
2022-01-11T12:32:38.000Z
[ "pytorch", "markuplm", "arxiv:2110.08518", "transformers" ]
null
false
microsoft
null
microsoft/markuplm-base
851
2
transformers
1,891
# MarkupLM **Multimodal (text +markup language) pre-training for [Document AI](https://www.microsoft.com/en-us/research/project/document-ai/)** ## Introduction MarkupLM is a simple but effective multi-modal pre-training method of text and markup language for visually-rich document understanding and information extraction tasks, such as webpage QA and webpage information extraction. MarkupLM archives the SOTA results on multiple datasets. For more details, please refer to our paper: [MarkupLM: Pre-training of Text and Markup Language for Visually-rich Document Understanding](https://arxiv.org/abs/2110.08518) Junlong Li, Yiheng Xu, Lei Cui, Furu Wei
tuner007/pegasus_summarizer
a8980c11072794c107d4e8b7990c6a49f3da6a50
2022-07-28T06:38:07.000Z
[ "pytorch", "pegasus", "text2text-generation", "en", "transformers", "seq2seq", "summarization", "license:apache-2.0", "model-index", "autotrain_compatible" ]
summarization
false
tuner007
null
tuner007/pegasus_summarizer
848
7
transformers
1,892
--- language: en license: apache-2.0 tags: - pegasus - seq2seq - summarization model-index: - name: tuner007/pegasus_summarizer results: - task: type: summarization name: Summarization dataset: name: cnn_dailymail type: cnn_dailymail config: 3.0.0 split: train metrics: - name: ROUGE-1 type: rouge value: 36.604 verified: true - name: ROUGE-2 type: rouge value: 14.6398 verified: true - name: ROUGE-L type: rouge value: 23.8845 verified: true - name: ROUGE-LSUM type: rouge value: 32.9017 verified: true - name: loss type: loss value: 2.5757133960723877 verified: true - name: gen_len type: gen_len value: 76.3984 verified: true --- ## Model description [PEGASUS](https://github.com/google-research/pegasus) fine-tuned for summarization ## Install "sentencepiece" library required for tokenizer ``` pip install sentencepiece ``` ## Model in Action 🚀 ``` import torch from transformers import PegasusForConditionalGeneration, PegasusTokenizer model_name = 'tuner007/pegasus_summarizer' torch_device = 'cuda' if torch.cuda.is_available() else 'cpu' tokenizer = PegasusTokenizer.from_pretrained(model_name) model = PegasusForConditionalGeneration.from_pretrained(model_name).to(torch_device) def get_response(input_text): batch = tokenizer([input_text],truncation=True,padding='longest',max_length=1024, return_tensors="pt").to(torch_device) gen_out = model.generate(**batch,max_length=128,num_beams=5, num_return_sequences=1, temperature=1.5) output_text = tokenizer.batch_decode(gen_out, skip_special_tokens=True) return output_text ``` #### Example: context = """" India wicket-keeper batsman Rishabh Pant has said someone from the crowd threw a ball on pacer Mohammed Siraj while he was fielding in the ongoing third Test against England on Wednesday. Pant revealed the incident made India skipper Virat Kohli "upset". "I think, somebody threw a ball inside, at Siraj, so he [Kohli] was upset," said Pant in a virtual press conference after the close of the first day\'s play."You can say whatever you want to chant, but don\'t throw things at the fielders and all those things. It is not good for cricket, I guess," he added.In the third session of the opening day of the third Test, a section of spectators seemed to have asked Siraj the score of the match to tease the pacer. The India pacer however came with a brilliant reply as he gestured 1-0 (India leading the Test series) towards the crowd.Earlier this month, during the second Test match, there was some bad crowd behaviour on a show as some unruly fans threw champagne corks at India batsman KL Rahul.Kohli also intervened and he was seen gesturing towards the opening batsman to know more about the incident. An over later, the TV visuals showed that many champagne corks were thrown inside the playing field, and the Indian players were visibly left frustrated.Coming back to the game, after bundling out India for 78, openers Rory Burns and Haseeb Hameed ensured that England took the honours on the opening day of the ongoing third Test.At stumps, England\'s score reads 120/0 and the hosts have extended their lead to 42 runs. For the Three Lions, Burns (52*) and Hameed (60*) are currently unbeaten at the crease.Talking about the pitch on opening day, Pant said, "They took the heavy roller, the wicket was much more settled down, and they batted nicely also," he said. "But when we batted, the wicket was slightly soft, and they bowled in good areas, but we could have applied [ourselves] much better."Both England batsmen managed to see off the final session and the hosts concluded the opening day with all ten wickets intact, extending the lead to 42.(ANI) """ ``` get_response(context) ``` #### Output: Team India wicketkeeper-batsman Rishabh Pant has said that Virat Kohli was "upset" after someone threw a ball on pacer Mohammed Siraj while he was fielding in the ongoing third Test against England. "You can say whatever you want to chant, but don't throw things at the fielders and all those things. It's not good for cricket, I guess," Pant added.' #### [Inshort](https://www.inshorts.com/) (60 words News summary app, rated 4.4 by 5,27,246+ users on android playstore) summary: India wicketkeeper-batsman Rishabh Pant has revealed that captain Virat Kohli was upset with the crowd during the first day of Leeds Test against England because someone threw a ball at pacer Mohammed Siraj. Pant added, "You can say whatever you want to chant, but don't throw things at the fielders and all those things. It is not good for cricket." > Created by [Arpit Rajauria](https://twitter.com/arpit_rajauria) [![Twitter icon](https://cdn0.iconfinder.com/data/icons/shift-logotypes/32/Twitter-32.png)](https://twitter.com/arpit_rajauria)
vblagoje/retribert-base-uncased
9241266f3afbc5b07435cfa8070871fc77ee3818
2021-11-11T07:23:38.000Z
[ "pytorch", "retribert", "feature-extraction", "transformers" ]
feature-extraction
false
vblagoje
null
vblagoje/retribert-base-uncased
847
null
transformers
1,893
Entry not found
ynie/xlnet-large-cased-snli_mnli_fever_anli_R1_R2_R3-nli
027e2b37d8b0c27965ee58d9da95cf994f1ee0f4
2020-10-17T01:54:45.000Z
[ "pytorch", "xlnet", "text-classification", "transformers" ]
text-classification
false
ynie
null
ynie/xlnet-large-cased-snli_mnli_fever_anli_R1_R2_R3-nli
847
null
transformers
1,894
Entry not found
henryk/bert-base-multilingual-cased-finetuned-polish-squad2
f4d5b523b23dbe9c3bc4741755832ef1451fe5ce
2021-05-19T19:05:33.000Z
[ "pytorch", "jax", "bert", "question-answering", "pl", "transformers", "autotrain_compatible" ]
question-answering
false
henryk
null
henryk/bert-base-multilingual-cased-finetuned-polish-squad2
846
1
transformers
1,895
--- language: pl --- # Multilingual + Polish SQuAD2.0 This model is the multilingual model provided by the Google research team with a fine-tuned polish Q&A downstream task. ## Details of the language model Language model ([**bert-base-multilingual-cased**](https://github.com/google-research/bert/blob/master/multilingual.md)): 12-layer, 768-hidden, 12-heads, 110M parameters. Trained on cased text in the top 104 languages with the largest Wikipedias. ## Details of the downstream task Using the `mtranslate` Python module, [**SQuAD2.0**](https://rajpurkar.github.io/SQuAD-explorer/) was machine-translated. In order to find the start tokens, the direct translations of the answers were searched in the corresponding paragraphs. Due to the different translations depending on the context (missing context in the pure answer), the answer could not always be found in the text, and thus a loss of question-answer examples occurred. This is a potential problem where errors can occur in the data set. | Dataset | # Q&A | | ---------------------- | ----- | | SQuAD2.0 Train | 130 K | | Polish SQuAD2.0 Train | 83.1 K | | SQuAD2.0 Dev | 12 K | | Polish SQuAD2.0 Dev | 8.5 K | ## Model benchmark | Model | EM/F1 |HasAns (EM/F1) | NoAns | | ---------------------- | ----- | ----- | ----- | | [SlavicBERT](https://huggingface.co/DeepPavlov/bert-base-bg-cs-pl-ru-cased) | 69.35/71.51 | 47.02/54.09 | 79.20 | | [polBERT](https://huggingface.co/dkleczek/bert-base-polish-uncased-v1) | 67.33/69.80| 45.73/53.80 | 76.87 | | [multiBERT](https://huggingface.co/bert-base-multilingual-cased) | **70.76**/**72.92** |45.00/52.04 | 82.13 | ## Model training The model was trained on a **Tesla V100** GPU with the following command: ```python export SQUAD_DIR=path/to/pl_squad python run_squad.py --model_type bert \ --model_name_or_path bert-base-multilingual-cased \ --do_train \ --do_eval \ --version_2_with_negative \ --train_file $SQUAD_DIR/pl_squadv2_train.json \ --predict_file $SQUAD_DIR/pl_squadv2_dev.json \ --num_train_epochs 2 \ --max_seq_length 384 \ --doc_stride 128 \ --save_steps=8000 \ --output_dir ../../output \ --overwrite_cache \ --overwrite_output_dir ``` **Results**: {'exact': 70.76671723655035, 'f1': 72.92156947155917, 'total': 8569, 'HasAns_exact': 45.00762195121951, 'HasAns_f1': 52.04456128116991, 'HasAns_total': 2624, 'NoAns_exact': 82.13624894869638, ' NoAns_f1': 82.13624894869638, 'NoAns_total': 5945, 'best_exact': 71.72365503559342, 'best_exact_thresh': 0.0, 'best_f1': 73.62662512059369, 'best_f1_thresh': 0.0} ## Model in action Fast usage with **pipelines**: ```python from transformers import pipeline qa_pipeline = pipeline( "question-answering", model="henryk/bert-base-multilingual-cased-finetuned-polish-squad2", tokenizer="henryk/bert-base-multilingual-cased-finetuned-polish-squad2" ) qa_pipeline({ 'context': "Warszawa jest największym miastem w Polsce pod względem liczby ludności i powierzchni", 'question': "Jakie jest największe miasto w Polsce?"}) ``` # Output: ```json { "score": 0.9986, "start": 0, "end": 8, "answer": "Warszawa" } ``` ## Contact Please do not hesitate to contact me via [LinkedIn](https://www.linkedin.com/in/henryk-borzymowski-0755a2167/) if you want to discuss or get access to the Polish version of SQuAD.
LIAMF-USP/roberta-large-finetuned-race
671db4772791326255cbf6c4f33eff5d06db4e43
2021-05-20T12:08:36.000Z
[ "pytorch", "tf", "jax", "roberta", "multiple-choice", "english", "dataset:race", "transformers", "license:mit" ]
multiple-choice
false
LIAMF-USP
null
LIAMF-USP/roberta-large-finetuned-race
845
3
transformers
1,896
--- language: "english" license: "mit" datasets: - race metrics: - accuracy --- # Roberta Large Fine Tuned on RACE ## Model description This model is a fine-tuned model of Roberta-large applied on RACE #### How to use ```python import datasets from transformers import RobertaTokenizer from transformers import RobertaForMultipleChoice tokenizer = RobertaTokenizer.from_pretrained( "LIAMF-USP/roberta-large-finetuned-race") model = RobertaForMultipleChoice.from_pretrained( "LIAMF-USP/roberta-large-finetuned-race") dataset = datasets.load_dataset( "race", "all", split=["train", "validation", "test"], )training_examples = dataset[0] evaluation_examples = dataset[1] test_examples = dataset[2] example=training_examples[0] example_id = example["example_id"] question = example["question"] context = example["article"] options = example["options"] label_example = example["answer"] label_map = {label: i for i, label in enumerate(["A", "B", "C", "D"])} choices_inputs = [] for ending_idx, (_, ending) in enumerate( zip(context, options)): if question.find("_") != -1: # fill in the banks questions question_option = question.replace("_", ending) else: question_option = question + " " + ending inputs = tokenizer( context, question_option, add_special_tokens=True, max_length=MAX_SEQ_LENGTH, padding="max_length", truncation=True, return_overflowing_tokens=False, ) label = label_map[label_example] input_ids = [x["input_ids"] for x in choices_inputs] attention_mask = ( [x["attention_mask"] for x in choices_inputs] # as the senteces follow the same structure, #just one of them is necessary to check if "attention_mask" in choices_inputs[0] else None ) example_encoded = { "example_id": example_id, "input_ids": input_ids, "attention_mask": attention_mask, "label": label, } output = model(**example_encoded) ``` ## Training data The initial model was [roberta large model](https://huggingface.co/roberta-large) which was then fine-tuned on [RACE dataset](https://www.cs.cmu.edu/~glai1/data/race/) ## Training procedure It was necessary to preprocess the data with a method that is exemplified for a single instance in the _How to use_ section. The used hyperparameters were the following: | Hyperparameter | Value | |:----:|:----:| | adam_beta1 | 0.9 | | adam_beta2 | 0.98 | | adam_epsilon | 1.000e-8 | | eval_batch_size | 32 | | train_batch_size | 1 | | fp16 | True | | gradient_accumulation_steps | 16 | | learning_rate | 0.00001 | | warmup_steps | 1000 | | max_length | 512 | | epochs | 4 | ## Eval results: | Dataset Acc | Eval | All Test |High School Test |Middle School Test | |:----:|:----:|:----:|:----:|:----:| | | 85.2 | 84.9|83.5|88.0| **The model was trained with a Tesla V100-PCIE-16GB**
microsoft/xprophetnet-large-wiki100-cased
1acad1643ddd54a44df6a1b797ada8373685d90e
2020-12-11T21:51:18.000Z
[ "pytorch", "xlm-prophetnet", "text2text-generation", "multilingual", "arxiv:2001.04063", "arxiv:2004.01401", "transformers", "autotrain_compatible" ]
text2text-generation
false
microsoft
null
microsoft/xprophetnet-large-wiki100-cased
845
null
transformers
1,897
--- language: multilingual --- ## xprophetnet-large-wiki100-cased Cross-lingual version [ProphetNet](https://arxiv.org/abs/2001.04063), pretrained on [wiki100 xGLUE dataset](https://arxiv.org/abs/2004.01401). ProphetNet is a new pre-trained language model for sequence-to-sequence learning with a novel self-supervised objective called future n-gram prediction. ProphetNet is able to predict more future tokens with a n-stream decoder. The original implementation is Fairseq version at [github repo](https://github.com/microsoft/ProphetNet). xProphetNet is also served as the baseline model for xGLUE cross-lingual natural language generation tasks. For xGLUE corss-lingual NLG tasks, xProphetNet is finetuned with English data, but inference with both English and other zero-shot language data. ### Usage This pre-trained model can be fine-tuned on *sequence-to-sequence* tasks. The model could *e.g.* be trained on English headline generation as follows: ```python from transformers import XLMProphetNetForConditionalGeneration, XLMProphetNetTokenizer model = XLMProphetNetForConditionalGeneration.from_pretrained("microsoft/xprophetnet-large-wiki100-cased") tokenizer = XLMProphetNetTokenizer.from_pretrained("microsoft/xprophetnet-large-wiki100-cased") input_str = "the us state department said wednesday it had received no formal word from bolivia that it was expelling the us ambassador there but said the charges made against him are `` baseless ." target_str = "us rejects charges against its ambassador in bolivia" input_ids = tokenizer(input_str, return_tensors="pt").input_ids labels = tokenizer(target_str, return_tensors="pt").input_ids loss = model(input_ids, labels=labels).loss ``` Note that since this model is a multi-lingual model it can be fine-tuned on all kinds of other languages. ### Citation ```bibtex @article{yan2020prophetnet, title={Prophetnet: Predicting future n-gram for sequence-to-sequence pre-training}, author={Yan, Yu and Qi, Weizhen and Gong, Yeyun and Liu, Dayiheng and Duan, Nan and Chen, Jiusheng and Zhang, Ruofei and Zhou, Ming}, journal={arXiv preprint arXiv:2001.04063}, year={2020} } ```
kuzgunlar/electra-turkish-qa
586ab1bc12af16bf396360db8a90cdccf514e4ec
2020-07-31T09:15:54.000Z
[ "pytorch", "electra", "question-answering", "transformers", "autotrain_compatible" ]
question-answering
false
kuzgunlar
null
kuzgunlar/electra-turkish-qa
843
1
transformers
1,898
Entry not found
IDEA-CCNL/Erlangshen-Roberta-110M-NLI
ea0a42559acf675d8931336951e893fc5d466268
2022-05-12T09:48:51.000Z
[ "pytorch", "bert", "text-classification", "zh", "transformers", "NLU", "NLI", "license:apache-2.0" ]
text-classification
false
IDEA-CCNL
null
IDEA-CCNL/Erlangshen-Roberta-110M-NLI
843
null
transformers
1,899
--- language: - zh license: apache-2.0 tags: - bert - NLU - NLI inference: true widget: - text: "今天心情不好[SEP]今天很开心" --- # Erlangshen-Roberta-110M-NLI, model (Chinese),one model of [Fengshenbang-LM](https://github.com/IDEA-CCNL/Fengshenbang-LM). We collect 4 NLI(Natural Language Inference) datasets in the Chinese domain for finetune, with a total of 1014787 samples. Our model is mainly based on [roberta](https://huggingface.co/hfl/chinese-roberta-wwm-ext) ## Usage ```python from transformers import BertForSequenceClassification from transformers import BertTokenizer import torch tokenizer=BertTokenizer.from_pretrained('IDEA-CCNL/Erlangshen-Roberta-110M-NLI') model=BertForSequenceClassification.from_pretrained('IDEA-CCNL/Erlangshen-Roberta-110M-NLI') texta='今天的饭不好吃' textb='今天心情不好' output=model(torch.tensor([tokenizer.encode(texta,textb)])) print(torch.nn.functional.softmax(output.logits,dim=-1)) ``` ## Scores on downstream chinese tasks (without any data augmentation) | Model | cmnli | ocnli | snli | | :--------: | :-----: | :----: | :-----: | | Erlangshen-Roberta-110M-NLI | 80.83 | 78.56 | 88.01 | | Erlangshen-Roberta-330M-NLI | 82.25 | 79.82 | 88 | | Erlangshen-MegatronBert-1.3B-NLI | 84.52 | 84.17 | 88.67 | ## Citation If you find the resource is useful, please cite the following website in your paper. ``` @misc{Fengshenbang-LM, title={Fengshenbang-LM}, author={IDEA-CCNL}, year={2021}, howpublished={\url{https://github.com/IDEA-CCNL/Fengshenbang-LM}}, } ```