From a549bc9d23a7a0274738e1a98955b2b7e06030a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Perceval=20Wajsb=C3=BCrt?= Date: Tue, 21 May 2024 23:53:49 +0200 Subject: [PATCH 1/3] fix: improve windows compat --- edsnlp/core/pipeline.py | 2 +- tests/conftest.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/edsnlp/core/pipeline.py b/edsnlp/core/pipeline.py index 85864a349..1e7ace5a4 100644 --- a/edsnlp/core/pipeline.py +++ b/edsnlp/core/pipeline.py @@ -1213,7 +1213,7 @@ def load_from_huggingface( if should_install or not any( p.startswith(module_name) and p.endswith(".dist-info") for p in os.listdir(path) ): - pip = sys.executable.rsplit("/", 1)[0] + "/pip" + pip = os.path.join(*os.path.split(sys.executable)[:-1], "pip") subprocess.run( [pip, "install", path, "--target", path, "--no-deps", "--upgrade"] ) diff --git a/tests/conftest.py b/tests/conftest.py index 95b3a3521..35f533d83 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -14,7 +14,10 @@ os.environ["EDSNLP_MAX_CPU_WORKERS"] = "2" os.environ["TZ"] = "Europe/Paris" -time.tzset() +try: + time.tzset() +except AttributeError: + pass logging.basicConfig(level=logging.INFO) From 224847df32f3d7a08718fdcddc6720a3ac9a079f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Perceval=20Wajsb=C3=BCrt?= Date: Wed, 22 May 2024 00:20:05 +0200 Subject: [PATCH 2/3] fix: default to importlib.metadata --- edsnlp/core/registries.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/edsnlp/core/registries.py b/edsnlp/core/registries.py index a2d5a9c47..85256c56f 100644 --- a/edsnlp/core/registries.py +++ b/edsnlp/core/registries.py @@ -8,7 +8,6 @@ from weakref import WeakKeyDictionary import catalogue -import importlib_metadata import spacy from confit import Config, Registry, RegistryCollection, set_default_registry from confit.errors import ConfitValidationError, patch_errors @@ -17,6 +16,11 @@ import edsnlp from edsnlp.utils.collections import FrozenDict, FrozenList +try: + import importlib.metadata as importlib_metadata +except ImportError: + import importlib_metadata + PIPE_META = WeakKeyDictionary() From 67e5914127bc219773e04442ad21c726dff84121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Perceval=20Wajsb=C3=BCrt?= Date: Tue, 21 May 2024 23:20:48 +0200 Subject: [PATCH 3/3] chore: bump version to 0.12.0 --- .github/workflows/tests.yml | 2 -- README.md | 4 ++-- changelog.md | 10 +++++++++- docs/index.md | 4 ++-- edsnlp/__init__.py | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d096d89c1..9da98d295 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,8 +17,6 @@ jobs: # requites to grab the history of the PR fetch-depth: 0 - uses: actions/setup-python@v4 - with: - # cache: 'pip' - uses: pre-commit/action@v3.0.0 with: extra_args: --color=always --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }} diff --git a/README.md b/README.md index d2c7f9a4a..86482d5c3 100644 --- a/README.md +++ b/README.md @@ -34,13 +34,13 @@ Check out our interactive [demo](https://aphp.github.io/edsnlp/demo/) ! You can install EDS-NLP via `pip`. We recommend pinning the library version in your projects, or use a strict package manager like [Poetry](https://python-poetry.org/). ```shell -pip install edsnlp==0.11.2 +pip install edsnlp==0.12.0 ``` or if you want to use the trainable components (using pytorch) ```shell -pip install "edsnlp[ml]==0.11.2" +pip install "edsnlp[ml]==0.12.0" ``` ### A first pipeline diff --git a/changelog.md b/changelog.md index 0e077ffea..eafe321b9 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,14 @@ ### Added +### Changed + +### Fixed + +## v0.12.0 + +### Added + - The `eds.transformer` component now accepts `prompts` (passed to its `preprocess` method, see breaking change below) to add before each window of text to embed. - `LazyCollection.map` / `map_batches` now support generator functions as arguments. - Window stride can now be disabled (i.e., stride = window) during training in the `eds.transformer` component by `training_stride = False` @@ -55,7 +63,7 @@ ``` - Trainable embedding components now all use `foldedtensor` to return embeddings, instead of returning a tensor of floats and a mask tensor. - :boom: TorchComponent `__call__` no longer applies the end to end method, and instead calls the `forward` method directly, like all torch modules. -- The trainable `eds.span_qualifier` component has been renamed to `eds.span_classifier` to reflect its general gpurpose (it doesn't only predict qualifiers, but any attribute of a span using its context or not). +- The trainable `eds.span_qualifier` component has been renamed to `eds.span_classifier` to reflect its general purpose (it doesn't only predict qualifiers, but any attribute of a span using its context or not). - `omop` converter now takes the `note_datetime` field into account by default when building a document - `span._.date.to_datetime()` and `span._.date.to_duration()` now automatically take the `note_datetime` into account - `nlp.vocab` is no longer serialized when saving a model, as it may contain sensitive information and can be recomputed during inference anyway diff --git a/docs/index.md b/docs/index.md index ec3d6bf86..c6516420a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -15,13 +15,13 @@ Check out our interactive [demo](https://aphp.github.io/edsnlp/demo/) ! You can install EDS-NLP via `pip`. We recommend pinning the library version in your projects, or use a strict package manager like [Poetry](https://python-poetry.org/). ```{: data-md-color-scheme="slate" } -pip install edsnlp==0.11.2 +pip install edsnlp==0.12.0 ``` or if you want to use the trainable components (using pytorch) ```{: data-md-color-scheme="slate" } -pip install "edsnlp[ml]==0.11.2" +pip install "edsnlp[ml]==0.12.0" ``` ### A first pipeline diff --git a/edsnlp/__init__.py b/edsnlp/__init__.py index 4064e9947..bf23669b3 100644 --- a/edsnlp/__init__.py +++ b/edsnlp/__init__.py @@ -15,7 +15,7 @@ import edsnlp.pipes from . import reducers -__version__ = "0.11.2" +__version__ = "0.12.0" BASE_DIR = Path(__file__).parent