def load_model
import bend-ml-llama@0.2.0.0/main.bend as BendMlLlamaimport Base
import bend-ml-tensor-array@0.1.14.0/main.bend as TA
1283# the whole model; the embedding gets one more level of bands than the layers (2^5 with 16 threads)
1284def load_model(+c: Cfg, +dir: String) -> IO(Model<c>):
1285 do IO<Model<c>>:
1286 threads : U32 <- IO.thread_count()
1287 +d : Nat = depth_for(threads)
1288 emb : TA.Bands<Cfg.vocab(c), Cfg.dim(c)> <- get_bands(dir, "emb", Nat.add(d, Nat.min(d, 1n)), Cfg.vocab(c), Cfg.dim(c))
1289 ls : List<&1, LW<c>> <- load_layers(Cfg.layers(c), c, dir, d, 0n, Nil{})
1290 lnf : List<&2, F32> <- get_list(dir, "lnf", Cfg.dim(c))
1291 return Model{d, emb, ls, lnf}
Uses (22)
Used by (0)
No other definition uses this definition.