Skip to content

Commit

Permalink
dynamically determine project root for path to custom normalizer (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshannon-sil authored Oct 24, 2023
1 parent b6a6ea1 commit d7f9d69
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ def add_tokens(tokenizer: Any, missing_tokens: List[str]) -> Any:
)
else:
norm_tok = PreTrainedTokenizerFast.from_pretrained(
"./machine/translation/huggingface/custom_normalizer", use_fast=True
str(Path(os.path.dirname(os.path.abspath(__file__))) / "custom_normalizer"),
use_fast=True,
)
# using unofficially supported behavior to set the normalizer
tokenizer.backend_tokenizer.normalizer = norm_tok.backend_tokenizer.normalizer # type: ignore
Expand Down

0 comments on commit d7f9d69

Please sign in to comment.