Record Class BPEModel
java.lang.Object
java.lang.Record
io.github.kirstenali.deepj.tokenizers.bpe.BPEModel
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBPEModel(List<byte[]> idToBytes, Map<String, Integer> tokenKeyToId, List<TokenPair> merges, Map<TokenPair, Integer> mergeToNewId, int endOfWordId) BPEModel(List<byte[]> idToBytes, Map<String, Integer> tokenKeyToId, List<TokenPair> merges, Map<TokenPair, Integer> mergeToNewId, int endOfWordId, int modelFormatVersion, Map<String, Integer> specialTokenToId) Creates an instance of aBPEModelrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of theendOfWordIdrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanList<byte[]>Returns the value of theidToBytesrecord component.merges()Returns the value of themergesrecord component.Returns the value of themergeToNewIdrecord component.intReturns the value of themodelFormatVersionrecord component.Returns the value of thespecialTokenToIdrecord component.Returns the value of thetokenKeyToIdrecord component.final StringtoString()Returns a string representation of this record class.int
-
Field Details
-
CURRENT_FORMAT_VERSION
public static final int CURRENT_FORMAT_VERSION- See Also:
-
-
Constructor Details
-
BPEModel
-
BPEModel
public BPEModel(List<byte[]> idToBytes, Map<String, Integer> tokenKeyToId, List<TokenPair> merges, Map<TokenPair, Integer> mergeToNewId, int endOfWordId, int modelFormatVersion, Map<String, Integer> specialTokenToId) Creates an instance of aBPEModelrecord class.- Parameters:
idToBytes- the value for theidToBytesrecord componenttokenKeyToId- the value for thetokenKeyToIdrecord componentmerges- the value for themergesrecord componentmergeToNewId- the value for themergeToNewIdrecord componentendOfWordId- the value for theendOfWordIdrecord componentmodelFormatVersion- the value for themodelFormatVersionrecord componentspecialTokenToId- the value for thespecialTokenToIdrecord component
-
-
Method Details
-
idToBytes
Returns the value of theidToBytesrecord component.- Returns:
- the value of the
idToBytesrecord component
-
specialTokenToId
Returns the value of thespecialTokenToIdrecord component.- Returns:
- the value of the
specialTokenToIdrecord component
-
vocabSize
public int vocabSize() -
hasSpecialTokens
public boolean hasSpecialTokens() -
idToSpecialToken
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
tokenKeyToId
Returns the value of thetokenKeyToIdrecord component.- Returns:
- the value of the
tokenKeyToIdrecord component
-
merges
Returns the value of themergesrecord component.- Returns:
- the value of the
mergesrecord component
-
mergeToNewId
Returns the value of themergeToNewIdrecord component.- Returns:
- the value of the
mergeToNewIdrecord component
-
endOfWordId
public int endOfWordId()Returns the value of theendOfWordIdrecord component.- Returns:
- the value of the
endOfWordIdrecord component
-
modelFormatVersion
public int modelFormatVersion()Returns the value of themodelFormatVersionrecord component.- Returns:
- the value of the
modelFormatVersionrecord component
-