AllenNLP

raw JSON →
0.9.1.dev201910011800 verified Fri May 01 auth: no python

An open-source NLP research library built on PyTorch. The nightly build tracks development changes and may be unstable. The latest stable release is 2.10.1 (requires Python >=3.6.1). Release cadence: irregular, with major versions roughly every few months.

pip install allennlp-pvt-nightly
error ModuleNotFoundError: No module named 'allennlp_models'
cause Gluing pretrained model loading often requires allennlp_models package.
fix
Run: pip install allennlp_models
error AttributeError: module 'allennlp' has no attribute 'predictors'
cause Trying to import Predictor from the allennlp root package.
fix
Use: from allennlp.predictors import Predictor
breaking AllenNLP v2.0 removed the 'allennlp.commands' module. Use 'allennlp run' or programmatic APIs instead.
fix Update scripts to use allennlp.run or direct API calls.
breaking Nightly builds may have incompatible changes or missing dependencies. Pin to a specific nightly version for reproducibility.
fix Install a specific version: pip install allennlp-pvt-nightly==0.9.1.dev201910011800
gotcha The nightly build might have different model serialization format than stable releases.
fix Use models trained with the same nightly version.

Load a pretrained BiDAF model and run a prediction. Requires allennlp_models to be installed.

from allennlp.predictors import Predictor
import allennlp_models

predictor = Predictor.from_path("https://storage.googleapis.com/allennlp-public-models/bidaf-elmo-model-2020.03.19.tar.gz")
result = predictor.predict("The quick brown fox jumps over the lazy dog.")
print(result)