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

fix: add tiktoken fallback mechanism. #3929

Merged
merged 24 commits into from
Jan 25, 2023

Conversation

danielbichuetti
Copy link
Contributor

@danielbichuetti danielbichuetti commented Jan 24, 2023

Related Issues

Proposed Changes:

Implemented fallback to HF FastTokenizer in Linux ARM64 and AARCH64

How did you test it?

Ubuntu 22.04, Windows, Mac M1

Notes for the reviewer

tiktoken wheels available in PiPy:
https://pypi.org/pypi/tiktoken/json

Checklist

  • I have read the contributors guidelines and the code of conduct
  • I have updated the related issue with new insights and changes
  • I added tests that demonstrate the correct behavior of the change
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test:.
  • I documented my code
  • I ran pre-commit hooks and fixed any issue

@danielbichuetti danielbichuetti requested a review from a team as a code owner January 24, 2023 20:01
@danielbichuetti danielbichuetti requested review from ZanSara and removed request for a team January 24, 2023 20:01
Copy link
Contributor

@ZanSara ZanSara left a comment

Choose a reason for hiding this comment

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

Hey @danielbichuetti, thank you for this fix! We realized just yesterday night that tiktoken broke a few Docker builds 🙈 Hopefully this will fix it.

@sjrl
Copy link
Contributor

sjrl commented Jan 25, 2023

Linking this to the open issue on the tiktoken library for visibility openai/tiktoken#23

@sjrl
Copy link
Contributor

sjrl commented Jan 25, 2023

Just out of curiosity, would the workaround in this comment work for us as well? (Basically building the wheels from scratch). This way we could keep the tiktoken library in our docker images as well, but I'm not sure of the cons of this approach.

@ZanSara
Copy link
Contributor

ZanSara commented Jan 25, 2023

Yesterday with @silvanocerza we tried to apply it with no success. We could try harder, but I don't see the benefit right now. I think makes sense to disable the unsupported platforms for this release, and reconsider it later. Maybe there are going to be prebuilt wheels by then!

I will take care of adding a "self-destructing" reminder test in Haystack once CI has been moved to 3.8, so that we don't forget.

@ZanSara ZanSara merged commit afc1e1c into deepset-ai:main Jan 25, 2023
ZanSara pushed a commit that referenced this pull request Jan 27, 2023
* feat: migrate to tiktoken when tokenizing for OpenAI

* refactor: add OpenAI optional egg

* fix: add Python 3.7 fallback support for tiktoken

* refactor: change both tokenization implementations and fix mypy

* refactor: remove dummy-class

* refactor: add tiktoken as core dependency and minor refactoring

* refactor: sort imports

* refactor: remove out-of-scope PR change

* refactor: reintroduce corner case check

* refactor: remove unused egg

* refactor: remove unused exception after titkoken as core dep

* refactor: reduce ifs and include log warning

* refactor: remove timeout linting ignore

* refactor: revert change due to mypy

* refactor: disable pylint import error

* fix: add arm64 fallback to HF tokenizer

* fix: add aarch64 fallback mechanism

* refactor: improve log message

* fix: change platform selection method

* refactor: consolidate archs
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.

3 participants