Skip to content

fix: register replace_tokenizer callback on import (Fixes #440)#604

Open
Chessing234 wants to merge 1 commit into
allenai:mainfrom
Chessing234:fix/issue-440-register-replace-tokenizer-callback
Open

fix: register replace_tokenizer callback on import (Fixes #440)#604
Chessing234 wants to merge 1 commit into
allenai:mainfrom
Chessing234:fix/issue-440-register-replace-tokenizer-callback

Conversation

@Chessing234

@Chessing234 Chessing234 commented Jun 24, 2026

Copy link
Copy Markdown

Fixes #440

scispaCy model configs reference @callbacks = "replace_tokenizer", but that callback lives in base_project_code.py and was only registered during spaCy project training—not on a normal import scispacy. Calling nlp.begin_training() then fails with RegistryError: Could not find function 'replace_tokenizer'.

Import base_project_code from scispacy/__init__.py so the callback is registered whenever scispacy is imported.

Imported scispaCy models reference the replace_tokenizer training callback,
but it was only registered when base_project_code was loaded for project
training. Importing scispacy now registers callbacks so begin_training works.

Fixes allenai#440

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Training scispacy pipelines require recreating the vocab file

1 participant