Archive of AI

Source Snapshot / 2018-03-20-ai2-allennlp-open-framework-3

allenai/allennlp Official Repository

Linked event: 2018-03-20 · Ai2 Open-Sources AllenNLP, a PyTorch-Based Deep Semantic Understanding Research Framework

Publisher
GitHub
Archived
2026-11-23
Capture Method
Direct page capture
HTTP / SHA-256
200 / 17e1a3447bfa64a0
Original URL
Open source ↗
Wayback Backup
Not archived
This page preserves a plain-text static snapshot against link rot. When citing figures, tables, or full legal terms, verify against the original URL and Wayback Machine archive.

[来源关键摘录] An open-source NLP research library built on PyTorch by the Allen Institute for AI.

[正文前段节选] Skip to content

Navigation Menu

Appearance settings

You signed in with another tab or window. Reload to refresh your session.

You signed out in another tab or window. Reload to refresh your session.

You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Repository navigation

Public archive

NotificationsYou must be signed in to change notification settings

Fork2.2k (2.2k)

Star11.9k (11.9k)You must be signed in to star a repository

An open-source NLP research library, built on PyTorch.

www.allennlp.org

data-sciencedeep-learningnatural-language-processingnlppythonpytorch

Apache-2.0 license

Contributing

Cite this repository

Custom properties

Report repository

BranchesTags

Open more actions menu

Latest commit

2,719 Commits

Folders and files

Last commit message

Last commit date

test_fixtures

.dockerignore

CHANGELOG.md

CITATION.cff

CONTRIBUTING.md

Dockerfile.test

RELEASE_PROCESS.md

constraints.txt

dev-requirements.txt

mkdocs-skeleton.yml

pyproject.toml

requirements.in

requirements.txt

View all files

Repository files navigation

An Apache 2.0 NLP research library, built on PyTorch, for developing state-of-the-art deep learning models on a wide variety of linguistic tasks.

⚠️ NOTICE: The AllenNLP library is now in maintenance mode. That means we are no longer adding new features or upgrading dependencies. We will still respond to questions and address bugs as they arise up until December 16th, 2022. If you have any concerns or are interested in maintaining AllenNLP going forward, please open an issue on this repository.

AllenNLP has been a big success, but as the field is advancing quickly it's time to focus on new initiatives. We're working hard to make AI2 Tango the best way to organize research codebases. If you are an active user of AllenNLP, here are some suggested alternatives:

If you like the trainer, the configuration language, or are simply looking for a better way to manage your experiments, check out AI2 Tango.

If you like AllenNLP's modules and nn packages, check out delmaksym/allennlp-light. It's even compatible with AI2 Tango!

If you like the framework aspect of AllenNLP, check out flair. It has multiple state-of-art NLP models and allows you to easily use pretrained embeddings such as those from transformers.

If you like the AllenNLP metrics package, check out torchmetrics. It has the same API as AllenNLP, so it should be a quick learning curve to make the switch.

If you want to vectorize text, try the transformers library.

If you want to maintain the AllenNLP Fairness or Interpret components, please get in touch. There is no alternative to it, so we are looking for a dedicated maintainer.

If you are concerned about other AllenNLP functionality, please create an issue. Maybe we can find another way to continue supporting your use case.

📓 Documentation ( latest | stable | commit )

⬆️ Upgrade Guide from 1.x to 2.0

❓ Stack Overflow

✋ Contributing Guidelines

🤖 Officially Supported Models

Pretrained Models

Documentation ( latest | stable | commit )

⚙️ Continuous Build

🌙 Nightly Releases

In this README

Getting Started Using the Library

Package Overview

Installation

Installing via pip

Installing using Docker

Installing from source

Running AllenNLP

Contributions

If you're interested in using AllenNLP for model development, we recommend you check out the

AllenNLP Guide for a thorough introduction to the library, followed by our more advanced guides

on GitHub Discussions.

When you're ready to start your project, we've created a couple of template repositories that you can use as a starting place:

If you want to use allennlp train and config files to specify experiments, use this

template. We recommend this approach.

If you'd prefer to use python code to configure your experiments and run your training loop, use

this template. There are a few

things that are currently a little harder in this setup (loading a saved model, and using

distributed training), but otherwise it's functionality equivalent to the config files

In addition, there are external tutorials:

Hyperparameter optimization for AllenNLP using Optuna

Training with multiple GPUs in AllenNLP

Training on larger batches with less memory in AllenNLP

How to upload transformer weights and tokenizers from AllenNLP to HuggingFace

And others on the AI2 AllenNLP blog.

AllenNLP supports loading "plugins" dynamically. A plugin is just a Python package that

provides custom registered classes or additional allennlp subcommands.

There is ecosystem of open source plugins, some of which are maintained by the AllenNLP

team here at AI2, and some of which are maintained by the broader community.

allennlp-models

A collection of state-of-the-art models

allennlp-semparse

A framework for building semantic parsers

allennlp-server

A simple demo server for serving models

allennlp-optuna

Makoto Hiramatsu

Optuna integration for hyperparameter optimization

AllenNLP will automatically find any official AI2-maintained plugins that you have installed,

but for AllenNLP to find personal or third-party plugins you've installed,

you also have to create either a local plugins file named .allennlp_plugins

in the directory where you run the allennlp command, or a global plugins file at ~/.allennlp/plugins.

The file should list the plugin modules that you want to be loaded, one per line.

To test that your plugins can be found and imported by AllenNLP, you can run the allennlp test-install command.

Each discovered plugin will be logged to the terminal.

For more information about plugins, see the plugins API docs. And for information on how to create a custom subcommand

to distribute as a plugin, see the subcommand API docs.

An open-source NLP research library, built on PyTorch

allennlp.commands

Functionality for the CLI

allennlp.common

Utility modules that are used across the library

allennlp.data

A data processing module for loading datasets and encoding strings as integers for representation in matrices

allennlp.fairness

A module for bias mitigation and fairness algorithms and metrics

allennlp.modules

A collection of PyTorch modules for use with text

Tensor utility functions, such as initializers and activation functions

allennlp.training

Functionality for training models

AllenNLP requires Python 3.6.1 or later and PyTorch.

We support AllenNLP on Mac and Linux environments. We presently do not support Windows but are open to contributions.

Installing via conda-forge

The simplest way to install AllenNLP is using conda (you can choose a different python version):

conda install -c conda-forge python=3.8 allennlp

To install optional packages, such as checklist, use

conda install -c conda-forge allennlp-checklist

or simply install allennlp-all directly. The plugins mentioned above are similarly installable, e.g.

conda install -c conda-forge allennlp-models allennlp-semparse allennlp-server allennlp-optuna

It's recommended that you install the PyTorch ecosystem before installing AllenNLP by following the instructions on pytorch.org.

After that, just run pip install allennlp.

⚠️ If you're using Python 3.7 or greater, you should ensure that you don't have the PyPI version of dataclasses installed after running the above command, as this could cause issues on certain platforms. You can quickly check this by running pip freeze | grep dataclasses. If you see something like dataclasses=0.6 in the output, then just run pip uninstall -y dataclasses.

If you need pointers on setting up an appropriate Python environment or would like to install AllenNLP using a different method, see below.

Setting up a virtual environment

Conda can be used set up a virtual environment with the

version of Python required for AllenNLP. If you already have a Python 3

[...内容已截断,完整版请查看原文或 Wayback 快照]