Skip to content

Commit

Permalink
fix: rename _assert_exactly_one to _validate_init and make it not static
Browse files Browse the repository at this point in the history
  • Loading branch information
tomeras91 committed Jan 2, 2024
1 parent 5bb5938 commit 5384fd4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ai21_tokenizer/jurassic_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(
model_file_handle: Optional[BinaryIO] = None,
config: Optional[Dict[str, Any]] = None,
):
JurassicTokenizer._assert_exactly_one(model_path, model_file_handle)
self._validate_init(model_path, model_file_handle)

model_proto = load_binary(model_path) if model_path else model_file_handle.read()

Expand Down Expand Up @@ -67,8 +67,7 @@ def from_file_handle(
def from_file_path(cls, model_path: PathLike, config: Optional[Dict[str, Any]] = None) -> JurassicTokenizer:
return cls(model_path=model_path, config=config)

@staticmethod
def _assert_exactly_one(model_path: Optional[PathLike], model_file_handle: Optional[BinaryIO]) -> None:
def _validate_init(self, model_path: Optional[PathLike], model_file_handle: Optional[BinaryIO]) -> None:
if model_path is None and model_file_handle is None:
raise ValueError("Must provide exactly one of model_path or model_file_handle. Got none.")

Expand Down

0 comments on commit 5384fd4

Please sign in to comment.