Package ai.djl.huggingface.tokenizers
Class TokenizerConfig
java.lang.Object
ai.djl.huggingface.tokenizers.TokenizerConfig
Configuration class for HuggingFace tokenizer. Loads and holds configuration from
tokenizer_config.json.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe constant DEFAULT_MAX_LENGTH. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets bos token.Gets cls token.Gets eos token.intGets model max length.Gets pad token.Gets sep token.Gets tokenizer class.Gets unk token.booleanHas explicit add prefix space boolean.booleanHas explicit strip accents boolean.booleanIs add prefix space boolean.booleanIs clean up tokenization spaces boolean.booleanIs strip accents boolean.static TokenizerConfigLoad tokenizer config.
-
Field Details
-
DEFAULT_MAX_LENGTH
public static final int DEFAULT_MAX_LENGTHThe constant DEFAULT_MAX_LENGTH.- See Also:
-
-
Constructor Details
-
TokenizerConfig
public TokenizerConfig()
-
-
Method Details
-
load
Load tokenizer config.- Parameters:
configPath- the config path- Returns:
- the tokenizer config
-
getModelMaxLength
public int getModelMaxLength()Gets model max length.- Returns:
- the model max length
-
isStripAccents
public boolean isStripAccents()Is strip accents boolean.- Returns:
- the boolean
-
isCleanUpTokenizationSpaces
public boolean isCleanUpTokenizationSpaces()Is clean up tokenization spaces boolean.- Returns:
- the boolean
-
isAddPrefixSpace
public boolean isAddPrefixSpace()Is add prefix space boolean.- Returns:
- the boolean
-
getBosToken
Gets bos token.- Returns:
- the bos token
-
getEosToken
Gets eos token.- Returns:
- the eos token
-
getUnkToken
Gets unk token.- Returns:
- the unk token
-
getSepToken
Gets sep token.- Returns:
- the sep token
-
getPadToken
Gets pad token.- Returns:
- the pad token
-
getClsToken
Gets cls token.- Returns:
- the cls token
-
getTokenizerClass
Gets tokenizer class.- Returns:
- the tokenizer class
-
hasExplicitStripAccents
public boolean hasExplicitStripAccents()Has explicit strip accents boolean.- Returns:
- the boolean
-
hasExplicitAddPrefixSpace
public boolean hasExplicitAddPrefixSpace()Has explicit add prefix space boolean.- Returns:
- the boolean
-