Skip to main content

Officially supported models for the AllenNLP framework

Project description


Officially supported AllenNLP models.


Build PyPI License Codecov


❗️ To file an issue, please open a ticket on allenai/allennlp and tag it with "Models". ❗️

Installing

From PyPI

allennlp-models is available on PyPI. To install with pip, just run

pip install --pre allennlp-models

Note that the allennlp-models package is tied to the allennlp core package. Therefore when you install the models package you will get the corresponding version of allennlp (if you haven't already installed allennlp). For example,

pip install allennlp-models==1.0.0rc3
pip freeze | grep allennlp
# > allennlp==1.0.0rc3
# > allennlp-models==1.0.0rc3

From source

If you intend to install the models package from source, then you probably also want to install allennlp from source. Once you have allennlp installed, run the following within the same Python environment:

git clone https://github.com/allenai/allennlp-models.git
cd allennlp-models
ALLENNLP_VERSION_OVERRIDE='allennlp' pip install -e .
pip install -r dev-requirements.txt

The ALLENNLP_VERSION_OVERRIDE environment variable ensures that the allennlp dependency is unpinned so that your local install of allennlp will be sufficient. If, however, you haven't installed allennlp yet and don't want to manage a local install, just omit this environment variable and allennlp will be installed from the main branch on GitHub.

Both allennlp and allennlp-models are developed and tested side-by-side, so they should be kept up-to-date with each other. If you look at the GitHub Actions workflow for allennlp-models, it's always tested against the main branch of allennlp. Similarly, allennlp is always tested against the main branch of allennlp-models.

Using Docker

Docker provides a virtual machine with everything set up to run AllenNLP-- whether you will leverage a GPU or just run on a CPU. Docker provides more isolation and consistency, and also makes it easy to distribute your environment to a compute cluster.

Once you have installed Docker you can either use a prebuilt image from a release or build an image locally with any version of allennlp and allennlp-models.

If you have GPUs available, you also need to install the nvidia-docker runtime.

To build an image locally from a specific release, run

docker build \
    --build-arg RELEASE=1.2.2 \
    --build-arg CUDA=10.2 \
    -t allennlp/models - < Dockerfile.release

Just replace the RELEASE and CUDA build args what you need. Currently only CUDA 10.2 and 11.0 are officially supported.

Alternatively, you can build against specific commits of allennlp and allennlp-models with

docker build \
    --build-arg ALLENNLP_COMMIT=d823a2591e94912a6315e429d0fe0ee2efb4b3ee \
    --build-arg ALLENNLP_MODELS_COMMIT=01bc777e0d89387f03037d398cd967390716daf1 \
    --build-arg CUDA=10.2 \
    -t allennlp/models - < Dockerfile.commit

Just change the ALLENNLP_COMMIT / ALLENNLP_MODELS_COMMIT and CUDA build args to the desired commit SHAs and CUDA versions, respectively.

Once you've built your image, you can run it like this:

mkdir -p $HOME/.allennlp/
docker run --rm --gpus all -v $HOME/.allennlp:/root/.allennlp allennlp/models

Note: the --gpus all is only valid if you've installed the nvidia-docker runtime.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

allennlp_models-2.2.1.dev20210402.tar.gz (225.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

allennlp_models-2.2.1.dev20210402-py3-none-any.whl (415.2 kB view details)

Uploaded Python 3

File details

Details for the file allennlp_models-2.2.1.dev20210402.tar.gz.

File metadata

  • Download URL: allennlp_models-2.2.1.dev20210402.tar.gz
  • Upload date:
  • Size: 225.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10

File hashes

Hashes for allennlp_models-2.2.1.dev20210402.tar.gz
Algorithm Hash digest
SHA256 d81496848316698b44236568d1ead3a40d5724e5d98b10d231a36a8a75bef185
MD5 7d8ae61acbc23f91b4a8e3ebe9249d16
BLAKE2b-256 a909d204dd4cb7f3fee62e1efd6672dbfcf24263a9cc7078664f3e765e5a4c35

See more details on using hashes here.

File details

Details for the file allennlp_models-2.2.1.dev20210402-py3-none-any.whl.

File metadata

  • Download URL: allennlp_models-2.2.1.dev20210402-py3-none-any.whl
  • Upload date:
  • Size: 415.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10

File hashes

Hashes for allennlp_models-2.2.1.dev20210402-py3-none-any.whl
Algorithm Hash digest
SHA256 603d34ac17454f958d570b4bf1eca823d091d995f1daf78a72b45cb6f17e62b9
MD5 65aa9e1b7b443d223f29796defb09244
BLAKE2b-256 f50bf831255dfa217c2b193645dfb6c2e6606837bcb8deb708c5948d1b7cf26e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page