modelId
stringlengths
4
112
lastModified
stringlengths
24
24
tags
list
pipeline_tag
stringclasses
21 values
files
list
publishedBy
stringlengths
2
37
downloads_last_month
int32
0
9.44M
library
stringclasses
15 values
modelCard
large_stringlengths
0
100k
nikkindev/cave
2021-06-04T12:11:30.000Z
[ "pytorch", "gpt2", "lm-head", "causal-lm", "transformers", "conversational", "text-generation" ]
conversational
[ ".gitattributes", "README.md", "config.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer.json", "tokenizer_config.json", "vocab.json" ]
nikkindev
80
transformers
--- tags: - conversational --- Cave Johnson in town!
nikokons/conversational-agent-el
2021-05-23T10:50:17.000Z
[ "pytorch", "jax", "tensorboard", "gpt2", "lm-head", "causal-lm", "transformers", "text-generation" ]
text-generation
[ ".gitattributes", "added_tokens.json", "config.json", "events.out.tfevents.1620567796.nikon-desktop", "flax_model.msgpack", "merges.txt", "model_training_args.bin", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
nikokons
55
transformers
nikokons/dialo_transfer_5epo
2021-05-23T10:51:00.000Z
[ "pytorch", "gpt2", "transformers" ]
[ ".gitattributes", "added_tokens.json", "config.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
nikokons
16
transformers
nikokons/gpt2-greek
2021-05-23T10:51:51.000Z
[ "pytorch", "jax", "gpt2", "lm-head", "causal-lm", "el", "transformers", "text-generation" ]
text-generation
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
nikokons
60
transformers
--- language: el --- ## gpt2-greek It is trained from scratch a generative Transformer model as GPT-2 on a large corpus of Greek text so that the model can generate long stretches of contiguous coherent text. The model is trained on a collection of almost 5GB Greek texts, with the main source to be from Greek Wikipedia. The content is extracted using the Wikiextractor tool (Attardi, 2012). The dataset is constructed as 5 sentences per sample (about 3.7 millions of samples) and the end of document is marked with the string <|endoftext|> providing the model with paragraph information, as done for the original GPT-2 training set by Radford . The input sentences are pre-processed and tokenized using 22,000 merges of byte-pair encoding. Attention dropouts with a rate of 0.1 are used for regularization on all layers and L2 weight decay of 0,01. In addition, a batch size of 4 and accumulated gradients over 8 iterations are used, resulting in an effective batch size of 32. The model uses the Adam optimization scheme with a learning rate of 1e-4 and is trained for 20 epochs. The learning rate increases linearly from zero over the first 9000 updates and decreases linearly by using a linear schedule. The implementation is based on the open-source PyTorch-transformer library(HuggingFace 2019).
nikunjbjj/jd-resume-model
2021-05-20T01:50:03.000Z
[ "pytorch", "jax", "bert", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
nikunjbjj
20
transformers
# Sentiment Analysis in Spanish ## beto-sentiment-analysis Repository: [https://github.com/finiteautomata/pysentimiento/](https://github.com/finiteautomata/pysentimiento/) Model trained with TASS 2020 corpus (around ~5k tweets) of several dialects of Spanish. Base model is [BETO](https://github.com/dccuchile/beto), a BERT model trained in Spanish. Uses `POS`, `NEG`, `NEU` labels. **Coming soon**: a brief paper describing the model and training. Enjoy! 🤗
nikunjbjj/some-random-test
2021-04-20T05:14:38.000Z
[]
[ ".gitattributes" ]
nikunjbjj
0
nimaafshar/parsbert-fa-sentiment-twitter
2021-05-20T01:50:49.000Z
[ "tf", "bert", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "README.md", "config.json", "special_tokens_map.json", "tf_model.h5", "tokenizer_config.json", "vocab.txt" ]
nimaafshar
124
transformers
ParsBERT digikala sentiment analysis model fine-tuned on around 600,000 Persian tweets. # How to use at least you need 650 megabytes of ram and disk in order to load the model. tensorflow, transformers and numpy library ## Loading model ```python import numpy as np from transformers import AutoTokenizer, TFAutoModelForSequenceClassification #loading model tokenizer = AutoTokenizer.from_pretrained("nimaafshar/parsbert-fa-sentiment-twitter") model = TFAutoModelForSequenceClassification.from_pretrained("nimaafshar/parsbert-fa-sentiment-twitter") classes = ["negative","neutral","positive"] ``` ## Using Model ```python #using model sequences = [".غذا خیلی افتضاح بود متاسفم برای مدیریت رستورن خیلی بد بود.", "خیلی خوشمزده و عالی بود عالی", "می‌تونم اسمتونو بپرسم؟" ] for sequence in sequences: inputs = tokenizer(sequence, return_tensors="tf") classification_logits = model(inputs)[0] results = tf.nn.softmax(classification_logits, axis=1).numpy()[0] print(classes[np.argmax(results)]) percentages = np.around(results*100) print(percentages) ``` note that this model is trained on persian corpus and is meant to be used on persian texts too.
nimaafshar/parsbert-fa-uncased-twitter-sentiment
2021-01-24T13:43:12.000Z
[]
[ ".gitattributes" ]
nimaafshar
0
nimacel/fasgasg
2021-01-29T08:44:02.000Z
[]
[ ".gitattributes" ]
nimacel
0
nimacel/g4wegaas
2021-01-26T14:52:50.000Z
[]
[ ".gitattributes" ]
nimacel
0
nimanpra/Fine_Tuned_Spiritual
2021-06-17T16:09:05.000Z
[ "pytorch", "gpt2", "lm-head", "causal-lm", "transformers", "text-generation" ]
text-generation
[ ".gitattributes", "added_tokens.json", "config.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
nimanpra
25
transformers
nirendy/test
2021-04-18T18:37:04.000Z
[]
[ ".gitattributes", "README.md" ]
nirendy
0
nithinholla/wav2vec2-large-xlsr-53-dutch
2021-03-28T10:48:00.000Z
[ "pytorch", "wav2vec2", "nl", "dataset:common_voice", "transformers", "audio", "automatic-speech-recognition", "speech", "xlsr-fine-tuning-week", "license:apache-2.0" ]
automatic-speech-recognition
[ ".gitattributes", "README.md", "config.json", "preprocessor_config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
nithinholla
26
transformers
--- language: nl datasets: - common_voice metrics: - wer tags: - audio - automatic-speech-recognition - speech - xlsr-fine-tuning-week license: apache-2.0 model-index: - name: Dutch XLSR Wav2Vec2 Large 53 results: - task: name: Speech Recognition type: automatic-speech-recognition dataset: name: Common Voice nl type: common_voice args: nl metrics: - name: Test WER type: wer value: 21.59 --- # Wav2Vec2-Large-XLSR-53-Dutch Fine-tuned [facebook/wav2vec2-large-xlsr-53](https://huggingface.co/facebook/wav2vec2-large-xlsr-53) on Dutch using the [Common Voice](https://huggingface.co/datasets/common_voice). When using this model, make sure that your speech input is sampled at 16kHz. ## Usage The model can be used directly (without a language model) as follows: ```python import torch import torchaudio from datasets import load_dataset from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor test_dataset = load_dataset("common_voice", "nl", split="test[:2%]") processor = Wav2Vec2Processor.from_pretrained("nithinholla/wav2vec2-large-xlsr-53-dutch") model = Wav2Vec2ForCTC.from_pretrained("nithinholla/wav2vec2-large-xlsr-53-dutch") 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["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["sentence"][:2]) ``` ## Evaluation The model can be evaluated as follows on the Dutch test data of Common Voice. ```python import torch import torchaudio from datasets import load_dataset, load_metric from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor import re test_dataset = load_dataset("common_voice", "nl", split="test") wer = load_metric("wer") processor = Wav2Vec2Processor.from_pretrained("nithinholla/wav2vec2-large-xlsr-53-dutch") model = Wav2Vec2ForCTC.from_pretrained("nithinholla/wav2vec2-large-xlsr-53-dutch") model.to("cuda") chars_to_ignore_regex = '[\,\?\.\!\-\;\:\"\“\%\'\�\(\)\&\–\—\=\…]' resampler = torchaudio.transforms.Resample(48_000, 16_000) # Preprocessing the datasets. # We need to read the audio files as arrays def speech_file_to_array_fn(batch): batch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["sentence"]).lower().replace("´", "'").replace("’", "'") 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 audio 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**: 21.59 % ## Training The Common Voice `train`, `validation` datasets were used for training. The script used for training can be found [here](https://github.com/Nithin-Holla/wav2vec2-sprint/blob/main/train_nl.sh).
nkoh01/MSRoberta
2021-05-20T18:51:20.000Z
[ "pytorch", "jax", "roberta", "masked-lm", "transformers", "fill-mask" ]
fill-mask
[ ".DS_Store", ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.json" ]
nkoh01
6
transformers
# MSRoBERTa Fine-tuned RoBERTa MLM model for [`Miscrosoft Sentence Completion Challenge`](https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/MSR_SCCD.pdf). This model case-sensitive following the `Roberta-base` model. # Model description (taken from: [here](https://huggingface.co/roberta-base)) RoBERTa 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, it was pretrained with the Masked language modeling (MLM) objective. Taking a sentence, the model randomly masks 15% of the words in the input then run the entire masked sentence through the model and has to predict the masked words. This is different from traditional recurrent neural networks (RNNs) that usually see the words one after the other, or from autoregressive models like GPT which internally mask the future tokens. It allows the model to learn a bidirectional representation of the sentence. 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. ### How to use You can use this model directly with a pipeline for masked language modeling: ```python from transformers import pipeline,AutoModelForMaskedLM,AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("nkoh01/MSRoberta") model = AutoModelForMaskedLM.from_pretrained("nkoh01/MSRoberta") unmasker = pipeline( "fill-mask", model=model, tokenizer=tokenizer ) unmasker("Hello, it is a <mask> to meet you.") [{'score': 0.9508683085441589, 'sequence': 'hello, it is a pleasure to meet you.', 'token': 10483, 'token_str': ' pleasure'}, {'score': 0.015089659951627254, 'sequence': 'hello, it is a privilege to meet you.', 'token': 9951, 'token_str': ' privilege'}, {'score': 0.013942377641797066, 'sequence': 'hello, it is a joy to meet you.', 'token': 5823, 'token_str': ' joy'}, {'score': 0.006964420434087515, 'sequence': 'hello, it is a delight to meet you.', 'token': 13213, 'token_str': ' delight'}, {'score': 0.0024567877408117056, 'sequence': 'hello, it is a honour to meet you.', 'token': 6671, 'token_str': ' honour'}] ``` ## Installations Make sure you run `!pip install transformers` command to install the transformers library before running the commands above. ## Bias and limitations Under construction.
nlp4good/psych-search
2021-05-20T01:51:28.000Z
[ "pytorch", "jax", "bert", "masked-lm", "en", "dataset:PubMed", "transformers", "mental-health", "license:apache 2.0", "fill-mask" ]
fill-mask
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt", "img/nlp4good-logo.png" ]
nlp4good
26
transformers
--- language: - en tags: - mental-health license: Apache 2.0 datasets: - PubMed --- # Psych-Search Psych-Search is a work in progress to bring cutting edge NLP to mental health practitioners. The model detailed here serves as a foundation for traditional classification models as well as NLU models for a Psych-Search application. The goal of the Psych-Search Application is to use a combination of traditional text classification models to expand the scope of the MESH taxonomy with the inclusion of relevant categories for mental health pracitioners designing suicide prevention programs for adolescent communities within the United States, as well as the automatic extraction and standardization of entities such as risk factors and protective factors. Our first expansion efforts to the MESH taxonomy include categories: - Prevention Strategies - Protective Factors We are actively looking for partners on this work and would love to hear from you! Please ping us at [email protected]. ## Model description This model is an extension of [allenai/scibert_scivocab_uncased](https://huggingface.co/allenai/scibert_scivocab_uncased). Continued pretraining was done using SciBERT as the base model using abstract text only from Pyschology and Psychiatry PubMed research. Training was done on approximately 3.5 million papers for 10 epochs and evaluated on a task similar to BioASQ Task A. ## Intended uses & limitations #### How to use ```python from transformers import AutoTokenizer, AutoModel mname = "nlp4good/psych-search" tokenizer = AutoTokenizer.from_pretrained(mname) model = AutoModel.from_pretrained(mname) ``` ### Limitations and bias This model was trained on all PubMed abstracts categorized under [Psychology and Psychiatry](https://meshb.nlm.nih.gov/treeView). As of March 1, this corresponds to approximately 3.2 million papers that contains abstract text. Of these 3.2 million papers, relevant sparse mental health categories were back translated to increase the representation of certain mental health categories. There are several limitation with this dataset including large discrepancies in the number of papers associated with [Sexual and Gender Minorities](https://meshb.nlm.nih.gov/record/ui?ui=D000072339). The training data consisted of the following breakdown across gender groups: Female | Male | Sexual and Gender Minorities -------|---------|---------- 1,896,301 | 1,945,279 | 4,529 Similar discrepancies are present within [Ethnic Groups](https://meshb.nlm.nih.gov/record/ui?ui=D005006) as defined within the MESH taxonomy: | African Americans | Arabs | Asian Americans | Hispanic Americans | Indians, Central American | Indians, North American | Indians, South American | Indigenous Peoples | Mexican Americans | |-------------------|-------|-----------------|--------------------|---------------------------|-------------------------|-------------------------|--------------------|-------------------| | 31,027 | 2,437 | 5,612 | 18,893 | 124 | 5,657 | 633 | 174 | 3,234 | These discrepancies can have a significant impact on information retrieval systems, downstream machine learning models, and other forms of NLP that leverage these pretrained models. ## Training data This model was trained on all PubMed abstracts categorized under [Psychology and Psychiatry](https://meshb.nlm.nih.gov/treeView). As of March 1, this corresponds to approximately 3.2 million papers that contains abstract text. Of these 3.2 million papers, relevant sparse categories were back translated from english to french and from french to english to increase the representation of sparser mental health categories. This included backtranslating the following papers with the following categories: - Depressive Disorder - Risk Factors - Mental Disorders - Child, Preschool - Mental Health In aggregate, this process added 557,980 additional papers to our training data. ## Training procedure Continued pretraining was done on Psychology and Psychiatry PubMed papers for 10 epochs. Default parameters were used with the exception of gradient accumulation steps which was set at 4, with a per device train batch size of 32. 2 x Nvidia 3090's were used in the development of this model. ## Evaluation results To evaluate the effectiveness of psych-search within the mental health domain, an evaluation task was constructed by finetuning psych-search for a task similar to [BioASQ Task A](http://bioasq.org/). Here we perform large scale biomedical indexing using the MESH taxonomy associated with each paper underneath Psychology and Psychiatry. The evaluation metric is the micro F1 score across all second level descriptors within Psychology and Psychiatry. This corresponds to 38 different MESH categories used during evaluation. bert-base-uncased | SciBERT Scivocab Uncased | Psych-Search -------|---------|---------- 0.7348 | 0.7394 | 0.7415 ## Next Steps If you are interested in continuing to build on this work or have other ideas on how we can build on others work, please let us know! We can be reached at [email protected]. Our goal is to bring state of the art NLP capabilities to underserved areas of research, with mental health being our top priority.
nlpaueb/bert-base-greek-uncased-v1
2021-05-20T01:52:33.000Z
[ "pytorch", "tf", "jax", "bert", "pretraining", "el", "transformers", "fill-mask", "pipeline_tag:fill-mask" ]
fill-mask
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tf_model.h5", "tokenizer_config.json", "vocab.txt" ]
nlpaueb
6,336
transformers
--- language: el pipeline_tag: fill-mask thumbnail: https://github.com/nlpaueb/GreekBERT/raw/master/greek-bert-logo.png widget: - text: "Σήμερα είναι μια [MASK] μέρα." --- # GreekBERT A Greek version of BERT pre-trained language model. <img src="https://github.com/nlpaueb/GreekBERT/raw/master/greek-bert-logo.png" width="600"/> ## Pre-training corpora The pre-training corpora of `bert-base-greek-uncased-v1` include: * The Greek part of [Wikipedia](https://el.wikipedia.org/wiki/Βικιπαίδεια:Αντίγραφα_της_βάσης_δεδομένων), * The Greek part of [European Parliament Proceedings Parallel Corpus](https://www.statmt.org/europarl/), and * The Greek part of [OSCAR](https://traces1.inria.fr/oscar/), a cleansed version of [Common Crawl](https://commoncrawl.org). Future release will also include: * The entire corpus of Greek legislation, as published by the [National Publication Office](http://www.et.gr), * The entire corpus of EU legislation (Greek translation), as published in [Eur-Lex](https://eur-lex.europa.eu/homepage.html?locale=en). ## Pre-training details * We trained BERT using the official code provided in Google BERT's github repository (https://github.com/google-research/bert). We then used [Hugging Face](https://huggingface.co)'s [Transformers](https://github.com/huggingface/transformers) conversion script to convert the TF checkpoint and vocabulary in the desirable format in order to be able to load the model in two lines of code for both PyTorch and TF2 users. * We released a model similar to the English `bert-base-uncased` model (12-layer, 768-hidden, 12-heads, 110M parameters). * We chose to follow the same training set-up: 1 million training steps with batches of 256 sequences of length 512 with an initial learning rate 1e-4. * We were able to use a single Google Cloud TPU v3-8 provided for free from [TensorFlow Research Cloud (TFRC)](https://www.tensorflow.org/tfrc), while also utilizing [GCP research credits](https://edu.google.com/programs/credits/research). Huge thanks to both Google programs for supporting us! ## Requirements We published `bert-base-greek-uncased-v1` as part of [Hugging Face](https://huggingface.co)'s [Transformers](https://github.com/huggingface/transformers) repository. So, you need to install the transfomers library through pip along with PyTorch or Tensorflow 2. ``` pip install transfomers pip install (torch|tensorflow) ``` ## Pre-process text (Deaccent - Lower) In order to use `bert-base-greek-uncased-v1`, you have to pre-process texts to lowercase letters and remove all Greek diacritics. ```python import unicodedata def strip_accents_and_lowercase(s): return ''.join(c for c in unicodedata.normalize('NFD', s) if unicodedata.category(c) != 'Mn').lower() accented_string = "Αυτή είναι η Ελληνική έκδοση του BERT." unaccented_string = strip_accents_and_lowercase(accented_string) print(unaccented_string) # αυτη ειναι η ελληνικη εκδοση του bert. ``` ## Load Pretrained Model ```python from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("nlpaueb/bert-base-greek-uncased-v1") model = AutoModel.from_pretrained("nlpaueb/bert-base-greek-uncased-v1") ``` ## Use Pretrained Model as a Language Model ```python import torch from transformers import * # Load model and tokenizer tokenizer_greek = AutoTokenizer.from_pretrained('nlpaueb/bert-base-greek-uncased-v1') lm_model_greek = AutoModelWithLMHead.from_pretrained('nlpaueb/bert-base-greek-uncased-v1') # ================ EXAMPLE 1 ================ text_1 = 'O ποιητής έγραψε ένα [MASK] .' # EN: 'The poet wrote a [MASK].' input_ids = tokenizer_greek.encode(text_1) print(tokenizer_greek.convert_ids_to_tokens(input_ids)) # ['[CLS]', 'o', 'ποιητης', 'εγραψε', 'ενα', '[MASK]', '.', '[SEP]'] outputs = lm_model_greek(torch.tensor([input_ids]))[0] print(tokenizer_greek.convert_ids_to_tokens(outputs[0, 5].max(0)[1].item())) # the most plausible prediction for [MASK] is "song" # ================ EXAMPLE 2 ================ text_2 = 'Είναι ένας [MASK] άνθρωπος.' # EN: 'He is a [MASK] person.' input_ids = tokenizer_greek.encode(text_2) print(tokenizer_greek.convert_ids_to_tokens(input_ids)) # ['[CLS]', 'ειναι', 'ενας', '[MASK]', 'ανθρωπος', '.', '[SEP]'] outputs = lm_model_greek(torch.tensor([input_ids]))[0] print(tokenizer_greek.convert_ids_to_tokens(outputs[0, 3].max(0)[1].item())) # the most plausible prediction for [MASK] is "good" # ================ EXAMPLE 3 ================ text_3 = 'Είναι ένας [MASK] άνθρωπος και κάνει συχνά [MASK].' # EN: 'He is a [MASK] person he does frequently [MASK].' input_ids = tokenizer_greek.encode(text_3) print(tokenizer_greek.convert_ids_to_tokens(input_ids)) # ['[CLS]', 'ειναι', 'ενας', '[MASK]', 'ανθρωπος', 'και', 'κανει', 'συχνα', '[MASK]', '.', '[SEP]'] outputs = lm_model_greek(torch.tensor([input_ids]))[0] print(tokenizer_greek.convert_ids_to_tokens(outputs[0, 8].max(0)[1].item())) # the most plausible prediction for the second [MASK] is "trips" ``` ## Evaluation on downstream tasks TBA ## Author Ilias Chalkidis on behalf of [AUEB's Natural Language Processing Group](http://nlp.cs.aueb.gr) | Github: [@ilias.chalkidis](https://github.com/seolhokim) | Twitter: [@KiddoThe2B](https://twitter.com/KiddoThe2B) | ## About Us [AUEB's Natural Language Processing Group](http://nlp.cs.aueb.gr) develops algorithms, models, and systems that allow computers to process and generate natural language texts. The group's current research interests include: * question answering systems for databases, ontologies, document collections, and the Web, especially biomedical question answering, * natural language generation from databases and ontologies, especially Semantic Web ontologies, text classification, including filtering spam and abusive content, * information extraction and opinion mining, including legal text analytics and sentiment analysis, * natural language processing tools for Greek, for example parsers and named-entity recognizers, machine learning in natural language processing, especially deep learning. The group is part of the Information Processing Laboratory of the Department of Informatics of the Athens University of Economics and Business.
nlpaueb/bert-base-uncased-contracts
2021-05-20T01:54:02.000Z
[ "pytorch", "tf", "jax", "bert", "transformers" ]
[ ".gitattributes", "config.json", "flax_model.msgpack", "pytorch_model.bin", "tf_model.h5", "vocab.txt" ]
nlpaueb
454
transformers
nlpaueb/bert-base-uncased-echr
2021-05-20T01:55:03.000Z
[ "pytorch", "tf", "jax", "bert", "transformers" ]
[ ".gitattributes", "config.json", "flax_model.msgpack", "pytorch_model.bin", "tf_model.h5", "vocab.txt" ]
nlpaueb
328
transformers
nlpaueb/bert-base-uncased-eurlex
2021-05-20T01:56:15.000Z
[ "pytorch", "tf", "jax", "bert", "transformers" ]
[ ".gitattributes", "config.json", "flax_model.msgpack", "pytorch_model.bin", "tf_model.h5", "vocab.txt" ]
nlpaueb
8,347
transformers
nlpaueb/legal-bert-base-uncased
2021-05-20T01:57:12.000Z
[ "pytorch", "tf", "jax", "bert", "pretraining", "en", "arxiv:2010.02559", "transformers", "license:cc-by-sa-4.0", "legal", "fill-mask", "pipeline_tag:fill-mask" ]
fill-mask
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tf_model.h5", "tokenizer_config.json", "vocab.txt" ]
nlpaueb
26,466
transformers
--- language: en pipeline_tag: fill-mask license: cc-by-sa-4.0 thumbnail: https://i.ibb.co/p3kQ7Rw/Screenshot-2020-10-06-at-12-16-36-PM.png tags: - legal widget: - text: "The applicant submitted that her husband was subjected to treatment amounting to [MASK] whilst in the custody of police." --- # LEGAL-BERT: The Muppets straight out of Law School <img align="left" src="https://i.ibb.co/p3kQ7Rw/Screenshot-2020-10-06-at-12-16-36-PM.png" width="100"/> LEGAL-BERT is a family of BERT models for the legal domain, intended to assist legal NLP research, computational law, and legal technology applications. To pre-train the different variations of LEGAL-BERT, we collected 12 GB of diverse English legal text from several fields (e.g., legislation, court cases, contracts) scraped from publicly available resources. Sub-domains variants (CONTRACTS-, EURLEX-, ECHR-) and/or general LEGAL-BERT perform better than using BERT out of the box for domain-specific tasks. A light-weight model (33% the size of BERT-BASE) pre-trained from scratch on legal data with competitive perfomance is also available. <br/><br/><br/><br/> --- I. Chalkidis, M. Fergadiotis, P. Malakasiotis, N. Aletras and I. Androutsopoulos. "LEGAL-BERT: The Muppets straight out of Law School". In Findings of Empirical Methods in Natural Language Processing (EMNLP 2020) (Short Papers), to be held online, 2020. (https://arxiv.org/abs/2010.02559) --- ## Pre-training corpora The pre-training corpora of LEGAL-BERT include: * 116,062 documents of EU legislation, publicly available from EURLEX (http://eur-lex.europa.eu), the repository of EU Law running under the EU Publication Office. * 61,826 documents of UK legislation, publicly available from the UK legislation portal (http://www.legislation.gov.uk). * 19,867 cases from European Court of Justice (ECJ), also available from EURLEX. * 12,554 cases from HUDOC, the repository of the European Court of Human Rights (ECHR) (http://hudoc.echr.coe.int/eng). * 164,141 cases from various courts across the USA, hosted in the Case Law Access Project portal (https://case.law). * 76,366 US contracts from EDGAR, the database of US Securities and Exchange Commission (SECOM) (https://www.sec.gov/edgar.shtml). ## Pre-training details * We trained BERT using the official code provided in Google BERT's github repository (https://github.com/google-research/bert). * We released a model similar to the English BERT-BASE model (12-layer, 768-hidden, 12-heads, 110M parameters). * We chose to follow the same training set-up: 1 million training steps with batches of 256 sequences of length 512 with an initial learning rate 1e-4. * We were able to use a single Google Cloud TPU v3-8 provided for free from [TensorFlow Research Cloud (TFRC)](https://www.tensorflow.org/tfrc), while also utilizing [GCP research credits](https://edu.google.com/programs/credits/research). Huge thanks to both Google programs for supporting us! * Part of LEGAL-BERT is a light-weight model pre-trained from scratch on legal data, which achieves comparable performance to larger models, while being much more efficient (approximately 4 times faster) with a smaller environmental footprint. ## Models list | Model name | Model Path | Training corpora | | ------------------- | ------------------------------------ | ------------------- | | CONTRACTS-BERT-BASE | `nlpaueb/bert-base-uncased-contracts` | US contracts | | EURLEX-BERT-BASE | `nlpaueb/bert-base-uncased-eurlex` | EU legislation | | ECHR-BERT-BASE | `nlpaueb/bert-base-uncased-echr` | ECHR cases | | LEGAL-BERT-BASE | `nlpaueb/legal-bert-base-uncased` | All | | LEGAL-BERT-SMALL | `nlpaueb/legal-bert-small-uncased` | All | ## Load Pretrained Model ```python from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("nlpaueb/legal-bert-base-uncased") model = AutoModel.from_pretrained("nlpaueb/legal-bert-base-uncased") ``` ## Use LEBAL-BERT variants as Language Models | Corpus | Model | Masked token | Predictions | | --------------------------------- | ---------------------------------- | ------------ | ------------ | | | **BERT-BASE-UNCASED** | | (Contracts) | This [MASK] Agreement is between General Motors and John Murray . | employment | ('new', '0.09'), ('current', '0.04'), ('proposed', '0.03'), ('marketing', '0.03'), ('joint', '0.02') | (ECHR) | The applicant submitted that her husband was subjected to treatment amounting to [MASK] whilst in the custody of Adana Security Directorate | torture | ('torture', '0.32'), ('rape', '0.22'), ('abuse', '0.14'), ('death', '0.04'), ('violence', '0.03') | (EURLEX) | Establishing a system for the identification and registration of [MASK] animals and regarding the labelling of beef and beef products . | bovine | ('farm', '0.25'), ('livestock', '0.08'), ('draft', '0.06'), ('domestic', '0.05'), ('wild', '0.05') | | **CONTRACTS-BERT-BASE** | | (Contracts) | This [MASK] Agreement is between General Motors and John Murray . | employment | ('letter', '0.38'), ('dealer', '0.04'), ('employment', '0.03'), ('award', '0.03'), ('contribution', '0.02') | (ECHR) | The applicant submitted that her husband was subjected to treatment amounting to [MASK] whilst in the custody of Adana Security Directorate | torture | ('death', '0.39'), ('imprisonment', '0.07'), ('contempt', '0.05'), ('being', '0.03'), ('crime', '0.02') | (EURLEX) | Establishing a system for the identification and registration of [MASK] animals and regarding the labelling of beef and beef products . | bovine | (('domestic', '0.18'), ('laboratory', '0.07'), ('household', '0.06'), ('personal', '0.06'), ('the', '0.04') | | **EURLEX-BERT-BASE** | | (Contracts) | This [MASK] Agreement is between General Motors and John Murray . | employment | ('supply', '0.11'), ('cooperation', '0.08'), ('service', '0.07'), ('licence', '0.07'), ('distribution', '0.05') | (ECHR) | The applicant submitted that her husband was subjected to treatment amounting to [MASK] whilst in the custody of Adana Security Directorate | torture | ('torture', '0.66'), ('death', '0.07'), ('imprisonment', '0.07'), ('murder', '0.04'), ('rape', '0.02') | (EURLEX) | Establishing a system for the identification and registration of [MASK] animals and regarding the labelling of beef and beef products . | bovine | ('live', '0.43'), ('pet', '0.28'), ('certain', '0.05'), ('fur', '0.03'), ('the', '0.02') | | **ECHR-BERT-BASE** | | (Contracts) | This [MASK] Agreement is between General Motors and John Murray . | employment | ('second', '0.24'), ('latter', '0.10'), ('draft', '0.05'), ('bilateral', '0.05'), ('arbitration', '0.04') | (ECHR) | The applicant submitted that her husband was subjected to treatment amounting to [MASK] whilst in the custody of Adana Security Directorate | torture | ('torture', '0.99'), ('death', '0.01'), ('inhuman', '0.00'), ('beating', '0.00'), ('rape', '0.00') | (EURLEX) | Establishing a system for the identification and registration of [MASK] animals and regarding the labelling of beef and beef products . | bovine | ('pet', '0.17'), ('all', '0.12'), ('slaughtered', '0.10'), ('domestic', '0.07'), ('individual', '0.05') | | **LEGAL-BERT-BASE** | | (Contracts) | This [MASK] Agreement is between General Motors and John Murray . | employment | ('settlement', '0.26'), ('letter', '0.23'), ('dealer', '0.04'), ('master', '0.02'), ('supplemental', '0.02') | (ECHR) | The applicant submitted that her husband was subjected to treatment amounting to [MASK] whilst in the custody of Adana Security Directorate | torture | ('torture', '1.00'), ('detention', '0.00'), ('arrest', '0.00'), ('rape', '0.00'), ('death', '0.00') | (EURLEX) | Establishing a system for the identification and registration of [MASK] animals and regarding the labelling of beef and beef products . | bovine | ('live', '0.67'), ('beef', '0.17'), ('farm', '0.03'), ('pet', '0.02'), ('dairy', '0.01') | | **LEGAL-BERT-SMALL** | | (Contracts) | This [MASK] Agreement is between General Motors and John Murray . | employment | ('license', '0.09'), ('transition', '0.08'), ('settlement', '0.04'), ('consent', '0.03'), ('letter', '0.03') | (ECHR) | The applicant submitted that her husband was subjected to treatment amounting to [MASK] whilst in the custody of Adana Security Directorate | torture | ('torture', '0.59'), ('pain', '0.05'), ('ptsd', '0.05'), ('death', '0.02'), ('tuberculosis', '0.02') | (EURLEX) | Establishing a system for the identification and registration of [MASK] animals and regarding the labelling of beef and beef products . | bovine | ('all', '0.08'), ('live', '0.07'), ('certain', '0.07'), ('the', '0.07'), ('farm', '0.05') ## Evaluation on downstream tasks Consider the experiments in the article "LEGAL-BERT: The Muppets straight out of Law School". Chalkidis et al., 2018, (https://arxiv.org/abs/2010.02559) ## Author Ilias Chalkidis on behalf of [AUEB's Natural Language Processing Group](http://nlp.cs.aueb.gr) | Github: [@ilias.chalkidis](https://github.com/seolhokim) | Twitter: [@KiddoThe2B](https://twitter.com/KiddoThe2B) |
nlpaueb/legal-bert-small-uncased
2021-05-20T01:58:02.000Z
[ "pytorch", "tf", "jax", "bert", "transformers" ]
[ ".gitattributes", "config.json", "flax_model.msgpack", "pytorch_model.bin", "tf_model.h5", "vocab.txt" ]
nlpaueb
4,391
transformers
nlptown/bert-base-multilingual-uncased-sentiment
2021-05-20T01:59:29.000Z
[ "pytorch", "jax", "bert", "text-classification", "en", "nl", "de", "fr", "it", "es", "transformers", "license:mit" ]
text-classification
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
nlptown
313,885
transformers
--- language: - en - nl - de - fr - it - es license: mit --- # bert-base-multilingual-uncased-sentiment This a bert-base-multilingual-uncased model finetuned for sentiment analysis on product reviews in six languages: English, Dutch, German, French, Spanish and Italian. It predicts the sentiment of the review as a number of stars (between 1 and 5). This model is intended for direct use as a sentiment analysis model for product reviews in any of the six languages above, or for further finetuning on related sentiment analysis tasks. ## Training data Here is the number of product reviews we used for finetuning the model: | Language | Number of reviews | | -------- | ----------------- | | English | 150k | | Dutch | 80k | | German | 137k | | French | 140k | | Italian | 72k | | Spanish | 50k | ## Accuracy The finetuned model obtained the following accuracy on 5,000 held-out product reviews in each of the languages: - Accuracy (exact) is the exact match on the number of stars. - Accuracy (off-by-1) is the percentage of reviews where the number of stars the model predicts differs by a maximum of 1 from the number given by the human reviewer. | Language | Accuracy (exact) | Accuracy (off-by-1) | | -------- | ---------------------- | ------------------- | | English | 67% | 95% | Dutch | 57% | 93% | German | 61% | 94% | French | 59% | 94% | Italian | 59% | 95% | Spanish | 58% | 95% ## Contact Contact [NLP Town](https://www.nlp.town) for questions, feedback and/or requests for similar models.
nlpunibo/albert
2021-02-19T14:13:04.000Z
[ "pytorch", "albert", "question-answering", "transformers" ]
question-answering
[ ".gitattributes", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json", "training_args.bin" ]
nlpunibo
9
transformers
nlpunibo/bert
2021-05-20T02:00:27.000Z
[ "pytorch", "jax", "bert", "question-answering", "transformers" ]
question-answering
[ ".gitattributes", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt" ]
nlpunibo
6
transformers
nlpunibo/classifier
2021-03-19T14:24:16.000Z
[ "pytorch", "distilbert", "transformers" ]
[ ".gitattributes", "config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt" ]
nlpunibo
10
transformers
nlpunibo/distilbert_base_config1
2021-02-19T14:31:23.000Z
[ "pytorch", "distilbert", "question-answering", "transformers" ]
question-answering
[ ".gitattributes", "config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt" ]
nlpunibo
8
transformers
nlpunibo/distilbert_base_config2
2021-02-19T14:36:05.000Z
[ "pytorch", "distilbert", "question-answering", "transformers" ]
question-answering
[ ".gitattributes", "config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt" ]
nlpunibo
7
transformers
nlpunibo/distilbert_base_config3
2021-02-19T14:40:29.000Z
[ "pytorch", "distilbert", "question-answering", "transformers" ]
question-answering
[ ".gitattributes", "config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt" ]
nlpunibo
13
transformers
nlpunibo/distilbert_classifier
2021-02-20T09:01:51.000Z
[ "pytorch", "distilbert", "transformers" ]
[ ".gitattributes", "config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt" ]
nlpunibo
8
transformers
nlpunibo/distilbert_classifier2
2021-02-20T15:04:51.000Z
[ "pytorch", "distilbert", "transformers" ]
[ ".gitattributes", "config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt" ]
nlpunibo
9
transformers
nlpunibo/distilbert_config1
2021-02-19T14:45:08.000Z
[ "pytorch", "distilbert", "question-answering", "transformers" ]
question-answering
[ ".gitattributes", "config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt" ]
nlpunibo
7
transformers
nlpunibo/distilbert_config2
2021-02-19T14:49:49.000Z
[ "pytorch", "distilbert", "question-answering", "transformers" ]
question-answering
[ ".gitattributes", "config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt" ]
nlpunibo
7
transformers
nlpunibo/distilbert_config3
2021-02-18T08:52:42.000Z
[ "pytorch", "distilbert", "question-answering", "transformers" ]
question-answering
[ ".gitattributes", "config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt" ]
nlpunibo
12
transformers
nlpunibo/distilbert_convolutional_classifier
2021-03-21T14:59:17.000Z
[ "pytorch", "distilbert", "question-answering", "transformers" ]
question-answering
[ ".gitattributes", "config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt" ]
nlpunibo
16
transformers
nlpunibo/multiplechoice
2021-03-18T12:08:51.000Z
[ "pytorch", "distilbert", "multiple-choice", "transformers" ]
[ ".gitattributes", "config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt" ]
nlpunibo
7
transformers
nlpunibo/roberta
2021-05-20T18:52:48.000Z
[ "pytorch", "jax", "roberta", "question-answering", "transformers" ]
question-answering
[ ".gitattributes", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.json" ]
nlpunibo
9
transformers
nni-makinas/aaa
2021-01-29T14:23:16.000Z
[]
[ ".gitattributes" ]
nni-makinas
0
noahjadallah/cause-effect-detection
2021-05-20T02:01:13.000Z
[ "pytorch", "jax", "bert", "token-classification", "transformers" ]
token-classification
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt" ]
noahjadallah
28
transformers
--- widget: - text: "If a user signs up, he will receive a confirmation email." --- # Cause-Effect Detection for Software Requirements Based on Token Classification with BERT This model uses BERT to detect cause and effect from a single sentence. The focus of this model is the domain of software requirements engineering, however, it can also be used for other domains. The model outputs one of the following 5 labels for each token: Other B-Cause I-Cause B-Effect I-Effect The source code can be found here: https://colab.research.google.com/drive/14V9Ooy3aNPsRfTK88krwsereia8cfSPc?usp=sharing
nonamenlp/news_gen
2021-04-29T18:31:02.000Z
[ "pytorch", "mt5", "seq2seq", "transformers", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
nonamenlp
20
transformers
MODEL_NAME = 'nonamenlp/news_gen' TOKENIZER_NAME = "nonamenlp/news_gen" trained_model = MT5ForConditionalGeneration.from_pretrained(MODEL_NAME, return_dict=True) tokenizer = T5Tokenizer.from_pretrained(TOKENIZER_NAME)
nonnononon40/bert_test
2021-01-27T08:16:14.000Z
[]
[ ".gitattributes" ]
nonnononon40
0
nostalgebraist/nostalgebraist-autoresponder-2_7b
2021-05-15T02:36:48.000Z
[ "pytorch", "gpt_neo", "causal-lm", "transformers", "text-generation" ]
text-generation
[ ".gitattributes", "README.md", "added_tokens.json", "config.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
nostalgebraist
16
transformers
nostalgebraist/nostalgebraist-autoresponder-6_1b
2021-06-14T17:56:04.000Z
[]
[ ".gitattributes", "model.tar.gz" ]
nostalgebraist
0
not-tanh/wav2vec2-large-xlsr-53-vietnamese
2021-04-02T10:59:16.000Z
[ "pytorch", "wav2vec2", "vi", "dataset:common_voice", "dataset:vivos", "transformers", "audio", "automatic-speech-recognition", "speech", "xlsr-fine-tuning-week", "license:apache-2.0" ]
automatic-speech-recognition
[ ".gitattributes", "README.md", "config.json", "preprocessor_config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
not-tanh
139
transformers
--- language: vi datasets: - common_voice - vivos metrics: - wer tags: - audio - automatic-speech-recognition - speech - xlsr-fine-tuning-week license: apache-2.0 model-index: - name: Ted Vietnamese XLSR Wav2Vec2 Large 53 results: - task: name: Speech Recognition type: automatic-speech-recognition dataset: name: Common Voice vi type: common_voice args: vi metrics: - name: Test WER type: wer value: 39.571823 --- # Wav2Vec2-Large-XLSR-53-Vietnamese Fine-tuned [facebook/wav2vec2-large-xlsr-53](https://huggingface.co/facebook/wav2vec2-large-xlsr-53) on Vietnamese using the [Common Voice](https://huggingface.co/datasets/common_voice), [Vivos dataset](https://ailab.hcmus.edu.vn/vivos) and [FOSD dataset](https://data.mendeley.com/datasets/k9sxg2twv4/4). When using this model, make sure that your speech input is sampled at 16kHz. ## Usage The model can be used directly (without a language model) as follows: ```python import torch import torchaudio from datasets import load_dataset from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor test_dataset = load_dataset("common_voice", "vi", split="test") processor = Wav2Vec2Processor.from_pretrained("not-tanh/wav2vec2-large-xlsr-53-vietnamese") model = Wav2Vec2ForCTC.from_pretrained("not-tanh/wav2vec2-large-xlsr-53-vietnamese") 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["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["sentence"][:2]) ``` ## Evaluation The model can be evaluated as follows on the Vietnamese test data of Common Voice. ```python import torch import torchaudio from datasets import load_dataset, load_metric from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor import re test_dataset = load_dataset("common_voice", "vi", split="test") wer = load_metric("wer") processor = Wav2Vec2Processor.from_pretrained("not-tanh/wav2vec2-large-xlsr-53-vietnamese") model = Wav2Vec2ForCTC.from_pretrained("not-tanh/wav2vec2-large-xlsr-53-vietnamese") model.to("cuda") chars_to_ignore_regex = r'[,?.!\-;:"“%\'�]' 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["sentence"]).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**: 39.571823% ## Training ## TODO The Common Voice `train`, `validation`, the VIVOS and FOSD datasets were used for training The script used for training can be found ... # TODO
nou-r/test-model
2021-04-03T11:53:47.000Z
[]
[ ".gitattributes" ]
nou-r
0
nouamanetazi/arabic-sentiment-analysis
2021-01-08T21:11:46.000Z
[]
[ ".gitattributes" ]
nouamanetazi
0
novinsh/xlm-roberta-large-toxicomments-12k
2020-05-26T15:25:05.000Z
[ "pytorch", "xlm-roberta", "masked-lm", "transformers", "fill-mask" ]
fill-mask
[ ".gitattributes", "config.json", "eval_results_lm.txt", "pytorch_model.bin", "sentencepiece.bpe.model", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin" ]
novinsh
26
transformers
nowells/clevernature
2021-04-28T12:28:00.000Z
[]
[ ".gitattributes" ]
nowells
0
npan1990/TwitterBert
2020-12-15T10:15:59.000Z
[]
[ ".gitattributes" ]
npan1990
0
nreimers/BERT-Medium_L-8_H-512_A-8
2021-05-28T11:04:38.000Z
[ "pytorch", "jax", "bert", "transformers" ]
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
nreimers
98
transformers
This is the BERT-Medium model from Google: https://github.com/google-research/bert#bert. A BERT model with 8 layers, 512 hidden unit size, and 8 attention heads.
nreimers/BERT-Mini_L-4_H-256_A-4
2021-05-28T11:05:04.000Z
[ "pytorch", "jax", "bert", "transformers" ]
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
nreimers
634
transformers
This is the BERT-Medium model from Google: https://github.com/google-research/bert#bert. A BERT model with 4 layers, 256 hidden unit size, and 4 attention heads.
nreimers/BERT-Small-L-4_H-512_A-8
2021-05-20T02:03:04.000Z
[ "pytorch", "jax", "bert", "transformers" ]
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
nreimers
1,337
transformers
# BERT-Small-L-4_H-512_A-8 This is a port of the [BERT-Small model](https://github.com/google-research/bert) to Pytorch. It uses 4 layers, a hidden size of 512 and 8 attention heads.
nreimers/BERT-Tiny_L-2_H-128_A-2
2021-05-28T11:05:21.000Z
[ "pytorch", "jax", "bert", "transformers" ]
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
nreimers
3,183
transformers
This is the BERT-Medium model from Google: https://github.com/google-research/bert#bert. A BERT model with 2 layers, 128 hidden unit size, and 2 attention heads.
nreimers/MiniLM-L3-H384-uncased
2021-06-11T11:43:04.000Z
[ "pytorch", "bert", "transformers", "license:mit" ]
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer.json", "tokenizer_config.json", "vocab.txt" ]
nreimers
158
transformers
--- license: mit --- ## MiniLM: 3 Layer Version This is a 3 layer version of [microsoft/MiniLM-L12-H384-uncased](https://huggingface.co/microsoft/MiniLM-L12-H384-uncased/) by keeping only the layer [3, 7, 11].
nreimers/MiniLM-L6-H384-uncased
2021-05-19T12:32:04.000Z
[ "pytorch", "bert", "transformers", "license:mit" ]
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
nreimers
525
transformers
--- license: mit --- ## MiniLM: 6 Layer Version This is a 6 layer version of [microsoft/MiniLM-L12-H384-uncased](https://huggingface.co/microsoft/MiniLM-L12-H384-uncased/) by keeping only every second layer.
nreimers/TinyBERT_L-4_H-312_v2
2021-05-28T11:02:32.000Z
[ "pytorch", "jax", "bert", "transformers" ]
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
nreimers
1,042
transformers
This is the [General_TinyBERT_v2(4layer-312dim)](https://github.com/huawei-noah/Pretrained-Language-Model/tree/master/TinyBERT) ported to Huggingface transformers.
nreimers/TinyBERT_L-6_H-768_v2
2021-05-28T11:01:29.000Z
[ "pytorch", "jax", "bert", "transformers" ]
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
nreimers
66
transformers
This is the [General_TinyBERT_v2(6layer-768dim)](https://github.com/huawei-noah/Pretrained-Language-Model/tree/master/TinyBERT) ported to Huggingface transformers.
nreimers/albert-small-v2
2021-05-31T12:26:52.000Z
[ "pytorch", "albert", "transformers" ]
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer.json", "tokenizer_config.json" ]
nreimers
19
transformers
# albert-small-v2 This is a 6 layer version of [albert-base-v2](https://huggingface.co/albert-base-v2).
nreimers/tmp-test-model
2021-06-18T03:41:53.000Z
[ "pytorch", "bert", "feature-extraction", "sentence-transformers", "transformers", "sentence-similarity", "pipeline_tag:sentence-similarity" ]
sentence-similarity
[ ".gitattributes", "README.md", "config.json", "merges.txt", "modules.json", "pytorch_model.bin", "sentence_bert_config.json", "special_tokens_map.json", "tokenizer.json", "tokenizer_config.json", "vocab.json", "vocab.txt", "1_Pooling/config.json" ]
nreimers
4
sentence-transformers
nsa-thatchai/test
2021-05-24T12:20:01.000Z
[ "pytorch", "lm-head", "transformers" ]
[ ".gitattributes", "config.json", "pytorch_model.bin" ]
nsa-thatchai
6
transformers
nsi319/legal-led-base-16384
2021-03-01T12:33:48.000Z
[ "pytorch", "led", "seq2seq", "en", "transformers", "summarization", "license:mit", "text2text-generation" ]
summarization
[ ".gitattributes", "README.md", "config.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "trainer_state.json", "training_args.bin", "vocab.json" ]
nsi319
6,020
transformers
--- language: en tags: summarization metrics: - rouge - precision inference: false license: mit --- ## LED for legal summarization of documents This is a Longformer Encoder Decoder ([led-base-16384](https://huggingface.co/allenai/led-base-16384)) model for the **legal domain**, trained for **long document abstractive summarization** task. The length of the document can be upto 16,384 tokens. ## Training data The **legal-led-base-16384** model was trained on [sec-litigation-releases](https://www.sec.gov/litigation/litreleases.htm) dataset consisting more than 2700 litigation releases and complaints. ## How to use ```Python from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("nsi319/legal-led-base-16384") model = AutoModelForSeq2SeqLM.from_pretrained("nsi319/legal-led-base-16384") padding = "max_length" text="""On March 2, 2018, the Securities and Exchange Commission announced securities fraud charges against a U.K.-based broker-dealer and its investment manager in connection with manipulative trading in the securities of HD View 360 Inc., a U.S.-based microcap issuer. The SEC also announced charges against HD View's CEO, another individual, and three entities they control for manipulating HD View's securities as well as the securities of another microcap issuer, West Coast Ventures Group Corp. The SEC further announced the institution of an order suspending trading in the securities of HD View.These charges arise in part from an undercover operation by the Federal Bureau of Investigation, which also resulted in related criminal prosecutions against these defendants by the Office of the United States Attorney for the Eastern District of New York.In a complaint filed in the U.S. District Court for the Eastern District of New York, the SEC alleges that Beaufort Securities Ltd. and Peter Kyriacou, an investment manager at Beaufort, manipulated the market for HD View's common stock. The scheme involved an undercover FBI agent who described his business as manipulating U.S. stocks through pump-and-dump schemes. Kyriacou and the agent discussed depositing large blocks of microcap stock in Beaufort accounts, driving up the price of the stock through promotions, manipulating the stock's price and volume through matched trades, and then selling the shares for a large profit.The SEC's complaint against Beaufort and Kyriacou alleges that they:opened brokerage accounts for the undercover agent in the names of nominees in order to conceal his identity and his connection to the anticipated trading activity in the accounts suggested that the undercover agent could create the false appearance that HD View's stock was liquid in advance of a pump-and-dump by "gam[ing] the market" through matched trades executed multiple purchase orders of HD View shares with the understanding that Beaufort's client had arranged for an associate to simultaneously offer an equivalent number of shares at the same priceA second complaint filed by the SEC in the U.S. District Court for the Eastern District of New York alleges that in a series of recorded telephone conversations with the undercover agent, HD View CEO Dennis Mancino and William T. Hirschy agreed to manipulate HD View's common stock by using the agent's network of brokers to generate fraudulent retail demand for the stock in exchange for a kickback from the trading proceeds. According to the complaint, the three men agreed that Mancino and Hirschy would manipulate HD View stock to a higher price before using the agent's brokers to liquidate their positions at an artificially inflated price. The SEC's complaint also alleges that Mancino and Hirschy executed a "test trade" on Jan. 31, 2018, coordinated by the agent, consisting of a sell order placed by the defendants filled by an opposing purchase order placed by a broker into an account at Beaufort. Unbeknownst to Mancino and Hirschy, the Beaufort account used for this trade was a nominal account that was opened and funded by the agent. The SEC's complaint also alleges that, prior to their contact with the undercover agent, Mancino and Hirschy manipulated the market for HD View and for West Coast by using brokerage accounts that they owned, controlled, or were associated with –including TJM Investments Inc., DJK Investments 10 Inc., WT Consulting Group LLC – to effect manipulative "matched trades."The SEC's complaint against Beaufort and Kyriacou charges the defendants with violating Section 10(b) of the Securities Exchange Act of 1934 and Rule 10b-5 thereunder. The SEC also charged Hirschy, Mancino, and their corporate entities with violating Section 17(a)(1) of the Securities Act of 1933, Sections 9(a)(1), 9(a)(2), and 10(b) of the Exchange Act and Rules 10b-5(a) and (c) thereunder. The SEC is seeking injunctions, disgorgement, prejudgment interest, penalties, and penny stock bars from Beaufort and Kyriacou. With respect to Hirschy, Mancino, and their corporate entities, the SEC is seeking injunctions, disgorgement, prejudgment interest, penalties, penny stock bars, and an officer-and-director bar against Mancino.The investigation was conducted in the SEC's New York Regional Office by Tejal Shah and Joseph Darragh, Lorraine Collazo, and Michael D. Paley of the Microcap Fraud Task Force and supervised by Lara S. Mehraban, and in Washington, D.C. by Patrick L. Feeney, Robert Nesbitt, and Kevin Guerrero, and supervised by Antonia Chion. Preethi Krishnamurthy and Ms. Shah will lead the SEC's litigation against Beaufort and Kyriacou. Ann H. Petalas and Mr. Feeney, under the supervision of Cheryl Crumpton, will handle the SEC's litigation against Mancino, Hirschy, and their entities. The SEC appreciates the assistance of the Office of the United States Attorney for the Eastern District of New York, the Federal Bureau of Investigation, the Internal Revenue Service, the Alberta Securities Commission, the Ontario Securities Commission, the Financial Conduct Authority of the United Kingdom, and the Financial Industry Regulatory Authority.The Commission's investigation in this matter is continuing.""" input_tokenized = tokenizer.encode(text, return_tensors='pt',padding=padding,pad_to_max_length=True, max_length=6144,truncation=True) summary_ids = model.generate(input_tokenized, num_beams=4, no_repeat_ngram_size=3, length_penalty=2, min_length=350, max_length=500) summary = [tokenizer.decode(g, skip_special_tokens=True, clean_up_tokenization_spaces=False) for g in summary_ids][0] ### Summary Output # On March 2, 2018, the Securities and Exchange Commission charged Beaufort Securities Ltd. and Peter Kyriacou, an investment manager at Beaufort, with manipulating the market for HD View 360 Inc., a U.S.-based microcap issuer. The SEC also announced charges against HD View's CEO, another individual, and three entities they control for manipulating HD View through pump-and-dump schemes. According to the SEC's complaint, the defendants discussed depositing large blocks of microcap stock in Beaufort accounts, driving up the price of the stock through promotions, manipulating the stock's price and volume through matched trades, and then selling the shares for a large profit. In a parallel action, the United States Attorney's Office for the Eastern District of New York announced criminal charges against the defendants. On March 4, the SEC announced the entry of an order suspending trading in the securities of HD View and for West Coast, pending the outcome of a parallel criminal action by the Federal Bureau of Investigation. Following the announcement of the suspension, HD View stock prices and volume increased significantly, and the defendants agreed to pay over $1.5 million in disgorgement, prejudgment interest, penalties, and an officer and director bar. Beaufort agreed to settle the charges without admitting or denying the allegations of the complaint, and to pay a $1 million civil penalty. The SEC's investigation, which is continuing, has been conducted by Patrick McCluskey and Cheryl Crumpton of the SEC Enforcement Division's Market Abuse Unit in the New York Regional Office. The SEC appreciates the assistance of the Financial Industry Regulatory Authority of the United Kingdom, the Canadian Securities Commission, the Alberta Securities Commission and the Ontario Securities Commission. ``` ## Evaluation results When the model is used for summarizing legal documents, it achieves the following results: | Model | rouge1 | rouge1-precision | rouge2 | rouge2-precision | rougeL | rougeL-precision | |:-----------:|:-----:|:-----:|:------:|:-----:|:------:|:-----:| | legal-led-base-16384 | **55.69** | **61.73** | **29.03** | **36.68** | **32.65** | **40.43** | | led-base-16384 | 29.19 | 30.43 | 15.23 | 16.27 | 16.32 | 16.58 |
nsi319/legal-pegasus
2021-03-11T08:50:52.000Z
[ "pytorch", "pegasus", "seq2seq", "en", "transformers", "summarization", "license:mit", "text2text-generation" ]
summarization
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json", "trainer_state.json", "training_args.bin" ]
nsi319
195
transformers
--- language: en tags: summarization metrics: - rouge - precision inference: false license: mit --- ## PEGASUS for legal document summarization **legal-pegasus** is a finetuned version of ([**google/pegasus-cnn_dailymail**](https://huggingface.co/google/pegasus-cnn_dailymail)) for the **legal domain**, trained to perform **abstractive summarization** task. The maximum length of input sequence is 1024 tokens. ## Training data This model was trained on [**sec-litigation-releases**](https://www.sec.gov/litigation/litreleases.htm) dataset consisting more than 2700 litigation releases and complaints. ## How to use ```Python from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("nsi319/legal-pegasus") model = AutoModelForSeq2SeqLM.from_pretrained("nsi319/legal-pegasus") text = """On March 5, 2021, the Securities and Exchange Commission charged AT&T, Inc. with repeatedly violating Regulation FD, and three of its Investor Relations executives with aiding and abetting AT&T's violations, by selectively disclosing material nonpublic information to research analysts. According to the SEC's complaint, AT&T learned in March 2016 that a steeper-than-expected decline in its first quarter smartphone sales would cause AT&T's revenue to fall short of analysts' estimates for the quarter. The complaint alleges that to avoid falling short of the consensus revenue estimate for the third consecutive quarter, AT&T Investor Relations executives Christopher Womack, Michael Black, and Kent Evans made private, one-on-one phone calls to analysts at approximately 20 separate firms. On these calls, the AT&T executives allegedly disclosed AT&T's internal smartphone sales data and the impact of that data on internal revenue metrics, despite the fact that internal documents specifically informed Investor Relations personnel that AT&T's revenue and sales of smartphones were types of information generally considered "material" to AT&T investors, and therefore prohibited from selective disclosure under Regulation FD. The complaint further alleges that as a result of what they were told on these calls, the analysts substantially reduced their revenue forecasts, leading to the overall consensus revenue estimate falling to just below the level that AT&T ultimately reported to the public on April 26, 2016. The SEC's complaint, filed in federal district court in Manhattan, charges AT&T with violations of the disclosure provisions of Section 13(a) of the Securities Exchange Act of 1934 and Regulation FD thereunder, and charges Womack, Evans and Black with aiding and abetting these violations. The complaint seeks permanent injunctive relief and civil monetary penalties against each defendant. The SEC's investigation was conducted by George N. Stepaniuk, Thomas Peirce, and David Zetlin-Jones of the SEC's New York Regional Office. The SEC's litigation will be conducted by Alexander M. Vasilescu, Victor Suthammanont, and Mr. Zetlin-Jones. The case is being supervised by Sanjay Wadhwa.""" input_tokenized = tokenizer.encode(text, return_tensors='pt',max_length=1024,truncation=True) summary_ids = model.generate(input_tokenized, num_beams=9, no_repeat_ngram_size=3, length_penalty=2.0, min_length=150, max_length=250, early_stopping=True) summary = [tokenizer.decode(g, skip_special_tokens=True, clean_up_tokenization_spaces=False) for g in summary_ids][0] ### Summary Output # The Securities and Exchange Commission today charged AT&T, Inc. and three of its Investor Relations executives with aiding and abetting the company's violations of the antifraud provisions of Section 10(b) of the Securities Exchange Act of 1934 and Rule 10b-5 thereunder. According to the SEC's complaint, the company learned in March 2016 that a steeper-than-expected decline in its first quarter smartphone sales would cause its revenue to fall short of analysts' estimates for the quarter. The complaint alleges that to avoid falling short of the consensus revenue estimate for the third consecutive quarter, the executives made private, one-on-one phone calls to analysts at approximately 20 separate firms. On these calls, the SEC alleges that Christopher Womack, Michael Black, and Kent Evans allegedly disclosed internal smartphone sales data and the impact of that data on internal revenue metrics. The SEC further alleges that as a result of what they were told, the analysts substantially reduced their revenue forecasts, leading to the overall consensus Revenue Estimate falling to just below the level that AT&t ultimately reported to the public on April 26, 2016. The SEC is seeking permanent injunctive relief and civil monetary penalties against each defendant. ``` ## Evaluation results | Model | rouge1 | rouge1-precision | rouge2 | rouge2-precision | rougeL | rougeL-precision | |:-----------:|:-----:|:-----:|:------:|:-----:|:------:|:-----:| | legal-pegasus | **57.39** | **62.97** | **26.85** | **28.42** | **30.91** | **33.22** | | pegasus-cnn_dailymail | 43.16 | 45.68 | 13.75 | 14.56 | 18.82 | 20.07 |
nslingr/first-model
2021-05-01T21:04:45.000Z
[]
[ ".gitattributes" ]
nslingr
0
nthoangcute/vibert-base-cased
2021-05-20T02:05:12.000Z
[ "pytorch", "jax", "bert", "transformers" ]
[ ".gitattributes", "config.json", "flax_model.msgpack", "pytorch_model.bin", "vocab.txt" ]
nthoangcute
11
transformers
ntrnghia/mrpc_vn
2021-05-20T02:08:11.000Z
[ "pytorch", "jax", "bert", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "config.json", "eval_results_mrpc.txt", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt" ]
ntrnghia
24
transformers
ntrnghia/stsb_vn
2021-05-20T02:09:27.000Z
[ "pytorch", "jax", "bert", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "config.json", "eval_results_sts-b.txt", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt" ]
ntrnghia
28
transformers
nucklehead/deepspeech-ht
2021-04-13T11:15:48.000Z
[]
[ ".gitattributes" ]
nucklehead
0
nvidia/megatron-bert-cased-345m
2021-04-23T05:31:12.000Z
[ "arxiv:1909.08053" ]
[ ".gitattributes", "README.md", "tokenizer.json", "tokenizer_config.json", "vocab.txt" ]
nvidia
0
<!--- # ############################################################################################## # # Copyright (c) 2021-, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # ############################################################################################## --> [Megatron](https://arxiv.org/pdf/1909.08053.pdf) is a large, powerful transformer developed by the Applied Deep Learning Research team at NVIDIA. This particular Megatron model was trained from a bidirectional transformer in the style of BERT with text sourced from Wikipedia, RealNews, OpenWebText, and CC-Stories. This model contains 345 million parameters. It is made up of 24 layers, 16 attention heads with a hidden size of 1024. Find more information at [https://github.com/NVIDIA/Megatron-LM](https://github.com/NVIDIA/Megatron-LM) # How to run Megatron BERT using Transformers ## Prerequisites In that guide, we run all the commands from a folder called `$MYDIR` and defined as (in `bash`): ``` export MYDIR=$HOME ``` Feel free to change the location at your convenience. To run some of the commands below, you'll have to clone `Transformers`. ``` git clone https://github.com/huggingface/transformers.git $MYDIR/transformers ``` ## Get the checkpoint from the NVIDIA GPU Cloud You must create a directory called `nvidia/megatron-bert-cased-345m`. ``` mkdir -p $MYDIR/nvidia/megatron-bert-cased-345m ``` You can download the checkpoint from the [NVIDIA GPU Cloud (NGC)](https://ngc.nvidia.com/catalog/models/nvidia:megatron_bert_345m). For that you have to [sign up](https://ngc.nvidia.com/signup) for and setup the NVIDIA GPU Cloud (NGC) Registry CLI. Further documentation for downloading models can be found in the [NGC documentation](https://docs.nvidia.com/dgx/ngc-registry-cli-user-guide/index.html#topic_6_4_1). Alternatively, you can directly download the checkpoint using: ``` wget --content-disposition https://api.ngc.nvidia.com/v2/models/nvidia/megatron_bert_345m/versions/v0.1_cased/zip -O $MYDIR/nvidia/megatron-bert-cased-345m/checkpoint.zip ``` ## Converting the checkpoint In order to be loaded into `Transformers`, the checkpoint has to be converted. You should run the following commands for that purpose. Those commands will create `config.json` and `pytorch_model.bin` in `$MYDIR/nvidia/megatron-bert-cased-345m`. You can move those files to different directories if needed. ``` python3 $MYDIR/transformers/src/transformers/models/megatron_bert/convert_megatron_bert_checkpoint.py $MYDIR/nvidia/megatron-bert-cased-345m/checkpoint.zip ``` ## Masked LM The following code shows how to use the Megatron BERT checkpoint and the Transformers API to perform a `Masked LM` task. ``` import os import torch from transformers import BertTokenizer, MegatronBertForMaskedLM # The tokenizer. Megatron was trained with standard tokenizer(s). tokenizer = BertTokenizer.from_pretrained('nvidia/megatron-bert-cased-345m') # The path to the config/checkpoint (see the conversion step above). directory = os.path.join(os.environ['MYDIR'], 'nvidia/megatron-bert-cased-345m') # Load the model from $MYDIR/nvidia/megatron-bert-cased-345m. model = MegatronBertForMaskedLM.from_pretrained(directory) # Copy to the device and use FP16. assert torch.cuda.is_available() device = torch.device("cuda") model.to(device) model.eval() model.half() # Create inputs (from the BERT example page). input = tokenizer("The capital of France is [MASK]", return_tensors="pt").to(device) label = tokenizer("The capital of France is Paris", return_tensors="pt")["input_ids"].to(device) # Run the model. with torch.no_grad(): output = model(**input, labels=label) print(output) ``` ## Next sentence prediction The following code shows how to use the Megatron BERT checkpoint and the Transformers API to perform next sentence prediction. ``` import os import torch from transformers import BertTokenizer, MegatronBertForNextSentencePrediction # The tokenizer. Megatron was trained with standard tokenizer(s). tokenizer = BertTokenizer.from_pretrained('nvidia/megatron-bert-cased-345m') # The path to the config/checkpoint (see the conversion step above). directory = os.path.join(os.environ['MYDIR'], 'nvidia/megatron-bert-cased-345m') # Load the model from $MYDIR/nvidia/megatron-bert-cased-345m. model = MegatronBertForNextSentencePrediction.from_pretrained(directory) # Copy to the device and use FP16. assert torch.cuda.is_available() device = torch.device("cuda") model.to(device) model.eval() model.half() # Create inputs (from the BERT example page). input = tokenizer('In Italy, pizza served in formal settings is presented unsliced.', 'The sky is blue due to the shorter wavelength of blue light.', return_tensors='pt').to(device) label = torch.LongTensor([1]).to(device) # Run the model. with torch.no_grad(): output = model(**input, labels=label) print(output) ``` # Original code The original code for Megatron can be found here: [https://github.com/NVIDIA/Megatron-LM](https://github.com/NVIDIA/Megatron-LM).
nvidia/megatron-bert-uncased-345m
2021-04-23T05:36:25.000Z
[ "arxiv:1909.08053" ]
[ ".gitattributes", "README.md", "tokenizer.json", "tokenizer_config.json", "vocab.txt" ]
nvidia
0
<!--- # ############################################################################################## # # Copyright (c) 2021-, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # ############################################################################################## --> [Megatron](https://arxiv.org/pdf/1909.08053.pdf) is a large, powerful transformer developed by the Applied Deep Learning Research team at NVIDIA. This particular Megatron model was trained from a bidirectional transformer in the style of BERT with text sourced from Wikipedia, RealNews, OpenWebText, and CC-Stories. This model contains 345 million parameters. It is made up of 24 layers, 16 attention heads with a hidden size of 1024. Find more information at [https://github.com/NVIDIA/Megatron-LM](https://github.com/NVIDIA/Megatron-LM) # How to run Megatron BERT using Transformers ## Prerequisites In that guide, we run all the commands from a folder called `$MYDIR` and defined as (in `bash`): ``` export MYDIR=$HOME ``` Feel free to change the location at your convenience. To run some of the commands below, you'll have to clone `Transformers`. ``` git clone https://github.com/huggingface/transformers.git $MYDIR/transformers ``` ## Get the checkpoint from the NVIDIA GPU Cloud You must create a directory called `nvidia/megatron-bert-uncased-345m`. ``` mkdir -p $MYDIR/nvidia/megatron-bert-uncased-345m ``` You can download the checkpoint from the [NVIDIA GPU Cloud (NGC)](https://ngc.nvidia.com/catalog/models/nvidia:megatron_bert_345m). For that you have to [sign up](https://ngc.nvidia.com/signup) for and setup the NVIDIA GPU Cloud (NGC) Registry CLI. Further documentation for downloading models can be found in the [NGC documentation](https://docs.nvidia.com/dgx/ngc-registry-cli-user-guide/index.html#topic_6_4_1). Alternatively, you can directly download the checkpoint using: ``` wget --content-disposition https://api.ngc.nvidia.com/v2/models/nvidia/megatron_bert_345m/versions/v0.1_uncased/zip -O $MYDIR/nvidia/megatron-bert-uncased-345m/checkpoint.zip ``` ## Converting the checkpoint In order to be loaded into `Transformers`, the checkpoint has to be converted. You should run the following commands for that purpose. Those commands will create `config.json` and `pytorch_model.bin` in `$MYDIR/nvidia/megatron-bert-{cased,uncased}-345m`. You can move those files to different directories if needed. ``` python3 $MYDIR/transformers/src/transformers/models/megatron_bert/convert_megatron_bert_checkpoint.py $MYDIR/nvidia/megatron-bert-uncased-345m/checkpoint.zip ``` ## Masked LM The following code shows how to use the Megatron BERT checkpoint and the Transformers API to perform a `Masked LM` task. ``` import os import torch from transformers import BertTokenizer, MegatronBertForMaskedLM # The tokenizer. Megatron was trained with standard tokenizer(s). tokenizer = BertTokenizer.from_pretrained('nvidia/megatron-bert-uncased-345m') # The path to the config/checkpoint (see the conversion step above). directory = os.path.join(os.environ['MYDIR'], 'nvidia/megatron-bert-uncased-345m') # Load the model from $MYDIR/nvidia/megatron-bert-uncased-345m. model = MegatronBertForMaskedLM.from_pretrained(directory) # Copy to the device and use FP16. assert torch.cuda.is_available() device = torch.device("cuda") model.to(device) model.eval() model.half() # Create inputs (from the BERT example page). input = tokenizer("The capital of France is [MASK]", return_tensors="pt").to(device) label = tokenizer("The capital of France is Paris", return_tensors="pt")["input_ids"].to(device) # Run the model. with torch.no_grad(): output = model(**input, labels=label) print(output) ``` ## Next sentence prediction The following code shows how to use the Megatron BERT checkpoint and the Transformers API to perform next sentence prediction. ``` import os import torch from transformers import BertTokenizer, MegatronBertForNextSentencePrediction # The tokenizer. Megatron was trained with standard tokenizer(s). tokenizer = BertTokenizer.from_pretrained('nvidia/megatron-bert-uncased-345m') # The path to the config/checkpoint (see the conversion step above). directory = os.path.join(os.environ['MYDIR'], 'nvidia/megatron-bert-uncased-345m') # Load the model from $MYDIR/nvidia/megatron-bert-uncased-345m. model = MegatronBertForNextSentencePrediction.from_pretrained(directory) # Copy to the device and use FP16. assert torch.cuda.is_available() device = torch.device("cuda") model.to(device) model.eval() model.half() # Create inputs (from the BERT example page). input = tokenizer('In Italy, pizza served in formal settings is presented unsliced.', 'The sky is blue due to the shorter wavelength of blue light.', return_tensors='pt').to(device) label = torch.LongTensor([1]).to(device) # Run the model. with torch.no_grad(): output = model(**input, labels=label) print(output) ``` # Original code The original code for Megatron can be found here: [https://github.com/NVIDIA/Megatron-LM](https://github.com/NVIDIA/Megatron-LM).
nvidia/megatron-gpt2-345m
2021-05-11T19:08:10.000Z
[ "arxiv:1909.08053" ]
[ ".gitattributes", "README.md", "merges.txt", "tokenizer.json", "vocab.json" ]
nvidia
0
<!--- # ############################################################################################## # # Copyright (c) 2021-, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # ############################################################################################## --> [Megatron](https://arxiv.org/pdf/1909.08053.pdf) is a large, powerful transformer developed by the Applied Deep Learning Research team at NVIDIA. This particular Megatron model was trained from a generative, left-to-right transformer in the style of GPT-2. This model was trained on text sourced from Wikipedia, RealNews, OpenWebText, and CC-Stories. It contains 345 million parameters. Find more information at [https://github.com/NVIDIA/Megatron-LM](https://github.com/NVIDIA/Megatron-LM) # How to run Megatron GPT2 using Transformers ## Prerequisites In that guide, we run all the commands from a folder called `$MYDIR` and defined as (in `bash`): ``` export MYDIR=$HOME ``` Feel free to change the location at your convenience. To run some of the commands below, you'll have to clone `Transformers`. ``` git clone https://github.com/huggingface/transformers.git $MYDIR/transformers ``` ## Get the checkpoints from the NVIDIA GPU Cloud You must create a directory called `nvidia/megatron-gpt2-345m`: ``` mkdir -p $MYDIR/nvidia/megatron-gpt2-345m ``` You can download the checkpoints from the [NVIDIA GPU Cloud (NGC)](https://ngc.nvidia.com/catalog/models/nvidia:megatron_lm_345m). For that you have to [sign up](https://ngc.nvidia.com/signup) for and setup the NVIDIA GPU Cloud (NGC) Registry CLI. Further documentation for downloading models can be found in the [NGC documentation](https://docs.nvidia.com/dgx/ngc-registry-cli-user-guide/index.html#topic_6_4_1). Alternatively, you can directly download the checkpoints using: ``` wget --content-disposition https://api.ngc.nvidia.com/v2/models/nvidia/megatron_lm_345m/versions/v0.0/zip -O $MYDIR/nvidia/megatron-gpt2-345m/checkpoint.zip ``` ## Converting the checkpoint In order to be loaded into `Transformers`, the checkpoint has to be converted. You should run the following command for that purpose. That command will create `config.json` and `pytorch_model.bin` in `$MYDIR/nvidia/megatron-gpt2-345m`. You can move those files to different directories if needed. ``` python3 $MYDIR/transformers/src/transformers/models/megatron_gpt2/convert_megatron_gpt2_checkpoint.py $MYDIR/nvidia/megatron-gpt2-345m/checkpoint.zip ``` ## Text generation The following code shows how to use the Megatron GPT2 checkpoint and the Transformers API to generate text. ``` import os import torch from transformers import GPT2Tokenizer, GPT2LMHeadModel # The tokenizer. Megatron was trained with standard tokenizer(s). tokenizer = GPT2Tokenizer.from_pretrained('gpt2') # The path to the config/checkpoint (see the conversion step above). directory = os.path.join(os.environ['MYDIR'], 'nvidia/megatron-gpt2-345m') # Load the model from $MYDIR/nvidia/megatron-gpt2-345m. model = GPT2LMHeadModel.from_pretrained(directory) # Copy to the device and use FP16. assert torch.cuda.is_available() device = torch.device("cuda") model.to(device) model.eval() model.half() # Generate the sentence. output = model.generate(input_ids=None, max_length=32, num_return_sequences=1) # Output the text. for sentence in output: sentence = sentence.tolist() text = tokenizer.decode(sentence, clean_up_tokenization_spaces=True) print(text) ``` # To use this as a normal HuggingFace model If you want to use this model with HF Trainer, here is a quick way to do that: 1. Download nvidia checkpoint: ``` wget --content-disposition https://api.ngc.nvidia.com/v2/models/nvidia/megatron_lm_345m/versions/v0.0/zip -O megatron_lm_345m_v0.0.zip ``` 2. Convert: ``` python src/transformers/models/megatron_gpt2/convert_megatron_gpt2_checkpoint.py megatron_lm_345m_v0.0.zip ``` 3. Fetch missing files ``` git clone https://huggingface.co/nvidia/megatron-gpt2-345m/ ``` 4. Move the converted files into the cloned model dir ``` mv config.json pytorch_model.bin megatron-gpt2-345m/ ``` 5. The `megatron-gpt2-345m` dir should now have all the files which can be passed to HF Trainer as `--model_name_or_path megatron-gpt2-345m` # Original code The original Megatron code can be found here: [https://github.com/NVIDIA/Megatron-LM](https://github.com/NVIDIA/Megatron-LM).
nytestalkerq/DialoGPT-medium-joshua
2021-06-04T02:29:58.000Z
[ "pytorch", "gpt2", "lm-head", "causal-lm", "transformers", "conversational", "license:mit", "text-generation" ]
conversational
[ ".gitattributes", "README.md", "config.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer.json", "tokenizer_config.json", "vocab.json" ]
nytestalkerq
33
transformers
--- thumbnail: https://huggingface.co/front/thumbnails/dialogpt.png tags: - conversational license: mit --- # DialoGPT Trained on the Speech of a Game Character This is an instance of [microsoft/DialoGPT-medium](https://huggingface.co/microsoft/DialoGPT-medium) trained on a game character, Joshua from [The World Ends With You](https://en.wikipedia.org/wiki/The_World_Ends_with_You). The data comes from [a Kaggle game script dataset](https://www.kaggle.com/ruolinzheng/twewy-game-script). Chat with the model: ```python from transformers import AutoTokenizer, AutoModelWithLMHead tokenizer = AutoTokenizer.from_pretrained("r3dhummingbird/DialoGPT-medium-joshua") model = AutoModelWithLMHead.from_pretrained("r3dhummingbird/DialoGPT-medium-joshua") # Let's chat for 4 lines for step in range(4): # encode the new user input, add the eos_token and return a tensor in Pytorch new_user_input_ids = tokenizer.encode(input(">> User:") + tokenizer.eos_token, return_tensors='pt') # print(new_user_input_ids) # append the new user input tokens to the chat history bot_input_ids = torch.cat([chat_history_ids, new_user_input_ids], dim=-1) if step > 0 else new_user_input_ids # generated a response while limiting the total chat history to 1000 tokens, chat_history_ids = model.generate( bot_input_ids, max_length=200, pad_token_id=tokenizer.eos_token_id, no_repeat_ngram_size=3, do_sample=True, top_k=100, top_p=0.7, temperature=0.8 ) # pretty print last ouput tokens from bot print("JoshuaBot: {}".format(tokenizer.decode(chat_history_ids[:, bot_input_ids.shape[-1]:][0], skip_special_tokens=True))) ```
nyu-mll/roberta-base-100M-1
2021-05-20T18:53:55.000Z
[ "pytorch", "jax", "roberta", "masked-lm", "transformers", "fill-mask" ]
fill-mask
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "vocab.json" ]
nyu-mll
21
transformers
# RoBERTa Pretrained on Smaller Datasets We pretrain RoBERTa on smaller datasets (1M, 10M, 100M, 1B tokens). We release 3 models with lowest perplexities for each pretraining data size out of 25 runs (or 10 in the case of 1B tokens). The pretraining data reproduces that of BERT: We combine English Wikipedia and a reproduction of BookCorpus using texts from smashwords in a ratio of approximately 3:1. ### Hyperparameters and Validation Perplexity The hyperparameters and validation perplexities corresponding to each model are as follows: | Model Name | Training Size | Model Size | Max Steps | Batch Size | Validation Perplexity | |--------------------------|---------------|------------|-----------|------------|-----------------------| | [roberta-base-1B-1][link-roberta-base-1B-1] | 1B | BASE | 100K | 512 | 3.93 | | [roberta-base-1B-2][link-roberta-base-1B-2] | 1B | BASE | 31K | 1024 | 4.25 | | [roberta-base-1B-3][link-roberta-base-1B-3] | 1B | BASE | 31K | 4096 | 3.84 | | [roberta-base-100M-1][link-roberta-base-100M-1] | 100M | BASE | 100K | 512 | 4.99 | | [roberta-base-100M-2][link-roberta-base-100M-2] | 100M | BASE | 31K | 1024 | 4.61 | | [roberta-base-100M-3][link-roberta-base-100M-3] | 100M | BASE | 31K | 512 | 5.02 | | [roberta-base-10M-1][link-roberta-base-10M-1] | 10M | BASE | 10K | 1024 | 11.31 | | [roberta-base-10M-2][link-roberta-base-10M-2] | 10M | BASE | 10K | 512 | 10.78 | | [roberta-base-10M-3][link-roberta-base-10M-3] | 10M | BASE | 31K | 512 | 11.58 | | [roberta-med-small-1M-1][link-roberta-med-small-1M-1] | 1M | MED-SMALL | 100K | 512 | 153.38 | | [roberta-med-small-1M-2][link-roberta-med-small-1M-2] | 1M | MED-SMALL | 10K | 512 | 134.18 | | [roberta-med-small-1M-3][link-roberta-med-small-1M-3] | 1M | MED-SMALL | 31K | 512 | 139.39 | The hyperparameters corresponding to model sizes mentioned above are as follows: | Model Size | L | AH | HS | FFN | P | |------------|----|----|-----|------|------| | BASE | 12 | 12 | 768 | 3072 | 125M | | MED-SMALL | 6 | 8 | 512 | 2048 | 45M | (AH = number of attention heads; HS = hidden size; FFN = feedforward network dimension; P = number of parameters.) For other hyperparameters, we select: - Peak Learning rate: 5e-4 - Warmup Steps: 6% of max steps - Dropout: 0.1 [link-roberta-med-small-1M-1]: https://huggingface.co/nyu-mll/roberta-med-small-1M-1 [link-roberta-med-small-1M-2]: https://huggingface.co/nyu-mll/roberta-med-small-1M-2 [link-roberta-med-small-1M-3]: https://huggingface.co/nyu-mll/roberta-med-small-1M-3 [link-roberta-base-10M-1]: https://huggingface.co/nyu-mll/roberta-base-10M-1 [link-roberta-base-10M-2]: https://huggingface.co/nyu-mll/roberta-base-10M-2 [link-roberta-base-10M-3]: https://huggingface.co/nyu-mll/roberta-base-10M-3 [link-roberta-base-100M-1]: https://huggingface.co/nyu-mll/roberta-base-100M-1 [link-roberta-base-100M-2]: https://huggingface.co/nyu-mll/roberta-base-100M-2 [link-roberta-base-100M-3]: https://huggingface.co/nyu-mll/roberta-base-100M-3 [link-roberta-base-1B-1]: https://huggingface.co/nyu-mll/roberta-base-1B-1 [link-roberta-base-1B-2]: https://huggingface.co/nyu-mll/roberta-base-1B-2 [link-roberta-base-1B-3]: https://huggingface.co/nyu-mll/roberta-base-1B-3
nyu-mll/roberta-base-100M-2
2021-05-20T18:54:59.000Z
[ "pytorch", "jax", "roberta", "masked-lm", "transformers", "fill-mask" ]
fill-mask
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "vocab.json" ]
nyu-mll
8,996
transformers
# RoBERTa Pretrained on Smaller Datasets We pretrain RoBERTa on smaller datasets (1M, 10M, 100M, 1B tokens). We release 3 models with lowest perplexities for each pretraining data size out of 25 runs (or 10 in the case of 1B tokens). The pretraining data reproduces that of BERT: We combine English Wikipedia and a reproduction of BookCorpus using texts from smashwords in a ratio of approximately 3:1. ### Hyperparameters and Validation Perplexity The hyperparameters and validation perplexities corresponding to each model are as follows: | Model Name | Training Size | Model Size | Max Steps | Batch Size | Validation Perplexity | |--------------------------|---------------|------------|-----------|------------|-----------------------| | [roberta-base-1B-1][link-roberta-base-1B-1] | 1B | BASE | 100K | 512 | 3.93 | | [roberta-base-1B-2][link-roberta-base-1B-2] | 1B | BASE | 31K | 1024 | 4.25 | | [roberta-base-1B-3][link-roberta-base-1B-3] | 1B | BASE | 31K | 4096 | 3.84 | | [roberta-base-100M-1][link-roberta-base-100M-1] | 100M | BASE | 100K | 512 | 4.99 | | [roberta-base-100M-2][link-roberta-base-100M-2] | 100M | BASE | 31K | 1024 | 4.61 | | [roberta-base-100M-3][link-roberta-base-100M-3] | 100M | BASE | 31K | 512 | 5.02 | | [roberta-base-10M-1][link-roberta-base-10M-1] | 10M | BASE | 10K | 1024 | 11.31 | | [roberta-base-10M-2][link-roberta-base-10M-2] | 10M | BASE | 10K | 512 | 10.78 | | [roberta-base-10M-3][link-roberta-base-10M-3] | 10M | BASE | 31K | 512 | 11.58 | | [roberta-med-small-1M-1][link-roberta-med-small-1M-1] | 1M | MED-SMALL | 100K | 512 | 153.38 | | [roberta-med-small-1M-2][link-roberta-med-small-1M-2] | 1M | MED-SMALL | 10K | 512 | 134.18 | | [roberta-med-small-1M-3][link-roberta-med-small-1M-3] | 1M | MED-SMALL | 31K | 512 | 139.39 | The hyperparameters corresponding to model sizes mentioned above are as follows: | Model Size | L | AH | HS | FFN | P | |------------|----|----|-----|------|------| | BASE | 12 | 12 | 768 | 3072 | 125M | | MED-SMALL | 6 | 8 | 512 | 2048 | 45M | (AH = number of attention heads; HS = hidden size; FFN = feedforward network dimension; P = number of parameters.) For other hyperparameters, we select: - Peak Learning rate: 5e-4 - Warmup Steps: 6% of max steps - Dropout: 0.1 [link-roberta-med-small-1M-1]: https://huggingface.co/nyu-mll/roberta-med-small-1M-1 [link-roberta-med-small-1M-2]: https://huggingface.co/nyu-mll/roberta-med-small-1M-2 [link-roberta-med-small-1M-3]: https://huggingface.co/nyu-mll/roberta-med-small-1M-3 [link-roberta-base-10M-1]: https://huggingface.co/nyu-mll/roberta-base-10M-1 [link-roberta-base-10M-2]: https://huggingface.co/nyu-mll/roberta-base-10M-2 [link-roberta-base-10M-3]: https://huggingface.co/nyu-mll/roberta-base-10M-3 [link-roberta-base-100M-1]: https://huggingface.co/nyu-mll/roberta-base-100M-1 [link-roberta-base-100M-2]: https://huggingface.co/nyu-mll/roberta-base-100M-2 [link-roberta-base-100M-3]: https://huggingface.co/nyu-mll/roberta-base-100M-3 [link-roberta-base-1B-1]: https://huggingface.co/nyu-mll/roberta-base-1B-1 [link-roberta-base-1B-2]: https://huggingface.co/nyu-mll/roberta-base-1B-2 [link-roberta-base-1B-3]: https://huggingface.co/nyu-mll/roberta-base-1B-3
nyu-mll/roberta-base-100M-3
2021-05-20T18:56:02.000Z
[ "pytorch", "jax", "roberta", "masked-lm", "transformers", "fill-mask" ]
fill-mask
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "vocab.json" ]
nyu-mll
13
transformers
# RoBERTa Pretrained on Smaller Datasets We pretrain RoBERTa on smaller datasets (1M, 10M, 100M, 1B tokens). We release 3 models with lowest perplexities for each pretraining data size out of 25 runs (or 10 in the case of 1B tokens). The pretraining data reproduces that of BERT: We combine English Wikipedia and a reproduction of BookCorpus using texts from smashwords in a ratio of approximately 3:1. ### Hyperparameters and Validation Perplexity The hyperparameters and validation perplexities corresponding to each model are as follows: | Model Name | Training Size | Model Size | Max Steps | Batch Size | Validation Perplexity | |--------------------------|---------------|------------|-----------|------------|-----------------------| | [roberta-base-1B-1][link-roberta-base-1B-1] | 1B | BASE | 100K | 512 | 3.93 | | [roberta-base-1B-2][link-roberta-base-1B-2] | 1B | BASE | 31K | 1024 | 4.25 | | [roberta-base-1B-3][link-roberta-base-1B-3] | 1B | BASE | 31K | 4096 | 3.84 | | [roberta-base-100M-1][link-roberta-base-100M-1] | 100M | BASE | 100K | 512 | 4.99 | | [roberta-base-100M-2][link-roberta-base-100M-2] | 100M | BASE | 31K | 1024 | 4.61 | | [roberta-base-100M-3][link-roberta-base-100M-3] | 100M | BASE | 31K | 512 | 5.02 | | [roberta-base-10M-1][link-roberta-base-10M-1] | 10M | BASE | 10K | 1024 | 11.31 | | [roberta-base-10M-2][link-roberta-base-10M-2] | 10M | BASE | 10K | 512 | 10.78 | | [roberta-base-10M-3][link-roberta-base-10M-3] | 10M | BASE | 31K | 512 | 11.58 | | [roberta-med-small-1M-1][link-roberta-med-small-1M-1] | 1M | MED-SMALL | 100K | 512 | 153.38 | | [roberta-med-small-1M-2][link-roberta-med-small-1M-2] | 1M | MED-SMALL | 10K | 512 | 134.18 | | [roberta-med-small-1M-3][link-roberta-med-small-1M-3] | 1M | MED-SMALL | 31K | 512 | 139.39 | The hyperparameters corresponding to model sizes mentioned above are as follows: | Model Size | L | AH | HS | FFN | P | |------------|----|----|-----|------|------| | BASE | 12 | 12 | 768 | 3072 | 125M | | MED-SMALL | 6 | 8 | 512 | 2048 | 45M | (AH = number of attention heads; HS = hidden size; FFN = feedforward network dimension; P = number of parameters.) For other hyperparameters, we select: - Peak Learning rate: 5e-4 - Warmup Steps: 6% of max steps - Dropout: 0.1 [link-roberta-med-small-1M-1]: https://huggingface.co/nyu-mll/roberta-med-small-1M-1 [link-roberta-med-small-1M-2]: https://huggingface.co/nyu-mll/roberta-med-small-1M-2 [link-roberta-med-small-1M-3]: https://huggingface.co/nyu-mll/roberta-med-small-1M-3 [link-roberta-base-10M-1]: https://huggingface.co/nyu-mll/roberta-base-10M-1 [link-roberta-base-10M-2]: https://huggingface.co/nyu-mll/roberta-base-10M-2 [link-roberta-base-10M-3]: https://huggingface.co/nyu-mll/roberta-base-10M-3 [link-roberta-base-100M-1]: https://huggingface.co/nyu-mll/roberta-base-100M-1 [link-roberta-base-100M-2]: https://huggingface.co/nyu-mll/roberta-base-100M-2 [link-roberta-base-100M-3]: https://huggingface.co/nyu-mll/roberta-base-100M-3 [link-roberta-base-1B-1]: https://huggingface.co/nyu-mll/roberta-base-1B-1 [link-roberta-base-1B-2]: https://huggingface.co/nyu-mll/roberta-base-1B-2 [link-roberta-base-1B-3]: https://huggingface.co/nyu-mll/roberta-base-1B-3
nyu-mll/roberta-base-10M-1
2021-05-20T18:57:10.000Z
[ "pytorch", "jax", "roberta", "masked-lm", "transformers", "fill-mask" ]
fill-mask
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "vocab.json" ]
nyu-mll
29
transformers
# RoBERTa Pretrained on Smaller Datasets We pretrain RoBERTa on smaller datasets (1M, 10M, 100M, 1B tokens). We release 3 models with lowest perplexities for each pretraining data size out of 25 runs (or 10 in the case of 1B tokens). The pretraining data reproduces that of BERT: We combine English Wikipedia and a reproduction of BookCorpus using texts from smashwords in a ratio of approximately 3:1. ### Hyperparameters and Validation Perplexity The hyperparameters and validation perplexities corresponding to each model are as follows: | Model Name | Training Size | Model Size | Max Steps | Batch Size | Validation Perplexity | |--------------------------|---------------|------------|-----------|------------|-----------------------| | [roberta-base-1B-1][link-roberta-base-1B-1] | 1B | BASE | 100K | 512 | 3.93 | | [roberta-base-1B-2][link-roberta-base-1B-2] | 1B | BASE | 31K | 1024 | 4.25 | | [roberta-base-1B-3][link-roberta-base-1B-3] | 1B | BASE | 31K | 4096 | 3.84 | | [roberta-base-100M-1][link-roberta-base-100M-1] | 100M | BASE | 100K | 512 | 4.99 | | [roberta-base-100M-2][link-roberta-base-100M-2] | 100M | BASE | 31K | 1024 | 4.61 | | [roberta-base-100M-3][link-roberta-base-100M-3] | 100M | BASE | 31K | 512 | 5.02 | | [roberta-base-10M-1][link-roberta-base-10M-1] | 10M | BASE | 10K | 1024 | 11.31 | | [roberta-base-10M-2][link-roberta-base-10M-2] | 10M | BASE | 10K | 512 | 10.78 | | [roberta-base-10M-3][link-roberta-base-10M-3] | 10M | BASE | 31K | 512 | 11.58 | | [roberta-med-small-1M-1][link-roberta-med-small-1M-1] | 1M | MED-SMALL | 100K | 512 | 153.38 | | [roberta-med-small-1M-2][link-roberta-med-small-1M-2] | 1M | MED-SMALL | 10K | 512 | 134.18 | | [roberta-med-small-1M-3][link-roberta-med-small-1M-3] | 1M | MED-SMALL | 31K | 512 | 139.39 | The hyperparameters corresponding to model sizes mentioned above are as follows: | Model Size | L | AH | HS | FFN | P | |------------|----|----|-----|------|------| | BASE | 12 | 12 | 768 | 3072 | 125M | | MED-SMALL | 6 | 8 | 512 | 2048 | 45M | (AH = number of attention heads; HS = hidden size; FFN = feedforward network dimension; P = number of parameters.) For other hyperparameters, we select: - Peak Learning rate: 5e-4 - Warmup Steps: 6% of max steps - Dropout: 0.1 [link-roberta-med-small-1M-1]: https://huggingface.co/nyu-mll/roberta-med-small-1M-1 [link-roberta-med-small-1M-2]: https://huggingface.co/nyu-mll/roberta-med-small-1M-2 [link-roberta-med-small-1M-3]: https://huggingface.co/nyu-mll/roberta-med-small-1M-3 [link-roberta-base-10M-1]: https://huggingface.co/nyu-mll/roberta-base-10M-1 [link-roberta-base-10M-2]: https://huggingface.co/nyu-mll/roberta-base-10M-2 [link-roberta-base-10M-3]: https://huggingface.co/nyu-mll/roberta-base-10M-3 [link-roberta-base-100M-1]: https://huggingface.co/nyu-mll/roberta-base-100M-1 [link-roberta-base-100M-2]: https://huggingface.co/nyu-mll/roberta-base-100M-2 [link-roberta-base-100M-3]: https://huggingface.co/nyu-mll/roberta-base-100M-3 [link-roberta-base-1B-1]: https://huggingface.co/nyu-mll/roberta-base-1B-1 [link-roberta-base-1B-2]: https://huggingface.co/nyu-mll/roberta-base-1B-2 [link-roberta-base-1B-3]: https://huggingface.co/nyu-mll/roberta-base-1B-3
nyu-mll/roberta-base-10M-2
2021-05-20T18:58:09.000Z
[ "pytorch", "jax", "roberta", "masked-lm", "transformers", "fill-mask" ]
fill-mask
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "vocab.json" ]
nyu-mll
10,211
transformers
# RoBERTa Pretrained on Smaller Datasets We pretrain RoBERTa on smaller datasets (1M, 10M, 100M, 1B tokens). We release 3 models with lowest perplexities for each pretraining data size out of 25 runs (or 10 in the case of 1B tokens). The pretraining data reproduces that of BERT: We combine English Wikipedia and a reproduction of BookCorpus using texts from smashwords in a ratio of approximately 3:1. ### Hyperparameters and Validation Perplexity The hyperparameters and validation perplexities corresponding to each model are as follows: | Model Name | Training Size | Model Size | Max Steps | Batch Size | Validation Perplexity | |--------------------------|---------------|------------|-----------|------------|-----------------------| | [roberta-base-1B-1][link-roberta-base-1B-1] | 1B | BASE | 100K | 512 | 3.93 | | [roberta-base-1B-2][link-roberta-base-1B-2] | 1B | BASE | 31K | 1024 | 4.25 | | [roberta-base-1B-3][link-roberta-base-1B-3] | 1B | BASE | 31K | 4096 | 3.84 | | [roberta-base-100M-1][link-roberta-base-100M-1] | 100M | BASE | 100K | 512 | 4.99 | | [roberta-base-100M-2][link-roberta-base-100M-2] | 100M | BASE | 31K | 1024 | 4.61 | | [roberta-base-100M-3][link-roberta-base-100M-3] | 100M | BASE | 31K | 512 | 5.02 | | [roberta-base-10M-1][link-roberta-base-10M-1] | 10M | BASE | 10K | 1024 | 11.31 | | [roberta-base-10M-2][link-roberta-base-10M-2] | 10M | BASE | 10K | 512 | 10.78 | | [roberta-base-10M-3][link-roberta-base-10M-3] | 10M | BASE | 31K | 512 | 11.58 | | [roberta-med-small-1M-1][link-roberta-med-small-1M-1] | 1M | MED-SMALL | 100K | 512 | 153.38 | | [roberta-med-small-1M-2][link-roberta-med-small-1M-2] | 1M | MED-SMALL | 10K | 512 | 134.18 | | [roberta-med-small-1M-3][link-roberta-med-small-1M-3] | 1M | MED-SMALL | 31K | 512 | 139.39 | The hyperparameters corresponding to model sizes mentioned above are as follows: | Model Size | L | AH | HS | FFN | P | |------------|----|----|-----|------|------| | BASE | 12 | 12 | 768 | 3072 | 125M | | MED-SMALL | 6 | 8 | 512 | 2048 | 45M | (AH = number of attention heads; HS = hidden size; FFN = feedforward network dimension; P = number of parameters.) For other hyperparameters, we select: - Peak Learning rate: 5e-4 - Warmup Steps: 6% of max steps - Dropout: 0.1 [link-roberta-med-small-1M-1]: https://huggingface.co/nyu-mll/roberta-med-small-1M-1 [link-roberta-med-small-1M-2]: https://huggingface.co/nyu-mll/roberta-med-small-1M-2 [link-roberta-med-small-1M-3]: https://huggingface.co/nyu-mll/roberta-med-small-1M-3 [link-roberta-base-10M-1]: https://huggingface.co/nyu-mll/roberta-base-10M-1 [link-roberta-base-10M-2]: https://huggingface.co/nyu-mll/roberta-base-10M-2 [link-roberta-base-10M-3]: https://huggingface.co/nyu-mll/roberta-base-10M-3 [link-roberta-base-100M-1]: https://huggingface.co/nyu-mll/roberta-base-100M-1 [link-roberta-base-100M-2]: https://huggingface.co/nyu-mll/roberta-base-100M-2 [link-roberta-base-100M-3]: https://huggingface.co/nyu-mll/roberta-base-100M-3 [link-roberta-base-1B-1]: https://huggingface.co/nyu-mll/roberta-base-1B-1 [link-roberta-base-1B-2]: https://huggingface.co/nyu-mll/roberta-base-1B-2 [link-roberta-base-1B-3]: https://huggingface.co/nyu-mll/roberta-base-1B-3
nyu-mll/roberta-base-10M-3
2021-05-20T19:00:36.000Z
[ "pytorch", "jax", "roberta", "masked-lm", "transformers", "fill-mask" ]
fill-mask
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "vocab.json" ]
nyu-mll
16
transformers
# RoBERTa Pretrained on Smaller Datasets We pretrain RoBERTa on smaller datasets (1M, 10M, 100M, 1B tokens). We release 3 models with lowest perplexities for each pretraining data size out of 25 runs (or 10 in the case of 1B tokens). The pretraining data reproduces that of BERT: We combine English Wikipedia and a reproduction of BookCorpus using texts from smashwords in a ratio of approximately 3:1. ### Hyperparameters and Validation Perplexity The hyperparameters and validation perplexities corresponding to each model are as follows: | Model Name | Training Size | Model Size | Max Steps | Batch Size | Validation Perplexity | |--------------------------|---------------|------------|-----------|------------|-----------------------| | [roberta-base-1B-1][link-roberta-base-1B-1] | 1B | BASE | 100K | 512 | 3.93 | | [roberta-base-1B-2][link-roberta-base-1B-2] | 1B | BASE | 31K | 1024 | 4.25 | | [roberta-base-1B-3][link-roberta-base-1B-3] | 1B | BASE | 31K | 4096 | 3.84 | | [roberta-base-100M-1][link-roberta-base-100M-1] | 100M | BASE | 100K | 512 | 4.99 | | [roberta-base-100M-2][link-roberta-base-100M-2] | 100M | BASE | 31K | 1024 | 4.61 | | [roberta-base-100M-3][link-roberta-base-100M-3] | 100M | BASE | 31K | 512 | 5.02 | | [roberta-base-10M-1][link-roberta-base-10M-1] | 10M | BASE | 10K | 1024 | 11.31 | | [roberta-base-10M-2][link-roberta-base-10M-2] | 10M | BASE | 10K | 512 | 10.78 | | [roberta-base-10M-3][link-roberta-base-10M-3] | 10M | BASE | 31K | 512 | 11.58 | | [roberta-med-small-1M-1][link-roberta-med-small-1M-1] | 1M | MED-SMALL | 100K | 512 | 153.38 | | [roberta-med-small-1M-2][link-roberta-med-small-1M-2] | 1M | MED-SMALL | 10K | 512 | 134.18 | | [roberta-med-small-1M-3][link-roberta-med-small-1M-3] | 1M | MED-SMALL | 31K | 512 | 139.39 | The hyperparameters corresponding to model sizes mentioned above are as follows: | Model Size | L | AH | HS | FFN | P | |------------|----|----|-----|------|------| | BASE | 12 | 12 | 768 | 3072 | 125M | | MED-SMALL | 6 | 8 | 512 | 2048 | 45M | (AH = number of attention heads; HS = hidden size; FFN = feedforward network dimension; P = number of parameters.) For other hyperparameters, we select: - Peak Learning rate: 5e-4 - Warmup Steps: 6% of max steps - Dropout: 0.1 [link-roberta-med-small-1M-1]: https://huggingface.co/nyu-mll/roberta-med-small-1M-1 [link-roberta-med-small-1M-2]: https://huggingface.co/nyu-mll/roberta-med-small-1M-2 [link-roberta-med-small-1M-3]: https://huggingface.co/nyu-mll/roberta-med-small-1M-3 [link-roberta-base-10M-1]: https://huggingface.co/nyu-mll/roberta-base-10M-1 [link-roberta-base-10M-2]: https://huggingface.co/nyu-mll/roberta-base-10M-2 [link-roberta-base-10M-3]: https://huggingface.co/nyu-mll/roberta-base-10M-3 [link-roberta-base-100M-1]: https://huggingface.co/nyu-mll/roberta-base-100M-1 [link-roberta-base-100M-2]: https://huggingface.co/nyu-mll/roberta-base-100M-2 [link-roberta-base-100M-3]: https://huggingface.co/nyu-mll/roberta-base-100M-3 [link-roberta-base-1B-1]: https://huggingface.co/nyu-mll/roberta-base-1B-1 [link-roberta-base-1B-2]: https://huggingface.co/nyu-mll/roberta-base-1B-2 [link-roberta-base-1B-3]: https://huggingface.co/nyu-mll/roberta-base-1B-3
nyu-mll/roberta-base-1B-1
2021-05-20T19:03:06.000Z
[ "pytorch", "jax", "roberta", "masked-lm", "transformers", "fill-mask" ]
fill-mask
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "vocab.json" ]
nyu-mll
26
transformers
# RoBERTa Pretrained on Smaller Datasets We pretrain RoBERTa on smaller datasets (1M, 10M, 100M, 1B tokens). We release 3 models with lowest perplexities for each pretraining data size out of 25 runs (or 10 in the case of 1B tokens). The pretraining data reproduces that of BERT: We combine English Wikipedia and a reproduction of BookCorpus using texts from smashwords in a ratio of approximately 3:1. ### Hyperparameters and Validation Perplexity The hyperparameters and validation perplexities corresponding to each model are as follows: | Model Name | Training Size | Model Size | Max Steps | Batch Size | Validation Perplexity | |--------------------------|---------------|------------|-----------|------------|-----------------------| | [roberta-base-1B-1][link-roberta-base-1B-1] | 1B | BASE | 100K | 512 | 3.93 | | [roberta-base-1B-2][link-roberta-base-1B-2] | 1B | BASE | 31K | 1024 | 4.25 | | [roberta-base-1B-3][link-roberta-base-1B-3] | 1B | BASE | 31K | 4096 | 3.84 | | [roberta-base-100M-1][link-roberta-base-100M-1] | 100M | BASE | 100K | 512 | 4.99 | | [roberta-base-100M-2][link-roberta-base-100M-2] | 100M | BASE | 31K | 1024 | 4.61 | | [roberta-base-100M-3][link-roberta-base-100M-3] | 100M | BASE | 31K | 512 | 5.02 | | [roberta-base-10M-1][link-roberta-base-10M-1] | 10M | BASE | 10K | 1024 | 11.31 | | [roberta-base-10M-2][link-roberta-base-10M-2] | 10M | BASE | 10K | 512 | 10.78 | | [roberta-base-10M-3][link-roberta-base-10M-3] | 10M | BASE | 31K | 512 | 11.58 | | [roberta-med-small-1M-1][link-roberta-med-small-1M-1] | 1M | MED-SMALL | 100K | 512 | 153.38 | | [roberta-med-small-1M-2][link-roberta-med-small-1M-2] | 1M | MED-SMALL | 10K | 512 | 134.18 | | [roberta-med-small-1M-3][link-roberta-med-small-1M-3] | 1M | MED-SMALL | 31K | 512 | 139.39 | The hyperparameters corresponding to model sizes mentioned above are as follows: | Model Size | L | AH | HS | FFN | P | |------------|----|----|-----|------|------| | BASE | 12 | 12 | 768 | 3072 | 125M | | MED-SMALL | 6 | 8 | 512 | 2048 | 45M | (AH = number of attention heads; HS = hidden size; FFN = feedforward network dimension; P = number of parameters.) For other hyperparameters, we select: - Peak Learning rate: 5e-4 - Warmup Steps: 6% of max steps - Dropout: 0.1 [link-roberta-med-small-1M-1]: https://huggingface.co/nyu-mll/roberta-med-small-1M-1 [link-roberta-med-small-1M-2]: https://huggingface.co/nyu-mll/roberta-med-small-1M-2 [link-roberta-med-small-1M-3]: https://huggingface.co/nyu-mll/roberta-med-small-1M-3 [link-roberta-base-10M-1]: https://huggingface.co/nyu-mll/roberta-base-10M-1 [link-roberta-base-10M-2]: https://huggingface.co/nyu-mll/roberta-base-10M-2 [link-roberta-base-10M-3]: https://huggingface.co/nyu-mll/roberta-base-10M-3 [link-roberta-base-100M-1]: https://huggingface.co/nyu-mll/roberta-base-100M-1 [link-roberta-base-100M-2]: https://huggingface.co/nyu-mll/roberta-base-100M-2 [link-roberta-base-100M-3]: https://huggingface.co/nyu-mll/roberta-base-100M-3 [link-roberta-base-1B-1]: https://huggingface.co/nyu-mll/roberta-base-1B-1 [link-roberta-base-1B-2]: https://huggingface.co/nyu-mll/roberta-base-1B-2 [link-roberta-base-1B-3]: https://huggingface.co/nyu-mll/roberta-base-1B-3
nyu-mll/roberta-base-1B-2
2021-05-20T19:04:39.000Z
[ "pytorch", "jax", "roberta", "masked-lm", "transformers", "fill-mask" ]
fill-mask
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "vocab.json" ]
nyu-mll
10
transformers
# RoBERTa Pretrained on Smaller Datasets We pretrain RoBERTa on smaller datasets (1M, 10M, 100M, 1B tokens). We release 3 models with lowest perplexities for each pretraining data size out of 25 runs (or 10 in the case of 1B tokens). The pretraining data reproduces that of BERT: We combine English Wikipedia and a reproduction of BookCorpus using texts from smashwords in a ratio of approximately 3:1. ### Hyperparameters and Validation Perplexity The hyperparameters and validation perplexities corresponding to each model are as follows: | Model Name | Training Size | Model Size | Max Steps | Batch Size | Validation Perplexity | |--------------------------|---------------|------------|-----------|------------|-----------------------| | [roberta-base-1B-1][link-roberta-base-1B-1] | 1B | BASE | 100K | 512 | 3.93 | | [roberta-base-1B-2][link-roberta-base-1B-2] | 1B | BASE | 31K | 1024 | 4.25 | | [roberta-base-1B-3][link-roberta-base-1B-3] | 1B | BASE | 31K | 4096 | 3.84 | | [roberta-base-100M-1][link-roberta-base-100M-1] | 100M | BASE | 100K | 512 | 4.99 | | [roberta-base-100M-2][link-roberta-base-100M-2] | 100M | BASE | 31K | 1024 | 4.61 | | [roberta-base-100M-3][link-roberta-base-100M-3] | 100M | BASE | 31K | 512 | 5.02 | | [roberta-base-10M-1][link-roberta-base-10M-1] | 10M | BASE | 10K | 1024 | 11.31 | | [roberta-base-10M-2][link-roberta-base-10M-2] | 10M | BASE | 10K | 512 | 10.78 | | [roberta-base-10M-3][link-roberta-base-10M-3] | 10M | BASE | 31K | 512 | 11.58 | | [roberta-med-small-1M-1][link-roberta-med-small-1M-1] | 1M | MED-SMALL | 100K | 512 | 153.38 | | [roberta-med-small-1M-2][link-roberta-med-small-1M-2] | 1M | MED-SMALL | 10K | 512 | 134.18 | | [roberta-med-small-1M-3][link-roberta-med-small-1M-3] | 1M | MED-SMALL | 31K | 512 | 139.39 | The hyperparameters corresponding to model sizes mentioned above are as follows: | Model Size | L | AH | HS | FFN | P | |------------|----|----|-----|------|------| | BASE | 12 | 12 | 768 | 3072 | 125M | | MED-SMALL | 6 | 8 | 512 | 2048 | 45M | (AH = number of attention heads; HS = hidden size; FFN = feedforward network dimension; P = number of parameters.) For other hyperparameters, we select: - Peak Learning rate: 5e-4 - Warmup Steps: 6% of max steps - Dropout: 0.1 [link-roberta-med-small-1M-1]: https://huggingface.co/nyu-mll/roberta-med-small-1M-1 [link-roberta-med-small-1M-2]: https://huggingface.co/nyu-mll/roberta-med-small-1M-2 [link-roberta-med-small-1M-3]: https://huggingface.co/nyu-mll/roberta-med-small-1M-3 [link-roberta-base-10M-1]: https://huggingface.co/nyu-mll/roberta-base-10M-1 [link-roberta-base-10M-2]: https://huggingface.co/nyu-mll/roberta-base-10M-2 [link-roberta-base-10M-3]: https://huggingface.co/nyu-mll/roberta-base-10M-3 [link-roberta-base-100M-1]: https://huggingface.co/nyu-mll/roberta-base-100M-1 [link-roberta-base-100M-2]: https://huggingface.co/nyu-mll/roberta-base-100M-2 [link-roberta-base-100M-3]: https://huggingface.co/nyu-mll/roberta-base-100M-3 [link-roberta-base-1B-1]: https://huggingface.co/nyu-mll/roberta-base-1B-1 [link-roberta-base-1B-2]: https://huggingface.co/nyu-mll/roberta-base-1B-2 [link-roberta-base-1B-3]: https://huggingface.co/nyu-mll/roberta-base-1B-3
nyu-mll/roberta-base-1B-3
2021-05-20T19:05:43.000Z
[ "pytorch", "jax", "roberta", "masked-lm", "transformers", "fill-mask" ]
fill-mask
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "vocab.json" ]
nyu-mll
9,114
transformers
# RoBERTa Pretrained on Smaller Datasets We pretrain RoBERTa on smaller datasets (1M, 10M, 100M, 1B tokens). We release 3 models with lowest perplexities for each pretraining data size out of 25 runs (or 10 in the case of 1B tokens). The pretraining data reproduces that of BERT: We combine English Wikipedia and a reproduction of BookCorpus using texts from smashwords in a ratio of approximately 3:1. ### Hyperparameters and Validation Perplexity The hyperparameters and validation perplexities corresponding to each model are as follows: | Model Name | Training Size | Model Size | Max Steps | Batch Size | Validation Perplexity | |--------------------------|---------------|------------|-----------|------------|-----------------------| | [roberta-base-1B-1][link-roberta-base-1B-1] | 1B | BASE | 100K | 512 | 3.93 | | [roberta-base-1B-2][link-roberta-base-1B-2] | 1B | BASE | 31K | 1024 | 4.25 | | [roberta-base-1B-3][link-roberta-base-1B-3] | 1B | BASE | 31K | 4096 | 3.84 | | [roberta-base-100M-1][link-roberta-base-100M-1] | 100M | BASE | 100K | 512 | 4.99 | | [roberta-base-100M-2][link-roberta-base-100M-2] | 100M | BASE | 31K | 1024 | 4.61 | | [roberta-base-100M-3][link-roberta-base-100M-3] | 100M | BASE | 31K | 512 | 5.02 | | [roberta-base-10M-1][link-roberta-base-10M-1] | 10M | BASE | 10K | 1024 | 11.31 | | [roberta-base-10M-2][link-roberta-base-10M-2] | 10M | BASE | 10K | 512 | 10.78 | | [roberta-base-10M-3][link-roberta-base-10M-3] | 10M | BASE | 31K | 512 | 11.58 | | [roberta-med-small-1M-1][link-roberta-med-small-1M-1] | 1M | MED-SMALL | 100K | 512 | 153.38 | | [roberta-med-small-1M-2][link-roberta-med-small-1M-2] | 1M | MED-SMALL | 10K | 512 | 134.18 | | [roberta-med-small-1M-3][link-roberta-med-small-1M-3] | 1M | MED-SMALL | 31K | 512 | 139.39 | The hyperparameters corresponding to model sizes mentioned above are as follows: | Model Size | L | AH | HS | FFN | P | |------------|----|----|-----|------|------| | BASE | 12 | 12 | 768 | 3072 | 125M | | MED-SMALL | 6 | 8 | 512 | 2048 | 45M | (AH = number of attention heads; HS = hidden size; FFN = feedforward network dimension; P = number of parameters.) For other hyperparameters, we select: - Peak Learning rate: 5e-4 - Warmup Steps: 6% of max steps - Dropout: 0.1 [link-roberta-med-small-1M-1]: https://huggingface.co/nyu-mll/roberta-med-small-1M-1 [link-roberta-med-small-1M-2]: https://huggingface.co/nyu-mll/roberta-med-small-1M-2 [link-roberta-med-small-1M-3]: https://huggingface.co/nyu-mll/roberta-med-small-1M-3 [link-roberta-base-10M-1]: https://huggingface.co/nyu-mll/roberta-base-10M-1 [link-roberta-base-10M-2]: https://huggingface.co/nyu-mll/roberta-base-10M-2 [link-roberta-base-10M-3]: https://huggingface.co/nyu-mll/roberta-base-10M-3 [link-roberta-base-100M-1]: https://huggingface.co/nyu-mll/roberta-base-100M-1 [link-roberta-base-100M-2]: https://huggingface.co/nyu-mll/roberta-base-100M-2 [link-roberta-base-100M-3]: https://huggingface.co/nyu-mll/roberta-base-100M-3 [link-roberta-base-1B-1]: https://huggingface.co/nyu-mll/roberta-base-1B-1 [link-roberta-base-1B-2]: https://huggingface.co/nyu-mll/roberta-base-1B-2 [link-roberta-base-1B-3]: https://huggingface.co/nyu-mll/roberta-base-1B-3
nyu-mll/roberta-med-small-1M-1
2021-05-20T19:06:25.000Z
[ "pytorch", "jax", "roberta", "masked-lm", "transformers", "fill-mask" ]
fill-mask
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "vocab.json" ]
nyu-mll
51
transformers
# RoBERTa Pretrained on Smaller Datasets We pretrain RoBERTa on smaller datasets (1M, 10M, 100M, 1B tokens). We release 3 models with lowest perplexities for each pretraining data size out of 25 runs (or 10 in the case of 1B tokens). The pretraining data reproduces that of BERT: We combine English Wikipedia and a reproduction of BookCorpus using texts from smashwords in a ratio of approximately 3:1. ### Hyperparameters and Validation Perplexity The hyperparameters and validation perplexities corresponding to each model are as follows: | Model Name | Training Size | Model Size | Max Steps | Batch Size | Validation Perplexity | |--------------------------|---------------|------------|-----------|------------|-----------------------| | [roberta-base-1B-1][link-roberta-base-1B-1] | 1B | BASE | 100K | 512 | 3.93 | | [roberta-base-1B-2][link-roberta-base-1B-2] | 1B | BASE | 31K | 1024 | 4.25 | | [roberta-base-1B-3][link-roberta-base-1B-3] | 1B | BASE | 31K | 4096 | 3.84 | | [roberta-base-100M-1][link-roberta-base-100M-1] | 100M | BASE | 100K | 512 | 4.99 | | [roberta-base-100M-2][link-roberta-base-100M-2] | 100M | BASE | 31K | 1024 | 4.61 | | [roberta-base-100M-3][link-roberta-base-100M-3] | 100M | BASE | 31K | 512 | 5.02 | | [roberta-base-10M-1][link-roberta-base-10M-1] | 10M | BASE | 10K | 1024 | 11.31 | | [roberta-base-10M-2][link-roberta-base-10M-2] | 10M | BASE | 10K | 512 | 10.78 | | [roberta-base-10M-3][link-roberta-base-10M-3] | 10M | BASE | 31K | 512 | 11.58 | | [roberta-med-small-1M-1][link-roberta-med-small-1M-1] | 1M | MED-SMALL | 100K | 512 | 153.38 | | [roberta-med-small-1M-2][link-roberta-med-small-1M-2] | 1M | MED-SMALL | 10K | 512 | 134.18 | | [roberta-med-small-1M-3][link-roberta-med-small-1M-3] | 1M | MED-SMALL | 31K | 512 | 139.39 | The hyperparameters corresponding to model sizes mentioned above are as follows: | Model Size | L | AH | HS | FFN | P | |------------|----|----|-----|------|------| | BASE | 12 | 12 | 768 | 3072 | 125M | | MED-SMALL | 6 | 8 | 512 | 2048 | 45M | (AH = number of attention heads; HS = hidden size; FFN = feedforward network dimension; P = number of parameters.) For other hyperparameters, we select: - Peak Learning rate: 5e-4 - Warmup Steps: 6% of max steps - Dropout: 0.1 [link-roberta-med-small-1M-1]: https://huggingface.co/nyu-mll/roberta-med-small-1M-1 [link-roberta-med-small-1M-2]: https://huggingface.co/nyu-mll/roberta-med-small-1M-2 [link-roberta-med-small-1M-3]: https://huggingface.co/nyu-mll/roberta-med-small-1M-3 [link-roberta-base-10M-1]: https://huggingface.co/nyu-mll/roberta-base-10M-1 [link-roberta-base-10M-2]: https://huggingface.co/nyu-mll/roberta-base-10M-2 [link-roberta-base-10M-3]: https://huggingface.co/nyu-mll/roberta-base-10M-3 [link-roberta-base-100M-1]: https://huggingface.co/nyu-mll/roberta-base-100M-1 [link-roberta-base-100M-2]: https://huggingface.co/nyu-mll/roberta-base-100M-2 [link-roberta-base-100M-3]: https://huggingface.co/nyu-mll/roberta-base-100M-3 [link-roberta-base-1B-1]: https://huggingface.co/nyu-mll/roberta-base-1B-1 [link-roberta-base-1B-2]: https://huggingface.co/nyu-mll/roberta-base-1B-2 [link-roberta-base-1B-3]: https://huggingface.co/nyu-mll/roberta-base-1B-3
nyu-mll/roberta-med-small-1M-2
2021-05-20T19:07:56.000Z
[ "pytorch", "jax", "roberta", "masked-lm", "transformers", "fill-mask" ]
fill-mask
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "vocab.json" ]
nyu-mll
10
transformers
# RoBERTa Pretrained on Smaller Datasets We pretrain RoBERTa on smaller datasets (1M, 10M, 100M, 1B tokens). We release 3 models with lowest perplexities for each pretraining data size out of 25 runs (or 10 in the case of 1B tokens). The pretraining data reproduces that of BERT: We combine English Wikipedia and a reproduction of BookCorpus using texts from smashwords in a ratio of approximately 3:1. ### Hyperparameters and Validation Perplexity The hyperparameters and validation perplexities corresponding to each model are as follows: | Model Name | Training Size | Model Size | Max Steps | Batch Size | Validation Perplexity | |--------------------------|---------------|------------|-----------|------------|-----------------------| | [roberta-base-1B-1][link-roberta-base-1B-1] | 1B | BASE | 100K | 512 | 3.93 | | [roberta-base-1B-2][link-roberta-base-1B-2] | 1B | BASE | 31K | 1024 | 4.25 | | [roberta-base-1B-3][link-roberta-base-1B-3] | 1B | BASE | 31K | 4096 | 3.84 | | [roberta-base-100M-1][link-roberta-base-100M-1] | 100M | BASE | 100K | 512 | 4.99 | | [roberta-base-100M-2][link-roberta-base-100M-2] | 100M | BASE | 31K | 1024 | 4.61 | | [roberta-base-100M-3][link-roberta-base-100M-3] | 100M | BASE | 31K | 512 | 5.02 | | [roberta-base-10M-1][link-roberta-base-10M-1] | 10M | BASE | 10K | 1024 | 11.31 | | [roberta-base-10M-2][link-roberta-base-10M-2] | 10M | BASE | 10K | 512 | 10.78 | | [roberta-base-10M-3][link-roberta-base-10M-3] | 10M | BASE | 31K | 512 | 11.58 | | [roberta-med-small-1M-1][link-roberta-med-small-1M-1] | 1M | MED-SMALL | 100K | 512 | 153.38 | | [roberta-med-small-1M-2][link-roberta-med-small-1M-2] | 1M | MED-SMALL | 10K | 512 | 134.18 | | [roberta-med-small-1M-3][link-roberta-med-small-1M-3] | 1M | MED-SMALL | 31K | 512 | 139.39 | The hyperparameters corresponding to model sizes mentioned above are as follows: | Model Size | L | AH | HS | FFN | P | |------------|----|----|-----|------|------| | BASE | 12 | 12 | 768 | 3072 | 125M | | MED-SMALL | 6 | 8 | 512 | 2048 | 45M | (AH = number of attention heads; HS = hidden size; FFN = feedforward network dimension; P = number of parameters.) For other hyperparameters, we select: - Peak Learning rate: 5e-4 - Warmup Steps: 6% of max steps - Dropout: 0.1 [link-roberta-med-small-1M-1]: https://huggingface.co/nyu-mll/roberta-med-small-1M-1 [link-roberta-med-small-1M-2]: https://huggingface.co/nyu-mll/roberta-med-small-1M-2 [link-roberta-med-small-1M-3]: https://huggingface.co/nyu-mll/roberta-med-small-1M-3 [link-roberta-base-10M-1]: https://huggingface.co/nyu-mll/roberta-base-10M-1 [link-roberta-base-10M-2]: https://huggingface.co/nyu-mll/roberta-base-10M-2 [link-roberta-base-10M-3]: https://huggingface.co/nyu-mll/roberta-base-10M-3 [link-roberta-base-100M-1]: https://huggingface.co/nyu-mll/roberta-base-100M-1 [link-roberta-base-100M-2]: https://huggingface.co/nyu-mll/roberta-base-100M-2 [link-roberta-base-100M-3]: https://huggingface.co/nyu-mll/roberta-base-100M-3 [link-roberta-base-1B-1]: https://huggingface.co/nyu-mll/roberta-base-1B-1 [link-roberta-base-1B-2]: https://huggingface.co/nyu-mll/roberta-base-1B-2 [link-roberta-base-1B-3]: https://huggingface.co/nyu-mll/roberta-base-1B-3
nyu-mll/roberta-med-small-1M-3
2021-05-20T19:09:09.000Z
[ "pytorch", "jax", "roberta", "masked-lm", "transformers", "fill-mask" ]
fill-mask
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "vocab.json" ]
nyu-mll
13
transformers
# RoBERTa Pretrained on Smaller Datasets We pretrain RoBERTa on smaller datasets (1M, 10M, 100M, 1B tokens). We release 3 models with lowest perplexities for each pretraining data size out of 25 runs (or 10 in the case of 1B tokens). The pretraining data reproduces that of BERT: We combine English Wikipedia and a reproduction of BookCorpus using texts from smashwords in a ratio of approximately 3:1. ### Hyperparameters and Validation Perplexity The hyperparameters and validation perplexities corresponding to each model are as follows: | Model Name | Training Size | Model Size | Max Steps | Batch Size | Validation Perplexity | |--------------------------|---------------|------------|-----------|------------|-----------------------| | [roberta-base-1B-1][link-roberta-base-1B-1] | 1B | BASE | 100K | 512 | 3.93 | | [roberta-base-1B-2][link-roberta-base-1B-2] | 1B | BASE | 31K | 1024 | 4.25 | | [roberta-base-1B-3][link-roberta-base-1B-3] | 1B | BASE | 31K | 4096 | 3.84 | | [roberta-base-100M-1][link-roberta-base-100M-1] | 100M | BASE | 100K | 512 | 4.99 | | [roberta-base-100M-2][link-roberta-base-100M-2] | 100M | BASE | 31K | 1024 | 4.61 | | [roberta-base-100M-3][link-roberta-base-100M-3] | 100M | BASE | 31K | 512 | 5.02 | | [roberta-base-10M-1][link-roberta-base-10M-1] | 10M | BASE | 10K | 1024 | 11.31 | | [roberta-base-10M-2][link-roberta-base-10M-2] | 10M | BASE | 10K | 512 | 10.78 | | [roberta-base-10M-3][link-roberta-base-10M-3] | 10M | BASE | 31K | 512 | 11.58 | | [roberta-med-small-1M-1][link-roberta-med-small-1M-1] | 1M | MED-SMALL | 100K | 512 | 153.38 | | [roberta-med-small-1M-2][link-roberta-med-small-1M-2] | 1M | MED-SMALL | 10K | 512 | 134.18 | | [roberta-med-small-1M-3][link-roberta-med-small-1M-3] | 1M | MED-SMALL | 31K | 512 | 139.39 | The hyperparameters corresponding to model sizes mentioned above are as follows: | Model Size | L | AH | HS | FFN | P | |------------|----|----|-----|------|------| | BASE | 12 | 12 | 768 | 3072 | 125M | | MED-SMALL | 6 | 8 | 512 | 2048 | 45M | (AH = number of attention heads; HS = hidden size; FFN = feedforward network dimension; P = number of parameters.) For other hyperparameters, we select: - Peak Learning rate: 5e-4 - Warmup Steps: 6% of max steps - Dropout: 0.1 [link-roberta-med-small-1M-1]: https://huggingface.co/nyu-mll/roberta-med-small-1M-1 [link-roberta-med-small-1M-2]: https://huggingface.co/nyu-mll/roberta-med-small-1M-2 [link-roberta-med-small-1M-3]: https://huggingface.co/nyu-mll/roberta-med-small-1M-3 [link-roberta-base-10M-1]: https://huggingface.co/nyu-mll/roberta-base-10M-1 [link-roberta-base-10M-2]: https://huggingface.co/nyu-mll/roberta-base-10M-2 [link-roberta-base-10M-3]: https://huggingface.co/nyu-mll/roberta-base-10M-3 [link-roberta-base-100M-1]: https://huggingface.co/nyu-mll/roberta-base-100M-1 [link-roberta-base-100M-2]: https://huggingface.co/nyu-mll/roberta-base-100M-2 [link-roberta-base-100M-3]: https://huggingface.co/nyu-mll/roberta-base-100M-3 [link-roberta-base-1B-1]: https://huggingface.co/nyu-mll/roberta-base-1B-1 [link-roberta-base-1B-2]: https://huggingface.co/nyu-mll/roberta-base-1B-2 [link-roberta-base-1B-3]: https://huggingface.co/nyu-mll/roberta-base-1B-3
nyust-eb210/braslab-bert-drcd-384
2021-05-31T14:47:20.000Z
[ "pytorch", "tf", "jax", "bert", "question-answering", "zh-tw", "dataset:DRCD", "transformers" ]
question-answering
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tf_model.h5", "tokenizer_config.json", "vocab.txt" ]
nyust-eb210
117
transformers
--- language: zh-tw datasets: DRCD tasks: Question Answering --- # BERT DRCD 384 This model is a fine-tune checkpoint of [bert-base-chinese](https://huggingface.co/bert-base-chinese), fine-tuned on DRCD dataset. This model reaches a F1 score of 86. This model reaches a EM score of 83. Training Arguments: - length: 384 - stride: 128 - learning_rate: 3e-5 - batch_size: 10 - epoch: 3 [Colab for detailed](https://colab.research.google.com/drive/1kZv7ZRmvUdCKEhQg8MBrKljGWvV2X3CP?usp=sharing) ## Deployment Deploy [BERT-DRCD-QuestionAnswering](https://github.com/pleomax0730/BERT-DRCD-QuestionAnswering) model using `FastAPI` and containerized using `Docker`. ## Usage ### In Transformers ```python text = "鴻海科技集團是由臺灣企業家郭台銘創辦的跨國企業,總部位於臺灣新北市土城區,主要生產地則在中國大陸,以富士康做為商標名稱。其專注於電子產品的代工服務,研發生產精密電氣元件、機殼、準系統、系統組裝、光通訊元件、液晶顯示件等3C產品上、下游產品及服務。" query = "鴻海集團總部位於哪裡?" device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") tokenizer = BertTokenizerFast.from_pretrained("nyust-eb210/braslab-bert-drcd-384") model = BertForQuestionAnswering.from_pretrained("nyust-eb210/braslab-bert-drcd-384").to(device) encoded_input = tokenizer(text, query, return_tensors="pt").to(device) qa_outputs = model(**encoded_input) start = torch.argmax(qa_outputs.start_logits).item() end = torch.argmax(qa_outputs.end_logits).item() answer = encoded_input.input_ids.tolist()[0][start : end + 1] answer = "".join(tokenizer.decode(answer).split()) start_prob = torch.max(torch.nn.Softmax(dim=-1)(qa_outputs.start_logits)).item() end_prob = torch.max(torch.nn.Softmax(dim=-1)(qa_outputs.end_logits)).item() confidence = (start_prob + end_prob) / 2 print(answer, confidence) # 臺灣新北市土城區, 0.92 ```
o2poi/sst2-eda-albert
2021-06-11T12:57:56.000Z
[ "pytorch", "albert", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "all_results.json", "config.json", "eval_results.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer.json", "tokenizer_config.json", "train_results.json", "trainer_state.json", "training_args.bin" ]
o2poi
5
transformers
o2poi/sst2-eda-bert-uncased
2021-06-11T15:44:21.000Z
[ "pytorch", "bert", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "all_results.json", "config.json", "eval_results.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer.json", "tokenizer_config.json", "train_results.json", "trainer_state.json", "training_args.bin", "vocab.txt" ]
o2poi
5
transformers
o2poi/sst2-eda-bert
2021-06-11T13:00:53.000Z
[ "pytorch", "bert", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "all_results.json", "config.json", "eval_results.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer.json", "tokenizer_config.json", "train_results.json", "trainer_state.json", "training_args.bin", "vocab.txt" ]
o2poi
3
transformers
o2poi/sst2-eda-roberta
2021-06-11T13:03:15.000Z
[ "pytorch", "roberta", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "all_results.json", "config.json", "eval_results.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer.json", "tokenizer_config.json", "train_results.json", "trainer_state.json", "training_args.bin", "vocab.json" ]
o2poi
5
transformers
oda/music5
2020-02-14T04:01:03.000Z
[ "pytorch", "transformers" ]
[ ".gitattributes", "config.json", "pytorch_model.bin", "vocab.txt" ]
oda
15
transformers
odinmay/joebot
2021-06-05T03:37:20.000Z
[ "pytorch", "gpt2", "lm-head", "causal-lm", "transformers", "conversational", "text-generation" ]
conversational
[ ".gitattributes", "README.md", "config.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer.json", "tokenizer_config.json", "vocab.json" ]
odinmay
268
transformers
--- tags: - conversational --- # Joebot
odinmay/zackbotai
2021-06-03T21:41:14.000Z
[ "pytorch", "gpt2", "lm-head", "causal-lm", "transformers", "text-generation" ]
text-generation
[ ".gitattributes", "config.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer.json", "tokenizer_config.json", "vocab.json" ]
odinmay
10
transformers
odinmay/zackbotmodel
2021-06-03T21:37:46.000Z
[ "pytorch", "gpt2", "lm-head", "causal-lm", "transformers", "text-generation" ]
text-generation
[ ".gitattributes", "README.md", "config.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer.json", "tokenizer_config.json", "vocab.json" ]
odinmay
10
transformers
--- tags: - conversational ---
oelkrise/ew
2021-03-28T15:33:07.000Z
[]
[ ".gitattributes", "README.md" ]
oelkrise
0
crasd
offry/deit_vit
2021-05-30T06:09:32.000Z
[]
[ ".gitattributes" ]
offry
0
oidelima/test
2021-02-09T22:10:51.000Z
[]
[ ".gitattributes" ]
oidelima
0
oidelima/test_1
2021-02-09T22:12:42.000Z
[]
[ ".gitattributes" ]
oidelima
0
ojasaar/distilbert-sentence-msmarco-en-et
2020-11-05T15:09:04.000Z
[ "pytorch", "distilbert", "transformers" ]
[ ".gitattributes", "config.json", "modules.json", "pytorch_model.bin", "sentence_bert_config.json", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
ojasaar
20
transformers
ojasaar/t5-base-qa-summary-emotion
2020-12-22T17:45:57.000Z
[]
[ ".gitattributes" ]
ojasaar
0
olastor/mcn-en-smm4h
2021-05-20T02:11:39.000Z
[ "pytorch", "jax", "bert", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt" ]
olastor
11
transformers
# BERT MCN-Model using SMM4H 2017 (subtask 3) data The model was trained using [clagator/biobert_v1.1_pubmed_nli_sts](https://huggingface.co/clagator/biobert_v1.1_pubmed_nli_sts) as a base and the smm4h dataset from 2017 from subtask 3. ## Dataset See [here](https://github.com/olastor/medical-concept-normalization/tree/main/data/smm4h) for the scripts and datasets. **Attribution** Sarker, Abeed (2018), “Data and systems for medication-related text classification and concept normalization from Twitter: Insights from the Social Media Mining for Health (SMM4H)-2017 shared task”, Mendeley Data, V2, doi: 10.17632/rxwfb3tysd.2 ### Test Results - Acc: 89.44 - Acc@2: 91.84 - Acc@3: 93.20 - Acc@5: 94.32 - Acc@10: 95.04 Acc@N denotes the accuracy taking the top N predictions of the model into account, not just the first one.
oliverguhr/german-sentiment-bert
2021-05-20T02:12:42.000Z
[ "pytorch", "jax", "bert", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "README.md", "config.json", "eval_results_germansentiment.txt", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt" ]
oliverguhr
112,165
transformers
# German Sentiment Classification with Bert This model was trained for sentiment classification of German language texts. To achieve the best results all model inputs needs to be preprocessed with the same procedure, that was applied during the training. To simplify the usage of the model, we provide a Python package that bundles the code need for the preprocessing and inferencing. The model uses the Googles Bert architecture and was trained on 1.834 million German-language samples. The training data contains texts from various domains like Twitter, Facebook and movie, app and hotel reviews. You can find more information about the dataset and the training process in the [paper](http://www.lrec-conf.org/proceedings/lrec2020/pdf/2020.lrec-1.202.pdf). ## Using the Python package To get started install the package from [pypi](https://pypi.org/project/germansentiment/): ```bash pip install germansentiment ``` ```python from germansentiment import SentimentModel model = SentimentModel() texts = [ "Mit keinem guten Ergebniss","Das ist gar nicht mal so gut", "Total awesome!","nicht so schlecht wie erwartet", "Der Test verlief positiv.","Sie fährt ein grünes Auto."] result = model.predict_sentiment(texts) print(result) ``` The code above will output following list: ```python ["negative","negative","positive","positive","neutral", "neutral"] ``` ## A minimal working Sample ```python from transformers import AutoModelForSequenceClassification, AutoTokenizer from typing import List import torch import re class SentimentModel(): def __init__(self, model_name: str): self.model = AutoModelForSequenceClassification.from_pretrained(model_name) self.tokenizer = AutoTokenizer.from_pretrained(model_name) self.clean_chars = re.compile(r'[^A-Za-züöäÖÜÄß ]', re.MULTILINE) self.clean_http_urls = re.compile(r'https*\\S+', re.MULTILINE) self.clean_at_mentions = re.compile(r'@\\S+', re.MULTILINE) def predict_sentiment(self, texts: List[str])-> List[str]: texts = [self.clean_text(text) for text in texts] # Add special tokens takes care of adding [CLS], [SEP], <s>... tokens in the right way for each model. input_ids = self.tokenizer(texts, padding=True, truncation=True, add_special_tokens=True) input_ids = torch.tensor(input_ids["input_ids"]) with torch.no_grad(): logits = self.model(input_ids) label_ids = torch.argmax(logits[0], axis=1) labels = [self.model.config.id2label[label_id] for label_id in label_ids.tolist()] return labels def replace_numbers(self,text: str) -> str: return text.replace("0"," null").replace("1"," eins").replace("2"," zwei").replace("3"," drei").replace("4"," vier").replace("5"," fünf").replace("6"," sechs").replace("7"," sieben").replace("8"," acht").replace("9"," neun") def clean_text(self,text: str)-> str: text = text.replace("\ ", " ") text = self.clean_http_urls.sub('',text) text = self.clean_at_mentions.sub('',text) text = self.replace_numbers(text) text = self.clean_chars.sub('', text) # use only text chars text = ' '.join(text.split()) # substitute multiple whitespace with single whitespace text = text.strip().lower() return text texts = ["Mit keinem guten Ergebniss","Das war unfair", "Das ist gar nicht mal so gut", "Total awesome!","nicht so schlecht wie erwartet", "Das ist gar nicht mal so schlecht", "Der Test verlief positiv.","Sie fährt ein grünes Auto.", "Der Fall wurde an die Polzei übergeben."] model = SentimentModel(model_name = "oliverguhr/german-sentiment-bert") print(model.predict_sentiment(texts)) ``` ## Model and Data If you are interested in code and data that was used to train this model please have a look at [this repository](https://github.com/oliverguhr/german-sentiment) and our [paper](http://www.lrec-conf.org/proceedings/lrec2020/pdf/2020.lrec-1.202.pdf). Here is a table of the F1 scores that his model achieves on following datasets. Since we trained this model on a newer version of the transformer library, the results are slightly better than reported in the paper. | Dataset | F1 micro Score | | :----------------------------------------------------------- | -------------: | | [holidaycheck](https://github.com/oliverguhr/german-sentiment) | 0.9568 | | [scare](https://www.romanklinger.de/scare/) | 0.9418 | | [filmstarts](https://github.com/oliverguhr/german-sentiment) | 0.9021 | | [germeval](https://sites.google.com/view/germeval2017-absa/home) | 0.7536 | | [PotTS](https://www.aclweb.org/anthology/L16-1181/) | 0.6780 | | [emotions](https://github.com/oliverguhr/german-sentiment) | 0.9649 | | [sb10k](https://www.spinningbytes.com/resources/germansentiment/) | 0.7376 | | [Leipzig Wikipedia Corpus 2016](https://wortschatz.uni-leipzig.de/de/download/german) | 0.9967 | | all | 0.9639 | ## Cite For feedback and questions contact me view mail or Twitter [@oliverguhr](https://twitter.com/oliverguhr). Please cite us if you found this useful: ``` @InProceedings{guhr-EtAl:2020:LREC, author = {Guhr, Oliver and Schumann, Anne-Kathrin and Bahrmann, Frank and Böhme, Hans Joachim}, title = {Training a Broad-Coverage German Sentiment Classification Model for Dialog Systems}, booktitle = {Proceedings of The 12th Language Resources and Evaluation Conference}, month = {May}, year = {2020}, address = {Marseille, France}, publisher = {European Language Resources Association}, pages = {1620--1625}, url = {https://www.aclweb.org/anthology/2020.lrec-1.202} } ```
oliverqq/scibert-uncased-topics
2021-05-20T02:13:36.000Z
[ "pytorch", "jax", "bert", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
oliverqq
398
transformers