Skip to content

Avoid a top-level import of tokenizers. #935

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

Merged
merged 1 commit into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion axlearn/experiments/text/gpt/c4_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
```
"""


from axlearn.common.config import InstantiableConfig, config_for_class, config_for_function
from axlearn.common.input_lm import lm_text_preprocessor
from axlearn.common.utils import get_data_dir
Expand Down
5 changes: 4 additions & 1 deletion axlearn/experiments/text/gpt/vocabulary_fuji_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import jax
import numpy as np
import tensorflow.compat.v2 as tf
from tokenizers import Tokenizer

import axlearn.common.file_system as fs
from axlearn.common.utils import get_data_dir
Expand Down Expand Up @@ -93,6 +92,10 @@ class FujiV3Vocabulary:
"""

def __init__(self, filename: str):
# Only require tokenizers if instantiating.
# pylint: disable-next=import-outside-toplevel
from tokenizers import Tokenizer

data_dir = get_data_dir()
data_dir = (
os.path.join(os.path.dirname(__file__), "..", "..", "..", "data")
Expand Down
Loading