class Llama::TransformerFile

Defined in:

llama/transformer_file.cr

Constant Summary

AFTER_DESERIALIZE = [] of Nil
BEFORE_SERIALIZE = [] of Nil
ENDIAN = ["system"]
KLASS_NAME = [Llama::TransformerFile]
PARTS = [{type: "basic", name: config, cls: TransformerConfig, onlyif: nil, verify: nil, value: nil}, {type: "array", name: token_embedding_table, cls: Float32, onlyif: nil, verify: nil, length: -> do config.vocab_size * config.dim end, value: nil}, {type: "array", name: rms_att_weight, cls: Float32, onlyif: nil, verify: nil, length: -> do config.n_layers * config.dim end, value: nil}, {type: "array", name: wq, cls: Float32, onlyif: nil, verify: nil, length: -> do (config.n_layers * config.dim) * (config.n_heads * (config.dim / config.n_heads)) end, value: nil}, {type: "array", name: wk, cls: Float32, onlyif: nil, verify: nil, length: -> do (config.n_layers * config.dim) * (config.n_kv_heads * (config.dim / config.n_heads)) end, value: nil}, {type: "array", name: wv, cls: Float32, onlyif: nil, verify: nil, length: -> do (config.n_layers * config.dim) * (config.n_kv_heads * (config.dim / config.n_heads)) end, value: nil}, {type: "array", name: wo, cls: Float32, onlyif: nil, verify: nil, length: -> do (config.n_layers * config.dim) * (config.n_heads * (config.dim / config.n_heads)) end, value: nil}, {type: "array", name: rms_ffn_weight, cls: Float32, onlyif: nil, verify: nil, length: -> do config.n_layers * config.dim end, value: nil}, {type: "array", name: w1, cls: Float32, onlyif: nil, verify: nil, length: -> do (config.n_layers * config.dim) * config.hidden_dim end, value: nil}, {type: "array", name: w2, cls: Float32, onlyif: nil, verify: nil, length: -> do (config.n_layers * config.dim) * config.hidden_dim end, value: nil}, {type: "array", name: w3, cls: Float32, onlyif: nil, verify: nil, length: -> do (config.n_layers * config.dim) * config.hidden_dim end, value: nil}, {type: "array", name: rms_final_weight, cls: Float32, onlyif: nil, verify: nil, length: -> do config.dim + (2 * ((config.seq_len * (config.dim / config.n_heads)) / 2)) end, value: nil}] of Nil
REMAINING = [{type: "bytes", name: wcls, onlyif: nil, verify: nil}] of Nil

Class Method Summary

Macro Summary

Instance Method Summary

Class Method Detail

def self.bit_fields #

[View source]

Macro Detail

macro llama_transformer_config(name, onlyif = nil, verify = nil, value = nil) #

[View source]
macro llama_transformer_file(name, onlyif = nil, verify = nil, value = nil) #

[View source]

Instance Method Detail

def config : TransformerConfig #

def config=(config : TransformerConfig) #

def rms_att_weight : Array(Float32) #

def rms_att_weight=(rms_att_weight : Array(Float32)) #

def rms_ffn_weight : Array(Float32) #

def rms_ffn_weight=(rms_ffn_weight : Array(Float32)) #

def rms_final_weight : Array(Float32) #

def rms_final_weight=(rms_final_weight : Array(Float32)) #

def token_embedding_table : Array(Float32) #

def token_embedding_table=(token_embedding_table : Array(Float32)) #

def w1 : Array(Float32) #

def w1=(w1 : Array(Float32)) #

def w2 : Array(Float32) #

def w2=(w2 : Array(Float32)) #

def w3 : Array(Float32) #

def w3=(w3 : Array(Float32)) #

def wcls : Bytes #

def wcls=(wcls : Bytes) #

def wk : Array(Float32) #

def wk=(wk : Array(Float32)) #

def wo : Array(Float32) #

def wo=(wo : Array(Float32)) #

def wq : Array(Float32) #

def wq=(wq : Array(Float32)) #

def wv : Array(Float32) #

def wv=(wv : Array(Float32)) #