Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@
- The loss of `eds.ner_crf` is now computed as the mean over the words instead of the sum. This change is compatible with multi-gpu training.
- Having multiple stats keys matching a batching pattern now warns instead of raising an error.

### Changed

- The loss of `eds.ner_crf` is now computed as the mean over the words instead of the sum. This change is compatible with multi-gpu training.
- Having multiple stats keys matching a batching pattern now warns instead of raising an error.

### Fixed

- Support packaging with poetry 2.0
Expand Down
4 changes: 3 additions & 1 deletion edsnlp/metrics/dep_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ def dependency_parsing_metric(
The examples to score, either a tuple of (golds, preds) or a list of
spacy.training.Example objects
filter_expr : Optional[str]
The filter expression to use to filter the documents
The filter expression to use to filter the documents. The expression
should be a valid Python test and uses the variable `doc` to refer to
the reference (gold) document.

Returns
-------
Expand Down
3 changes: 3 additions & 0 deletions edsnlp/pipes/trainable/ner_crf/ner_crf.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,9 @@ def collate(self, preps) -> NERBatchInput:
k: sum(v) for k, v in preps["stats"].items() if not k.startswith("__")
},
}
collated["stats"] = {
k: sum(v) for k, v in preps["stats"].items() if not k.startswith("__")
}
lengths = [length for sample in preps["lengths"] for length in sample]
max_len = max(lengths)
if "targets" in preps:
Expand Down
1 change: 1 addition & 0 deletions tests/training/dep_parser_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ scorer:
speed: false
dep:
'@metrics': "eds.dep_parsing"
filter_expr: "doc.text != ''"

# 🎛️ OPTIMIZER
optimizer:
Expand Down
Loading