allennlp-light
Installation
- Install PyTorch: pytorch.org
pip install allennlp-light
Example
>>> from allennlp_light import Seq2SeqEncoder
>>> Seq2SeqEncoder.list_available()
['compose', 'feedforward', 'gated-cnn-encoder', 'pass_through', 'gru', 'lstm', 'rnn', 'augmented_lstm', 'alternating_lstm', 'stacked_bidirectional_lstm', 'pytorch_transformer']
About
As AllenNLP framework honorably retires and will not update dependencies, allennlp-light is a port of AllenNLP's awesome modules and nn portions into a standalone package with minimum dependencies.
allennlp-light natively integrates with Tango (check it out!) by using its FromParams/Registrable so you get allennlp's components for free, registered, and ready to use. \
The modules are thoroughly documented and tested in the original AllenNLP repository.
To learn how to use them, check the relevan section in the AllenNLP guide.
AllenNLP is licensed under Apache 2 Licence, so please see below the copyright notice and the list of changes.
Copyright
Below is the copyright notice that applies to all source codes.
Copyright 2017 The Allen Institute for Artificial Intelligence
Adapted by Maksym Del from https://github.com/allenai/allennlp/tree/8571d930fe6dc6291c6351c6e599576b007cf22f
SPDX-License-Identifier: Apache-2.0
List of changes
I kept the log of how I got from allennlp to allennlp-light.
Copied with changes from
https://github.com/allenai/allennlp/tree/8571d930fe6dc6291c6351c6e599576b007cf22f
Only codes from allennlp/modules and allennlp/nn folders are copied.
The purpose is to integrate AllenNLP modules with the Tango project (https://github.com/allenai/tango).
The following is the list of the changes made to the AllenNLP original (allennlp/modules and allennlp/nn) files:
Removed files and folders:
- allennlp/modules/transformer
- allennlp/modules/token_embedders
- allennlp/modules/text_field_embedders
- allennlp/modules/backbones
- allennlp/modules/elmo.py
- allennlp/modules/elmo_lstm.py
- allennlp/nn/parallel
- allennlp/nn/checkpoint
- allennlp/nn/beam_search.py
- allennlp/nn/module.py
Removed from the nn/util.py file:
- line: from itertools import chain
- line: import torch.distributed as dist
- line: from allennlp.common.util import int_to_device, is_distributed, is_global_primary
- func: find_text_field_embedder
- func: find_embedding_layer
- func: move_to_device
- func: distributed_device
- line: _V = TypeVar("_V", int, float, torch.Tensor)
- func: dist_reduce
- func: dist_reduce_sum
- func: _collect_state_dict
- func: load_state_dict_distributed
- func: _broadcast_params
- class: _IncompatibleKeys
- func: _check_incompatible_keys
Removed from the nn/__init__.py file:
- line: from allennlp.nn.module import Module
Removed/added from/to the modules/__init__.py file:
- line: from allennlp.modules.backbones import Backbone
- line: from allennlp.modules.elmo import Elmo
- line: from allennlp.modules.text_field_embedders import TextFieldEmbedder
- line: from allennlp.modules.token_embedders import TokenEmbedder, Embedding
+ line: from allennlp.modules.span_extractors import SpanExtractor
Removed/added from/to the modules/span_extractors/span_extractor_with_span_width_embedding.py file:
- from allennlp.modules.token_embedders.embedding import Embedding
+ from torch.nn import Embedding
Removed from /nn/initializers.py file:
- class: PretrainedModelInitializer
Renamed across all files and folders:
* from allennlp.common.checks import ConfigurationError -> from tango.common.exceptions import ConfigurationError
* from allennlp.common -> from tango.common // this line redirects imports of Registrable and FromParams classes to Tango versions
* allennlp -> allennlp-light
Metadata
Release files for allennlp-light 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| allennlp-light-1.0.0.tar.gz | 107.4 kB | Without provenance | Details for allennlp-light-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| allennlp_light-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for allennlp_light-1.0.0-py3-none-any.whl |
Total release size: 267.3 kB
Release files / allennlp-light-1.0.0.tar.gz
| Download URL | allennlp-light-1.0.0.tar.gz |
|---|---|
| Size | 107.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
89a7c0d5a349c57231d9521425bf8682460a349ed55421ce9c98153fcb2e0275
|
|
BLAKE2b-256 checksum How to use checksums |
9d8de8add9a18014b5b786d21c2f4ee0fca1fbb4590081c45c755167d5cae65e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|
Release files / allennlp_light-1.0.0-py3-none-any.whl
| Download URL | allennlp_light-1.0.0-py3-none-any.whl |
|---|---|
| Size | 159.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad53b68b189daa43f84b1106c42a487e4d5ec6d40efc54fcb2ce38c26ce13535
|
|
BLAKE2b-256 checksum How to use checksums |
a36a10b2f78e96c3267a4e0326f51b075bfc8342ad2e32d4168795051c4b8fb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|
Security for allennlp-light 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.