Repository navigation
feat: get typed spans from the encoder (#153) - #191
Merged
Merged
Conversation
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Typed spans from the encoder (#153, sub-issues #154 and #155).
TaxonomyTyperbecomes a loaded object like the encoder, andEncoderDetector.detectuses it to give every span acategoryandsubcategory. A typed call is metered with twousageentries: the encoder and the typer.Base branch is
stateless_core, notmain. Close #153 by hand after the merge.Details:
usagereports the typer'sspansas the number of spans it was given, beforemin_scorefilters them.model_version. A hub typer records the resolved commit.revisionis not forwarded to the typing head, because it names a revision of the encoder's repo. Onlycache_dir,local_files_onlyandtokenare shared._model_load_errorand is shared by the encoder and the typer. A local path raisesConfigurationErrorand a hub id raisesUpstreamError, both withmodel_load_failed.TransformerDetector(taxonomy_head=...)still types its spans. It now builds the typer throughTaxonomyTyper.from_pretrained, and the output equals the typed golden fixture.Related issue
Closes #153 (also covers #154 and #155). Part of #126.
Type of change
Testing
New tests:
tests/test_taxonomy_typer_pytest.py(24 tests), typed cases intests/test_encoder_detector_pytest.py, and a typed golden case intests/test_golden_transformer_pytest.py. Existing tests, including the custom taxonomy tests, pass with only mechanical edits.ruff format --check lettucedetect/ lettucedetect_api/ tests/→ 96 files already formattedruff check lettucedetect/ lettucedetect_api/ tests/ --extend-exclude lettucedetect/integrations/→ All checks passedpython -m pytest→ 689 passedBefore and after for the main behavior:
Checklist
Rights & sign-off (required)
distributed under the repository's MIT license
(see CONTRIBUTING).