Skip to content

Commit

Permalink
dynamically determine project root for path to custom normalizer
Browse files Browse the repository at this point in the history
  • Loading branch information
mshannon-sil committed Oct 23, 2023
1 parent b6a6ea1 commit ef3582b
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 ef3582b

Please sign in to comment.