Views
No views yet
1import torch
2from models_mae import mae_for_ldmae_f8d16_prev
3
4# Load model
5model = mae_for_ldmae_f8d16_prev(
6 ldmae_mode=True,
7 no_cls=True,
8 kl_loss_weight=True,
9 smooth_output=True,
10 img_size=256
11)
12
13# Load checkpoint
14checkpoint = torch.load('pytorch_model.bin', map_location='cpu')
15model.load_state_dict(checkpoint['model'], strict=False)
16model.eval()
17
18# Encode images
19with torch.no_grad():
20 latents = model.encode(images).latent_dist.mode()
21
22# Decode latents
23with torch.no_grad():
24 reconstructed = model.decode(latents).sample1augmentation:
2 color_jitter: 0.4
3 random_crop: true
4 random_flip: true
5data:
6 batch_size: 32
7 data_path: /data/dataset/imagenet/1K_dataset
8 image_size: 256
9 num_workers: 8
10evaluation:
11 metrics:
12 - rfid
13 - psnr
14 - lpips
15 - ssim
16loss:
17 kl_weight: 1.0e-06
18 lpips_weight: 0.1
19 reconstruction_weight: 1.0
20model_info:
21 compression_ratio: 8
22 description: VMAE with 8x spatial compression and 16-dimensional latent space
23 latent_channels: 16
24 optimization: LPIPS-tuned for perceptual quality
25 training_dataset: ImageNet 256x256
26training:
27 epochs: 400
28 learning_rate: 0.00015
29 min_lr: 0.0
30 warmup_epochs: 40
31 weight_decay: 0.05
32vae:
33 architecture: mae_for_ldmae_f8d16_prev
34 model_name: vmae_f8d16
35 params:
36 decoder_depth: 8
37 decoder_embed_dim: 512
38 decoder_num_heads: 16
39 depth: 24
40 embed_dim: 512
41 img_size: 256
42 in_channels: 3
43 kl_loss_weight: true
44 latent_dim: 16
45 ldmae_mode: true
46 mlp_ratio: 4.0
47 no_cls: true
48 norm_layer: LayerNorm
49 num_heads: 16
50 patch_size: 8
51 smooth_output: true
52 weight_path: pretrain_weight/vmaef8d16.pth
531@article{ldmae2025,
2 title={LDMAE: Latent Diffusion with Masked AutoEncoder},
3 author={Your Name},
4 year={2025}
5}