diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db8c73075..933ffb9e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,20 @@ jobs: # file with notes on your contribution. git diff --name-only $(git merge-base origin/main HEAD) | grep '^CHANGELOG.md$' && echo "Thanks for helping keep our CHANGELOG up-to-date!" + readme: + name: README + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + + steps: + - uses: actions/checkout@v1 + + - name: Check that models list is up-to-date + run: | + # If this step fails, you need to run `python scripts/update_readme_model_list.py`. + python scripts/update_readme_model_list.py + git diff --exit-code + checks: name: Checks runs-on: ubuntu-latest diff --git a/README.md b/README.md index 685d12aa5..265980574 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,16 @@ ❗️ To file an issue, please open a ticket on allenai/allennlp and tag it with "Models". ❗️ +## In this README + +- [About](#about) + - [Tasks and components](#tasks-and-components) + - [Pre-trained models](#pre-trained-models) +- [Installing](#installing) + - [From PyPI](#from-pypi) + - [From source](#from-source) + - [Using Docker](#using-docker) + ## About This repository contains the components - such as [`DatasetReader`](https://docs.allennlp.org/main/api/data/dataset_readers/dataset_reader/#datasetreader), [`Model`](https://docs.allennlp.org/main/api/models/model/#model), and [`Predictor`](https://docs.allennlp.org/main/api/predictors/predictor/#predictor) classes - for applying [AllenNLP](https://github.com/allenai/allennlp) to a wide variety of NLP [tasks](#tasks-and-components). @@ -130,6 +140,45 @@ For example: >>> pretrained.load_predictor("mc-roberta-swag") ``` +Here is a list of pre-trained models currently available. + + + +- [`coref-spanbert`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/coref-spanbert.json) - Higher-order coref with coarse-to-fine inference (with SpanBERT embeddings). +- [`evaluate_rc-lerc`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/evaluate_rc-lerc.json) - A BERT model that scores candidate answers from 0 to 1. +- [`generation-bart`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/generation-bart.json) - BART with a language model head for generation. +- [`glove-sst`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/glove-sst.json) - LSTM binary classifier with GloVe embeddings. +- [`lm-masked-language-model`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/lm-masked-language-model.json) - BERT-based masked language model +- [`lm-next-token-lm-gpt2`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/lm-next-token-lm-gpt2.json) - OpenAI's GPT-2 language model that generates the next token. +- [`mc-roberta-commonsenseqa`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/mc-roberta-commonsenseqa.json) - RoBERTa-based multiple choice model for CommonSenseQA. +- [`mc-roberta-piqa`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/mc-roberta-piqa.json) - RoBERTa-based multiple choice model for PIQA. +- [`mc-roberta-swag`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/mc-roberta-swag.json) - RoBERTa-based multiple choice model for SWAG. +- [`pair-classification-decomposable-attention-elmo`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/pair-classification-decomposable-attention-elmo.json) - The decomposable attention model (Parikh et al, 2017) combined with ELMo embeddings trained on SNLI. +- [`pair-classification-esim`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/pair-classification-esim.json) - Enhanced LSTM trained on SNLI. +- [`pair-classification-roberta-mnli`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/pair-classification-roberta-mnli.json) - RoBERTa finetuned on MNLI. +- [`pair-classification-roberta-snli`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/pair-classification-roberta-snli.json) - RoBERTa finetuned on SNLI. +- [`rc-bidaf-elmo`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/rc-bidaf-elmo.json) - BiDAF model with ELMo embeddings instead of GloVe. +- [`rc-bidaf`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/rc-bidaf.json) - BiDAF model with GloVe embeddings. +- [`rc-naqanet`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/rc-naqanet.json) - An augmented version of QANet that adds rudimentary numerical reasoning ability, trained on DROP (Dua et al., 2019), as published in the original DROP paper. +- [`rc-nmn`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/rc-nmn.json) - A neural module network trained on DROP. +- [`rc-transformer-qa`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/rc-transformer-qa.json) - A reading comprehension model patterned after the proposed model in Devlin et al, with improvements borrowed from the SQuAD model in the transformers project +- [`roberta-sst`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/roberta-sst.json) - RoBERTa-based binary classifier for Stanford Sentiment Treebank +- [`semparse-nlvr`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/semparse-nlvr.json) - The model is a semantic parser trained on Cornell NLVR. +- [`semparse-text-to-sql`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/semparse-text-to-sql.json) - This model is an implementation of an encoder-decoder architecture with LSTMs and constrained type decoding trained on the ATIS dataset. +- [`semparse-wikitables`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/semparse-wikitables.json) - The model is a semantic parser trained on WikiTableQuestions. +- [`structured-prediction-biaffine-parser`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/structured-prediction-biaffine-parser.json) - A neural model for dependency parsing using biaffine classifiers on top of a bidirectional LSTM. +- [`structured-prediction-constituency-parser`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/structured-prediction-constituency-parser.json) - Constituency parser with character-based ELMo embeddings +- [`structured-prediction-srl-bert`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/structured-prediction-srl-bert.json) - A BERT based model (Shi et al, 2019) with some modifications (no additional parameters apart from a linear classification layer) +- [`structured-prediction-srl`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/structured-prediction-srl.json) - A reimplementation of a deep BiLSTM sequence prediction model (Stanovsky et al., 2018) +- [`tagging-elmo-crf-tagger`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/tagging-elmo-crf-tagger.json) - NER tagger using a Gated Recurrent Unit (GRU) character encoder as well as a GRU phrase encoder, with GloVe embeddings. +- [`tagging-fine-grained-crf-tagger`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/tagging-fine-grained-crf-tagger.json) - This model identifies a broad range of 16 semantic types in the input text. It is a reimplementation of Lample (2016) and uses a biLSTM with a CRF layer, character embeddings and ELMo embeddings. +- [`tagging-fine-grained-transformer-crf-tagger`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/tagging-fine-grained-transformer-crf-tagger.json) - Fine-grained NER model +- [`ve-vilbert`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/ve-vilbert.json) - ViLBERT-based model for Visual Entailment. +- [`vqa-vilbert`](https://github.com/allenai/allennlp-models/tree/main/allennlp_models/modelcards/vqa-vilbert.json) - ViLBERT (short for Vision-and-Language BERT), is a model for learning task-agnostic joint representations of image content and natural language. + + + + ## Installing ### From PyPI diff --git a/allennlp_models/modelcards/modelcard-template.json b/allennlp_models/modelcards/modelcard-template.json index c5c0716eb..3758eb8ff 100644 --- a/allennlp_models/modelcards/modelcard-template.json +++ b/allennlp_models/modelcards/modelcard-template.json @@ -8,7 +8,7 @@ "archive_file": null, "training_config": null, "overrides": null, - "install_instructions": "pip install allennlp==1.0.0 allennlp-models==1.0.0", + "install_instructions": "pip install allennlp==2.2.0 allennlp-models==2.2.0" }, "model_details": { "description": null, @@ -21,7 +21,7 @@ "paper": null, "citation": null, "license": null, - "contact": "allennlp-contact@allenai.org", + "contact": "allennlp-contact@allenai.org" }, "intended_use": { "primary_uses": null, @@ -57,4 +57,4 @@ "model_ethical_considerations": { "ethical_considerations": null } -} \ No newline at end of file +} diff --git a/scripts/update_readme_model_list.py b/scripts/update_readme_model_list.py new file mode 100644 index 000000000..84f6f1702 --- /dev/null +++ b/scripts/update_readme_model_list.py @@ -0,0 +1,48 @@ +""" +Run this script to update the list of pre-trained models in the README based on the current model cards. +""" + +from typing import List +import json +import glob + + +AUTO_GENERATED_SECTION_START = "" + + +def main(): + with open("README.md") as readme_file: + readme_lines = readme_file.readlines() + + section_start_idx = next( + (i for i, l in enumerate(readme_lines) if l.startswith(AUTO_GENERATED_SECTION_START)) + ) + section_end_idx = next( + (i for i, l in enumerate(readme_lines) if l.startswith(AUTO_GENERATED_SECTION_END)) + ) + + model_list: List[str] = ["\n"] + for model_card_path in sorted(glob.glob("allennlp_models/modelcards/*.json")): + if model_card_path.endswith("modelcard-template.json"): + continue + with open(model_card_path) as model_card_file: + model_card = json.load(model_card_file) + model_id = model_card["id"] + description = model_card["model_details"]["short_description"] + model_list.append( + f"- [`{model_id}`](https://github.com/allenai/allennlp-models/tree/main/" + f"{model_card_path}) - {description}\n" + ) + model_list.append("\n") + + readme_lines = ( + readme_lines[: section_start_idx + 1] + model_list + readme_lines[section_end_idx:] + ) + + with open("README.md", "w") as readme_file: + readme_file.writelines(readme_lines) + + +if __name__ == "__main__": + main()