Skip to main content

OpusCleaner

OpusCleaner is a machine translation/language model data cleaner and training scheduler. The Training scheduler has moved to OpusTrainer.

Cleaner

The cleaner bit takes care of downloading and cleaning multiple different datasets and preparing them for translation.

opuscleaner-clean --parallel 4 data/train-parts/dataset.filter.json | gzip -c > clean.gz

Installation for cleaning

If you just want to use OpusCleaner for cleaning, you can install it from PyPI, and then run it

pip3 install opuscleaner
opuscleaner-server

Then you can go to http://127.0.0.1:8000/ to show the interface.

You can also install and run OpusCleaner on a remote machine, and use SSH local forwarding (e.g. ssh -L 8000:localhost:8000 you@remote.machine) to access the interface on your local machine.

Dependencies

(Mainly listed as shortcuts to documentation)

  • FastAPI as the base for the backend part.
  • Pydantic for conversion of untyped JSON to typed objects. And because FastAPI automatically supports it and gives you useful error messages if you mess up things.
  • Vue for frontend

Screenshots

List and categorize the datasets you are going to use for training.

Download more datasets right from the interface.

Filter each individual dataset, showing you the results immediately.

Compare the dataset at different stages of filtering to see what the impact is of each filter.

Using your own data

OpusCleaner scans for datasets and finds them automatically if they're in the right format. When you download OPUS data, it will get converted to this format, and there's nothing stopping you from adding your own in the same format.

By default, it scans for files matching data/train-parts/*.*.gz and will derive which files make up a dataset from the filenames: name.en.gz and name.de.gz will be a dataset called name. The files are your standard moses format: a single sentence per line, and each Nth line in the first file will match with the Nth line of the second file.

When in doubt, just download one of the OPUS datasets through OpusCleaner, and replicate the format for your own dataset.

If you want to use another path, you can use the DATA_PATH environment variable to change it, e.g. run DATA_PATH="./my-datasets/*.*.gz" opuscleaner-server.

Paths

  • data/train-parts is scanned for datasets. You can change this by setting the DATA_PATH environment variable, the default is data/train-parts/*.*.gz.
  • filters should contain filter json files. You can change the FILTER_PATH environment variable, the default is <PYTHON_PACKAGE>/filters/*.json.

Installation for development

For building from source (i.e. git, not anything downloaded from Pypi) you'll need to have node + npm installed.

python3 -m venv .env
bash --init-file .env/bin/activate
pip install -e .

Finally you can run opuscleaner-server as normal. The --reload option will cause it to restart when any of the python files change.

opuscleaner-server serve --reload

Then go to http://127.0.0.1:8000/ for the "interface" or http://127.0.0.1:8000/docs for the API.

Frontend development

If you're doing frontend development, try also running:

cd frontend
npm run dev

Then go to http://127.0.0.1:5173/ for the "interface".

This will put vite in hot-reloading mode for easier Javascript dev. All API requests will be proxied to the python server running in 8000, which is why you need to run both at the same time.

Filters

If you want to use LASER, you will also need to download its assets:

python -m laserembeddings download-models

Packaging

Run npm build in the frontend/ directory first, and then run hatch build . in the project directory to build the wheel and source distribution.

To push a new release to Pypi from Github, tag a commit with a vX.Y.Z version number (including the v prefix). Then publish a release on Github. This should trigger a workflow that pushes a sdist + wheel to pypi.

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 opuscleaner 0.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opuscleaner 0.7.1
File Size Uploaded Provenance Actions
opuscleaner-0.7.1.tar.gz 343.9 kB Without provenance Details for opuscleaner-0.7.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opuscleaner 0.7.1
File Interpreter ABI Platform Actions
opuscleaner-0.7.1-py3-none-any.whl Python 3 none any Details for opuscleaner-0.7.1-py3-none-any.whl

Total release size: 722.1 kB

Release files / opuscleaner-0.7.1.tar.gz

Download URL opuscleaner-0.7.1.tar.gz
Size 343.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d7dea15bddc6820cf967f87182cf9a2a9c5bd4440a4c8916be1b3585766dba10
BLAKE2b-256 checksum
How to use checksums
9b7175a90a108b1f0fd21d34ab1ae37c831bf746790730a3cf37bdd79f374ee6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.23

Release files / opuscleaner-0.7.1-py3-none-any.whl

Download URL opuscleaner-0.7.1-py3-none-any.whl
Size 378.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3d114849880cfa1e1c648c89ab9e389462bead53be192c484c867d0939eca22c
BLAKE2b-256 checksum
How to use checksums
d6659b68245ae25cd544459aaaadad26626101f2f962ec5c79ae1ab289097201
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.23

Security for opuscleaner 0.7.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page