Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make all the piece processors picklable #53

Merged
merged 3 commits into from
Jan 17, 2024
Merged

Make all the piece processors picklable #53

merged 3 commits into from
Jan 17, 2024

Conversation

danieldk
Copy link
Contributor

Description

The piece processors are not pure Python classes, so could not be pickled. Implement __reduce__ on all the processors to make them pickable.

This is one step in making spaCy multiprocessing work.

See: explosion/spaCy#13233

Types of change

Feature

Checklist

  • I confirm that I have the right to submit this contribution under the project's MIT license.
  • I ran the tests, and all new and existing tests passed.
  • My changes don't require a change to the documentation, or if they do, I've added all required information.

The piece processors are not pure Python classes, so could not be
pickled. Implement `__reduce__` on all the processors to make them
pickable.

This is one step in making spaCy multiprocessing work.

See: explosion/spaCy#13233
@danieldk danieldk added the enhancement New feature or request label Jan 17, 2024
Copy link
Member

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just had a few small comments, feel free to merge otherwise.

curated_tokenizers/_spp.pyx Outdated Show resolved Hide resolved
@danieldk
Copy link
Contributor Author

Note to self: needs to be backported to spaCy 3.x branch.

danieldk and others added 2 commits January 17, 2024 13:41
Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
@danieldk danieldk merged commit 2d35a9f into main Jan 17, 2024
12 checks passed
@danieldk danieldk deleted the feature/pickle branch January 17, 2024 12:50
danieldk added a commit to danieldk/curated-tokenizers that referenced this pull request Jan 17, 2024
* Make all the piece processors picklable

The piece processors are not pure Python classes, so could not be
pickled. Implement `__reduce__` on all the processors to make them
pickable.

This is one step in making spaCy multiprocessing work.

See: explosion/spaCy#13233

* Type signature fix.

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* Pickling tests: check class

---------

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
danieldk added a commit that referenced this pull request Jan 17, 2024
* Make all the piece processors picklable

The piece processors are not pure Python classes, so could not be
pickled. Implement `__reduce__` on all the processors to make them
pickable.

This is one step in making spaCy multiprocessing work.

See: explosion/spaCy#13233

* Type signature fix.



* Pickling tests: check class

---------

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
danieldk added a commit to danieldk/curated-tokenizers that referenced this pull request Apr 11, 2024
* Make all the piece processors picklable

The piece processors are not pure Python classes, so could not be
pickled. Implement `__reduce__` on all the processors to make them
pickable.

This is one step in making spaCy multiprocessing work.

See: explosion/spaCy#13233

* Type signature fix.

* Pickling tests: check class

---------

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants