Package-level declarations
Every public type of the engine lives in this package.
Core:
Tensor,noGrad,MatMul,Quantization,QuantizedTensor,ModuleLayers:
Linear,QuantizedLinear,Embedding,QuantizedEmbedding,TiedQuantizedEmbedding,RMSNorm,RoPE,SwiGLU,Attention,TransformerBlock,Transformer,KVCache,PromptPrefix,InferenceBuffersTraining:
mseLoss,crossEntropyLoss,fusedCrossEntropyLoss,IGNORE_INDEX,SGD,AdamW,DataLoader,LoRALinear,LoRAAdapter,FineTuningPipelineText:
Tokenizer,SimpleTokenizer,BPETokenizer,IncrementalDecoder,StreamingSession,Sampling,SamplerI/O:
SafeTensors,SafeTensorsFile,HuggingFaceModelLoader,HuggingFaceConfig,JsonParser
Types
Link copied to clipboard
class Attention(val dimension: Int, val numHeads: Int, val numKeyValueHeads: Int = numHeads, val ropeTheta: Float = 10000.0f, ropeScaling: RoPEScaling? = null, quantization: Quantization? = null) : Module
Link copied to clipboard
class BPETokenizer(vocab: Map<String, Int>, merges: List<Pair<String, String>>, specialTokens: Map<String, Int> = emptyMap(), addedTokens: Map<String, Int> = emptyMap(), val preTokenizerPattern: String = GPT2_PRE_TOKENIZER_PATTERN, val addPrefixSpace: Boolean = false, val normalization: String? = null, val ignoreMerges: Boolean = false, val unkToken: String? = null, prefixTokens: IntArray = IntArray(0), suffixTokens: IntArray = IntArray(0)) : Tokenizer
Link copied to clipboard
class DataLoader @JvmOverloads constructor(val tokens: IntArray, val batchSize: Int, val sequenceLength: Int, val labels: IntArray = tokens)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
class HuggingFaceConfig(val modelType: String, val hiddenSize: Int, val numHiddenLayers: Int, val numAttentionHeads: Int, val numKeyValueHeads: Int, val intermediateSize: Int, val rmsNormEps: Float, val ropeTheta: Float, val vocabSize: Int, val maxPositionEmbeddings: Int, val tieWordEmbeddings: Boolean, val ropeScaling: RoPEScaling? = null)
Link copied to clipboard
object HuggingFaceModelLoader
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
class JsonParser
Link copied to clipboard
Link copied to clipboard
class LoRAAdapter(val model: Transformer, val rank: Int = 4, val alpha: Float = 1.0f, blockIndices: Iterable<Int>)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
class PromptPrefix
Link copied to clipboard
Link copied to clipboard
class QuantizedEmbedding(vocabularySize: Int, embeddingDim: Int, val quantization: Quantization) : TokenEmbedding
Link copied to clipboard
Link copied to clipboard
class QuantizedTensor
Link copied to clipboard
class RoPEScaling(val factor: Float, val lowFrequencyFactor: Float = 1.0f, val highFrequencyFactor: Float = 4.0f, val originalMaxPositionEmbeddings: Int = 8192)
Link copied to clipboard
object SafeTensors
Link copied to clipboard
class SafeTensorsEntry(val name: String, val dtype: String, val shape: IntArray, val bytes: ByteArray)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
class Transformer(val vocabularySize: Int, val dimension: Int, val numLayers: Int, val numHeads: Int, val hiddenDimension: Int = 4 * dimension, val numKeyValueHeads: Int = numHeads, val normEps: Float = 1.0E-6f, val ropeTheta: Float = 10000.0f, val ropeScaling: RoPEScaling? = null, quantization: Quantization? = null) : Module
Link copied to clipboard
class TransformerBlock(val dimension: Int, val numHeads: Int, val hiddenDimension: Int = 4 * dimension, val numKeyValueHeads: Int = numHeads, val normEps: Float = 1.0E-6f, val ropeTheta: Float = 10000.0f, ropeScaling: RoPEScaling? = null, quantization: Quantization? = null) : Module
Functions
Link copied to clipboard
Link copied to clipboard
fun fusedCrossEntropyLoss(hidden: Tensor, head: Projection, targets: Tensor, ignoreIndex: Int = IGNORE_INDEX): Tensor
fun fusedCrossEntropyLoss(hidden: Tensor, head: Projection, targets: IntArray, ignoreIndex: Int = IGNORE_INDEX): Tensor
Link copied to clipboard