class Llama::TransformerFile
- Llama::TransformerFile
- BinData
- Reference
- Object
Defined in:
llama/transformer_file.crConstant 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
- llama_transformer_config(name, onlyif = nil, verify = nil, value = nil)
- llama_transformer_file(name, onlyif = nil, verify = nil, value = nil)
Instance Method Summary
- #config : TransformerConfig
- #config=(config : TransformerConfig)
- #rms_att_weight : Array(Float32)
- #rms_att_weight=(rms_att_weight : Array(Float32))
- #rms_ffn_weight : Array(Float32)
- #rms_ffn_weight=(rms_ffn_weight : Array(Float32))
- #rms_final_weight : Array(Float32)
- #rms_final_weight=(rms_final_weight : Array(Float32))
- #token_embedding_table : Array(Float32)
- #token_embedding_table=(token_embedding_table : Array(Float32))
- #w1 : Array(Float32)
- #w1=(w1 : Array(Float32))
- #w2 : Array(Float32)
- #w2=(w2 : Array(Float32))
- #w3 : Array(Float32)
- #w3=(w3 : Array(Float32))
- #wcls : Bytes
- #wcls=(wcls : Bytes)
- #wk : Array(Float32)
- #wk=(wk : Array(Float32))
- #wo : Array(Float32)
- #wo=(wo : Array(Float32))
- #wq : Array(Float32)
- #wq=(wq : Array(Float32))
- #wv : Array(Float32)
- #wv=(wv : Array(Float32))