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

Method load

cake-core/src/models/sd/clip.rs:26–61  ·  view source on GitHub ↗
(name: String, ctx: &Context)

Source from the content-addressed store, hash-verified

24#[async_trait]
25impl Forwarder for Clip {
26 fn load(name: String, ctx: &Context) -> anyhow::Result<Box<Self>>
27 where
28 Self: Sized,
29 {
30 let model_file;
31 let model_filename;
32 let sd_config = get_sd_config(ctx)?;
33 let clip_config;
34
35 match name.as_str() {
36 "clip" => {
37 model_file = ModelFile::Clip;
38 model_filename = ctx.args.sd_args.clip.clone();
39 clip_config = sd_config.clip;
40 }
41 "clip2" => {
42 model_file = ModelFile::Clip2;
43 model_filename = ctx.args.sd_args.clip2.clone();
44 clip_config = sd_config.clip2.unwrap();
45 }
46 _ => {
47 anyhow::bail!("name not recognized");
48 }
49 };
50
51 Self::load_model(
52 model_file,
53 model_filename,
54 ctx.args.sd_args.sd_version,
55 ctx.args.sd_args.use_f16,
56 &ctx.device,
57 ctx.dtype,
58 ctx.args.model.clone(),
59 &clip_config,
60 )
61 }
62
63 async fn forward(
64 &self,

Callers

nothing calls this directly

Calls 2

get_sd_configFunction · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected