AllenNLP
Last updated
Last updated
allennlp
is a NLP library for developing state-of-the-art models on different linguistic tasks. It provides high-level abstractions and APIs for common components and models in modern NLP. It also provides an extensible framework that makes it easy to run and manage NLP experiments.
You can find allennlp
models on the Hub by filtering at the left of the models page.
All models on the Hub come up with useful features
A training metrics tab with automatically hosted TensorBoard traces.
Metadata tags that help for discoverability.
An interactive widget you can use to play out with the model directly in the browser.
An Inference API that allows to make inference requests.
You can use the Predictor
class to load existing models on the Hub. To achieve this, use the from_path
method and use the "hf://"
prefix with the repository id. Here is an end-to-end example.
Copied
To get a snippet such as this, you can click Use in AllenNLP
at the top right,
The first step is to save the model locally. For example, you can use the archive_model
method to save the model as a model.tar.gz
file. You can then push the zipped model to the Hub. When you train a model with allennlp
, the model is automatically serialized so you can use that as a preferred option.
To push with the CLI, you can use the allennlp push_to_hf
command as seen below.
Copied
--repo_name
, -n
str / Path
Name of the repository on the Hub.
--organization
, -o
str
Optional name of organization to which the pipeline should be uploaded.
--serialization-dir
, -s
str / Path
Path to directory with the serialized model.
--archive-path
, -a
str / Path
If instead of a serialization path youβre using a zipped model (e.g. model/model.tar.gz), you can use this flag.
--local-repo-path
, -l
str / Path
Local path to the model repository (will be created if it doesnβt exist). Defaults to hub
in the current working directory.
--commit-message
, -c
str
Commit message to use for update. Defaults to "update repository"
.
The push_to_hf
function has the same parameters as the bash script.
Copied
In just a minute, you can get your model in the Hub, try it out directly in the browser, and share it with the rest of the community. All the required metadata will be uploaded for you!
AllenNLP website.
AllenNLP repository.