AllenNLP-Hydra
Plugin For AllenNLP that enables composing configs through the use of the Hydra Library from Facebook Research.
NOTE there is no affiliation between this project and AllenNLP or the Allen Institute for AI.
We use the same contributions guideline as AllenNLP in order to maintain similar code styles. For this reason our style guide is the same as that found in their repository.
Install Instructions
Clone the repo
pip install .
echo allennlp_hydra >> ~.allennlp_plugins
The second line adds allennlp-hydra to the allennlp plugins file so that it
can globally be recognized.
Basic Guide
Say you have the following directory structure:
project
+-- conf
| +-- dataset_readers
| | +-- A.yaml
| | +-- B.yaml
| +-- models
| | +-- C.yaml
| | +-- D.yaml
| +-- config.yaml
+-- experiments
conf/dataset_readers/A.yaml:
type: A
start_token: <s>
end_token: </s>
conf/dataset_readers/B.yaml:
type: B
start_token: [CLS]
end_token: [SEP]
conf/models/C.yaml:
type: C
layers: 5
conf/models/D.yaml:
type: D
input_dim: 10
config.yaml
defaults:
- dataset_reader: A
- model: C
debug: false
Then running the command
allennlp compose conf config example -s experiments
Produces the file project/experiments/config.json
{
"dataset_reader":{
"type": "A",
"start_token": "<s>",
"end_token": "</s>"
},
"model": {
"type": "C",
"layers": 5
},
"debug": false
}
If you want to override the config and use the B dataset reader with the D
model, you would modify the previous command:
allennlp compose conf config example -s experiments -o model=D dataset_reader=B
Produces the file project/experiments/config.json
{
"dataset_reader":{
"type": "B",
"start_token": "[CLS]",
"end_token": "[SEP]"
},
"model": {
"type": "D",
"input_dim": 10
},
"debug": false
}
And if you wanted to change input_dim of model D to 25:
allennlp compose conf config example -s experiments -o model=D dataset_reader=B model.input_dim=25
Produces the file project/experiments/config.json
{
"dataset_reader":{
"type": "B",
"start_token": "[CLS]",
"end_token": "[SEP]"
},
"model": {
"type": "D",
"input_dim": 25
},
"debug": false
}
Metadata
Release files for allennlp-hydra 0.0.7
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-hydra-0.0.7.tar.gz | 15.3 kB | Without provenance | Details for allennlp-hydra-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| allennlp_hydra-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for allennlp_hydra-0.0.7-py3-none-any.whl |
Total release size: 33.5 kB
Release files / allennlp-hydra-0.0.7.tar.gz
| Download URL | allennlp-hydra-0.0.7.tar.gz |
|---|---|
| Size | 15.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a89e40e50de4f6b320126f0cde7561d7866d72f532e62c95b769120cc104d160
|
|
BLAKE2b-256 checksum How to use checksums |
64380ff58e94225ccf91a77cf1855a59906a0156462bb832fc092617ebc9d1fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.11
|
Release files / allennlp_hydra-0.0.7-py3-none-any.whl
| Download URL | allennlp_hydra-0.0.7-py3-none-any.whl |
|---|---|
| Size | 18.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b0f1d9bd2633f808275f79dfab5aa13b35d38f1f7789af9cacfd50592a50080f
|
|
BLAKE2b-256 checksum How to use checksums |
394a8e6d24ef820849780302dd7838c212943d318481a6b835da0e4626296502
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.11
|
Security for allennlp-hydra 0.0.7
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.