Copyright | (c) 2025 Tushar Adhatrao |
---|---|
License | MIT |
Maintainer | Tushar Adhatrao <[email protected]> |
Safe Haskell | None |
Language | Haskell2010 |
Llama.Model
Description
Synopsis
- defaultModelParams :: IO LlamaModelParams
- loadModelFromFile :: FilePath -> LlamaModelParams -> IO (Either String Model)
- initContextFromModel :: Model -> LlamaContextParams -> IO (Either String Context)
- getModelVocab :: Model -> IO (Either String Vocab)
- getContextModel :: Context -> IO Model
- getVocabType :: Vocab -> IO (Maybe LlamaVocabType)
- getModelRoPEFreqScale :: Model -> IO Float
- getModelNumKVHeads :: Model -> IO Int
- getModelNumHeads :: Model -> IO Int
- getModelNumLayers :: Model -> IO Int
- getModelEmbeddingDim :: Model -> IO Int
- getModelTrainingContextSize :: Model -> IO Int
- getModelSize :: Model -> IO Int64
- getModelChatTemplate :: Model -> Maybe String -> IO (Either String String)
- getModelHasEncoder :: Model -> IO Bool
- getModelNumParams :: Model -> IO (Either String Int64)
- getModelHasDecoder :: Model -> IO Bool
- getModelDecoderStartToken :: Model -> IO (Either String LlamaToken)
- getModelIsRecurrent :: Model -> IO Bool
- quantizeModel :: FilePath -> FilePath -> LlamaModelQuantizeParams -> IO (Either String Word32)
- quantizeModelDefault :: FilePath -> FilePath -> IO (Either String Word32)
- defaultQuantizeParams :: IO LlamaModelQuantizeParams
- getModelMetaCount :: Model -> IO Int
- getModelMetaValue :: Model -> String -> IO (Either String String)
- getModelMetaKeyByIndex :: Model -> Int -> IO (Either String String)
- getModelMetaValueByIndex :: Model -> Int -> IO (Either String String)
- getModelDescription :: Model -> IO String
- loadModelFromSplits :: [FilePath] -> LlamaModelParams -> IO (Either String Model)
- getModelRopeType :: Model -> IO (Maybe LlamaRopeTypeScaling)
Documentation
defaultModelParams :: IO LlamaModelParams Source #
Default model parameters
loadModelFromFile :: FilePath -> LlamaModelParams -> IO (Either String Model) Source #
Load a model from a file using the specified parameters
initContextFromModel :: Model -> LlamaContextParams -> IO (Either String Context) Source #
Create a context from a model using the specified parameters
getVocabType :: Vocab -> IO (Maybe LlamaVocabType) Source #
Get the vocabulary type.
getModelRoPEFreqScale :: Model -> IO Float Source #
Get RoPE frequency scaling factor used during training.
getModelChatTemplate :: Model -> Maybe String -> IO (Either String String) Source #
Get the chat template from a model, optionally by name
getModelNumParams :: Model -> IO (Either String Int64) Source #
Get the number of parameters in the model
getModelDecoderStartToken :: Model -> IO (Either String LlamaToken) Source #
Get the decoder start token from the model
quantizeModel :: FilePath -> FilePath -> LlamaModelQuantizeParams -> IO (Either String Word32) Source #
Quantize a model from a file to another file using specified parameters
quantizeModelDefault :: FilePath -> FilePath -> IO (Either String Word32) Source #
Quantize a model from a file to another file using default parameters
defaultQuantizeParams :: IO LlamaModelQuantizeParams Source #
Get the default quantization parameters
getModelMetaValue :: Model -> String -> IO (Either String String) Source #
Get a metadata value as a string from a model
getModelMetaKeyByIndex :: Model -> Int -> IO (Either String String) Source #
Get a metadata key by index from a model
getModelMetaValueByIndex :: Model -> Int -> IO (Either String String) Source #
Get a metadata value by index from a model
loadModelFromSplits :: [FilePath] -> LlamaModelParams -> IO (Either String Model) Source #
Load a model from multiple file paths using specified parameters
getModelRopeType :: Model -> IO (Maybe LlamaRopeTypeScaling) Source #
Get the RoPE type from a model