llama-cpp-hs
Copyright(c) 2025 Tushar Adhatrao
LicenseMIT
MaintainerTushar Adhatrao <[email protected]>
Safe HaskellNone
LanguageHaskell2010

Llama.Model

Description

 
Synopsis

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

getModelVocab :: Model -> IO (Either String Vocab) Source #

Get the vocabulary from a model

getContextModel :: Context -> IO Model Source #

Get the model associated with a context.

getVocabType :: Vocab -> IO (Maybe LlamaVocabType) Source #

Get the vocabulary type.

getModelRoPEFreqScale :: Model -> IO Float Source #

Get RoPE frequency scaling factor used during training.

getModelNumKVHeads :: Model -> IO Int Source #

Get the number of key/value heads in the model.

getModelNumHeads :: Model -> IO Int Source #

Get the number of attention heads in the model.

getModelNumLayers :: Model -> IO Int Source #

Get the number of transformer layers in the model.

getModelEmbeddingDim :: Model -> IO Int Source #

Get the embedding dimension of the model.

getModelTrainingContextSize :: Model -> IO Int Source #

Get the training context size of the model.

getModelSize :: Model -> IO Int64 Source #

Get the size of the model in bytes

getModelChatTemplate :: Model -> Maybe String -> IO (Either String String) Source #

Get the chat template from a model, optionally by name

getModelHasEncoder :: Model -> IO Bool Source #

Check if the model has an encoder

getModelNumParams :: Model -> IO (Either String Int64) Source #

Get the number of parameters in the model

getModelHasDecoder :: Model -> IO Bool Source #

Check if the model has a decoder

getModelDecoderStartToken :: Model -> IO (Either String LlamaToken) Source #

Get the decoder start token from the model

getModelIsRecurrent :: Model -> IO Bool Source #

Check if the model is recurrent

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

getModelMetaCount :: Model -> IO Int Source #

Get the number of metadata entries in a model

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

getModelDescription :: Model -> IO String Source #

Get a model description

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