OpusPocus
Modular NLP pipeline manager.
OpusPocus is aimed at simplifying the description and execution of popular and custom NLP pipelines, including dataset preprocessing, model training, fine-tuning and evaluation. The pipeline manager supports execution using simple CLI (Bash) or common HPC schedulers (Slurm).
It uses OpusCleaner for data preparation and OpusTrainer for training scheduling (development in progress).
Structure
go.py- pipeline manager entry scriptopuspocus/- OpusPocus modulesopuspocus_cli/- OpusPocus CLI subcommandsconfig/- default configuration files (pipeline config, marian training config, ...)examples/- pipeline manager usage examplesscripts/- helper scripts, at this moment not directly implemented in OpusPocustests/- unit tests
Installation
- Install MarianNMT
$ ./scripts/install_marian_gpu.sh PATH_TO_CUDA CUDNN_VERSION [NUM_THREADS]
Alternatively, you can usel scripts/install_marian_cpu.sh for CPU version. Note that the scripts may require modification based on your system.
- (Optional) Setup the Python virtual environment (using virtualenv):
$ /usr/bin/virtualenv -p /usr/bin/python3.10 python-venv
- Install the Python dependencies.
(source python-venv/bin/activate # if using virtual environment)
$ pip install --upgrade pip setuptools
$ pip install -r requirements.txt
- Setup the Python virtual environment for Opuscleaner. (OpusCleaner is currently not supported by Python>=3.10.)
$ /usr/bin/virtualenv -p /usr/bin/python3.9 opuscleaner-venv
- Activate the OpusCleaner virtualenv and install OpusCleaner's dependencies
$ source opuscleaner-venv/bin/activate
$ pip install --upgrade pip setuptools
$ pip install -r requirements-opuscleaner.txt
Usage (Simple Pipeline)
Either run the main script go.py or the subcommand scripts from opuspocus_cli/ directory.
Run the scripts directly from the root directory for this repository.
(You may need to add the path to the local OpusPocus repository directory to your PYTHONPATH.)
You can execute ./go.py --help for general description or ./go.py <subcommand> --help to list the available subcommand options.
Pipeline execution
Run ./go.py run (or opuspocus_cli/run) while providing a pipeline configuration file to execute a new pipeline:
$ ./go.py --pipeline-dir <pipeline_destination> --pipeline-donfig <config_file> --runner <runner>
Alternatively, run ./go.py run while providing an existing pipeline directory to rerun a failed pipeline execution:
$ ./go.py run --pipeline-dir <pipeline_dir> --runner <runner>
You can use --reinit to reinitialize the exitisting pipeline before running.
You can use --resubmit-done to also execute pipeline steps in the DONE state.
Lastly, you can also stop and resubmit a running pipeline using --stop-previous-run
$ ./go.py run --pipeline-dir <pipeline_dir> --stop-previous-run
This is simialr to:
$ ./go.py stop --pipeline-dir <pipeline_dir>
$ ./go.py run --pipeline-dir <pipeline_dir>
Other subcommands
stop- stops the execution of a running pipelinestatus- prints the status of a pipeline its stepstraceback- prints the dependency structure of a pipeline
Examples
I. Data preprocessing example
- Download the data and setup the dataset directory structure.
$ scripts/prepare_data.en-eu.sh
- Initialize and execute the (data preprocessing) pipeline.
$ mkdir -p experiments/en-eu/preprocess.simple
$ ./go.py run \
--pipeline-config config/pipeline.preprocess.yml \
--pipeline-dir experiments/en-eu/preprocess.simple \
--runner bash
--pipeline-config(required) provides the details about the pipeline steps and their dependencies--pipeline-dir(optional) overrides thepipeline.pipeline_dirvalue from the pipeline-config--runner(required) runner to be used for pipeline execution. Use --runner slurm for more effective HPC execution (if Slurm is available)
- Check the pipeline status.
$ ./go.py traceback --pipeline-dir experiments/en-eu/preprocess.simple
OR
$ ./go.py status --pipeline-dir experiments/en-eu/preprocess.simple
II. Model training example (preprocessing follow-up)
- Check the preprocessing pipeline status (The data preprocessing pipeline must be finished, i.e. all steps must be in the DONE step)
$ ./go.py status --pipeline-dir experiments/en-eu/preprocess.simple
- Initialize and execute the training pipeline.
$ mkdir -p experiments/en-eu/train.simple
$ ./go.py run \
--pipeline-config config/pipeline.train.simple.yml \
--pipeline-dir experiments/en-eu/train.simple \
--runner bash
Acknowledgements
This project has received funding from the European Union’s Horizon Europe research and innovation programme under grant agreement No 101070350 and from UK Research and Innovation (UKRI) under the UK government’s Horizon Europe funding guarantee [grant number 10052546]
Metadata
Release files for opuspocus 0.1.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 |
|---|---|---|---|---|
| opuspocus-0.1.0.tar.gz | 60.1 kB | Without provenance | Details for opuspocus-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| opuspocus-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for opuspocus-0.1.0-py3-none-any.whl |
Total release size: 147.4 kB
Release files / opuspocus-0.1.0.tar.gz
| Download URL | opuspocus-0.1.0.tar.gz |
|---|---|
| Size | 60.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1722c77de7df894f68a1b116db4462bb96342790a3f88d0667dedcc3b9d093e5
|
|
BLAKE2b-256 checksum How to use checksums |
fc86b1b6caf80c43dc699fbb35f5aa69c475d41991bf156380085e673c6709a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / opuspocus-0.1.0-py3-none-any.whl
| Download URL | opuspocus-0.1.0-py3-none-any.whl |
|---|---|
| Size | 87.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
79873488cd0c0f8aeee6f466a684fc48339577cd76b796b600fb1ca7482219e2
|
|
BLAKE2b-256 checksum How to use checksums |
9b77be38fa7b09bb33ee63aee0bb2805225d526fbbc928ac113daa1b3e61bcb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Security for opuspocus 0.1.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.