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

[Experimental] Add GPTNeoXTokenizer support to HFTokenizerConverter #678

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kazssym
Copy link
Contributor

@kazssym kazssym commented Mar 24, 2024

This pull request adds experimental GPTNeoXTokenizer support.

…erter

This commit updates `HFTokenizerConverter` to handle cases where the `hf_tokenizer` object might not have a `vocab_file` attribute.

Changes:

* Uses `getattr` to retrieve the `vocab_file` attribute for flexibility
* Stores the retrieved value in a separate variable `vocab_file` for clarity
* Checks if `vocab_file` is `None` before checking its existence

This ensures the converter works correctly even with tokenizers that don't define a `vocab_file` attribute.
This commit adds support for the `GPTNeoXTokenizer` class from Hugging Face Transformers to the `HFTokenizerConverter` in the `onnxruntime_extensions` library.

Specifically, it includes a new entry in the `_PROCESSOR_DICT` dictionary for `GPTNeoXTokenizer`, referencing the existing `HFTokenizerConverter.bpe_tokenizer` and `HFTokenizerConverter.bpe_decoder` functions for handling tokenization and decoding.

This allows seamless integration of GPTNeoX models with ONNX Runtime through the `HFTokenizerConverter`.
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.

1 participant