Skip to content

Commit

Permalink
Use typing.Union for support with older Python versions
Browse files Browse the repository at this point in the history
  • Loading branch information
carmocca committed Nov 14, 2023
1 parent c883bc5 commit 703de02
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lit_gpt/tokenizer.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import json
from pathlib import Path
from typing import Optional
from typing import Optional, Union

import torch


class Tokenizer:
def __init__(self, checkpoint_dir: Path | str) -> None:
def __init__(self, checkpoint_dir: Union[Path, str]) -> None:
checkpoint_dir = Path(checkpoint_dir)
if not checkpoint_dir.exists():
raise NotADirectoryError(f"The checkpoint directory does not exist: {str(checkpoint_dir)}")
Expand Down

0 comments on commit 703de02

Please sign in to comment.