Skip to content

Commit

Permalink
Move conditional tiktoken import to the __init__ func (#842)
Browse files Browse the repository at this point in the history
* Move conditional tiktoken import to the __init__ func

* Update NeoXArgs docs automatically

---------

Co-authored-by: github-actions <[email protected]>
  • Loading branch information
Quentin-Anthony and github-actions authored Mar 18, 2023
1 parent 91b72d9 commit e2d8a24
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion configs/neox_arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Logging Arguments

- **git_hash**: str

Default = 7d682df
Default = 6dd0344

current git hash of repository

Expand Down
12 changes: 6 additions & 6 deletions megatron/tokenizer/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,13 +353,13 @@ def eod(self):
class TiktokenTokenizer(AbstractTokenizer):
"""Tokenizer from OpenAI's tiktoken implementation"""

try:
import tiktoken
except ModuleNotFoundError:
print("Please install tiktoken: (https://github.com/openai/tiktoken)")
raise Exception

def __init__(self, vocab_file):
try:
import tiktoken
except ModuleNotFoundError:
print("Please install tiktoken: (https://github.com/openai/tiktoken)")
raise Exception

name = "TiktokenTokenizer"
super().__init__(name)

Expand Down

0 comments on commit e2d8a24

Please sign in to comment.