Views
No views yet
clip_l: [batch, 77, 768] → text_encoder outputclip_g: [batch, 77, 1280] → text_encoder_2 output1from geovocab2.train.model.vae.vae_lyra import MultiModalVAE, MultiModalVAEConfig
2from huggingface_hub import hf_hub_download
3import torch
4
5# Download model
6model_path = hf_hub_download(
7 repo_id="AbstractPhil/vae-lyra-xl-adaptive-cantor",
8 filename="model.pt"
9)
10
11# Load checkpoint
12checkpoint = torch.load(model_path)
13
14# Create model
15config = MultiModalVAEConfig(
16 modality_dims={
17 "clip_l": 768,
18 "clip_g": 1280,
19 "t5_xl_l": 2048,
20 "t5_xl_g": 2048
21 },
22 modality_seq_lens={
23 "clip_l": 77,
24 "clip_g": 77,
25 "t5_xl_l": 512,
26 "t5_xl_g": 512
27 },
28 binding_config={
29 "clip_l": {"t5_xl_l": 0.3},
30 "clip_g": {"t5_xl_g": 0.3},
31 "t5_xl_l": {},
32 "t5_xl_g": {}
33 },
34 latent_dim=2048,
35 fusion_strategy="adaptive_cantor",
36 cantor_depth=8,
37 cantor_local_window=3
38)
39
40model = MultiModalVAE(config)
41model.load_state_dict(checkpoint['model_state_dict'])
42model.eval()
43
44# Use model - train on all four modalities
45inputs = {
46 "clip_l": clip_l_embeddings, # [batch, 77, 768]
47 "clip_g": clip_g_embeddings, # [batch, 77, 1280]
48 "t5_xl_l": t5_xl_l_embeddings, # [batch, 512, 2048]
49 "t5_xl_g": t5_xl_g_embeddings # [batch, 512, 2048]
50}
51
52# For SDXL inference - only decode CLIP outputs
53recons, mu, logvar, per_mod_mus = model(inputs, target_modalities=["clip_l", "clip_g"])
54
55# Use recons["clip_l"] and recons["clip_g"] with SDXL1@software{vae_lyra_adaptive_cantor_2025,
2 author = {AbstractPhil},
3 title = {VAE Lyra: Adaptive Cantor Multi-Modal Variational Autoencoder},
4 year = {2025},
5 url = {https://huggingface.co/AbstractPhil/vae-lyra-xl-adaptive-cantor}
6}