Installation¶
Requirements¶
Install the package¶
pip install pie-extended
Without a backend, the package installs, and a model that needs a missing one says which extra to install.
No GPU, no CUDA?
By default, pip downloads a PyTorch built for CUDA, which is large. If you only have a CPU (or if you are in doubt), ask for the CPU build:
pip install pie-extended --extra-index-url https://download.pytorch.org/whl/cpu
This gives you the pie-extended command and the pie_extended Python package. Check it with:
pie-extended list
Optional dependencies¶
Extra |
Command |
What for |
|---|---|---|
|
|
Models run through spaCy ( |
|
|
The lemmatizer Sôtêr with a light spaCy pipeline ( |
|
|
Build this documentation |
Install the models¶
The models are not part of the package: they are downloaded for each model you need from Hugging Face, when it is first
used, and kept in the cache of Hugging Face (~/.cache/huggingface, or HF_HOME). pie-extended download does it in
advance, which you need to run offline (HF_HUB_OFFLINE=1). The few files that a model needs besides (the lexicons of
lasla) go in the folder downloads of the package, or in PIE_EXTENDED_DOWNLOADS if you set it; pie-extended tag fetches them when they are
missing, and get_tagger from Python raises FilesNotDownloaded (a FileNotFoundError) that says to run pie-extended download MODEL
(or pie_extended.cli.utils.ensure_files("lasla")).
pie-extended download lasla # the files of the model
pie-extended install-addons hy_xcl # what a model needs besides its files, for the few that need something
Which command does what depends on the model:
downloadfetches the model from Hugging Face, and the files that it needs besides; a model that runs a spaCy pipeline has none;install-addonsruns the extra installation of the model, for the two models that have one:hy_xcllearns from a treebank how to split the clitics of Classical Armenian, andgrc_grecyinstalls its spaCy pipeline. For the others it does nothing.
Models tells what each model needs.
A note on safety
A Pie model is a file produced by PyTorch, and PyTorch files can contain code. With torch 2.6 or later (the default with a recent PaPie), loading refuses to run any code it finds. With torch 2.4 and 2.5, which PaPie still allows, it does not: only download the models of authors you trust.
Install the development version¶
Clone the repository, create an environment, and then:
pip install -e ".[docs]" --extra-index-url https://download.pytorch.org/whl/cpu
pip install pytest pytest-cov
pie-extended download lasla # needed by some of the tests
pytest --doctest-modules tests pie_extended
Build this documentation with make docs: the result is in docs/_build/html
(make docs-serve serves it on http://localhost:8000).
Release a new version¶
Releases are published on PyPI by a workflow, when a tag is pushed:
change
versioninpyproject.tomland commit it;git tag vX.Y.Z(the tag must bevfollowed by that version) andgit push origin vX.Y.Z.
The workflow runs the tests on every supported Python, builds the package, checks that the tag is the version, and publishes it. Nothing is published if one of these fails. No password is stored: PyPI trusts the workflow (trusted publishing, set up once in the settings of the project on PyPI).