MCPcopy Create free account
hub / github.com/evilsocket/cake / make_context

Function make_context

cake-core/tests/unit_tests/test_blocks.rs:24–42  ·  view source on GitHub ↗
(cfg: Config, vb: VarBuilder<'static>)

Source from the content-addressed store, hash-verified

22// ---------------------------------------------------------------------------
23
24fn make_context(cfg: Config, vb: VarBuilder<'static>) -> Context {
25 let cache = Cache::new(true, DType::F32, &cfg, &Device::Cpu).unwrap();
26 Context {
27 args: Args::default(),
28 dtype: DType::F32,
29 topology: Topology::new(),
30 data_path: PathBuf::from("."),
31 device: Device::Cpu,
32 config: Some(cfg),
33 cache: Some(cache),
34 var_builder: Some(vb),
35 text_model_arch: TextModelArch::Auto,
36 quant: Arc::new(cake_core::utils::NoQuantization),
37 listener_override: Arc::new(Mutex::new(None)),
38 tensor_storage: None,
39 layer_devices: None,
40 backend: Arc::new(cake_core::backends::CpuBackend::new()),
41 }
42}
43
44// ---------------------------------------------------------------------------
45// Helper: build VarBuilder for a standard block (attn + mlp + norms)

Calls

no outgoing calls

Tested by

no test coverage detected