The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.
VAE-Encoded Dog Images for Fast Diffusion Training This dataset contains pre-encoded image latents produced using a Variational Autoencoder (VAE), optimized for training text-to-image diffusion models efficiently.
🚀 Why Use This? Skip the raw image loading and VAE encoding steps.
Plug the latents directly into your diffusion pipeline.
Significantly reduce training time and GPU load.
🐶 Source These latents were generated from the Dogs-images-text-pair dataset, which includes captioned images of dogs.
📦 Contents Latents are stored in .npy or .npmm format
Each latent represents a (4, 32, 32) compressed feature map
✅ Ready-to-Use No need to preprocess or re-encode—just load the array and start training!
from huggingface_hub import hf_hub_download
from diffusers.models import AutoencoderKL
import numpy as np
import torch
import matplotlib.pyplot as plt
import os
# 🔽 Step 1: Download the latents file
repo_id = "MikdadMrhij/vae-latents" # Change this if you named it differently
filename = "vae_latents.npmm"
local_path = hf_hub_download(repo_id=repo_id, filename=filename, repo_type="dataset")
# 🧠 Step 2: Load as NumPy memmap (adjust shape if needed)
latents = np.memmap(local_path, dtype=np.float32, mode="r", shape=(75969, 4, 32, 32))
# 🔁 Step 3: Select 5 random latents to decode
sample = torch.tensor(latents[1005:1010]).to("cuda") # pick any range or random samples
# 🧬 Step 4: Load the VAE decoder
vae = AutoencoderKL.from_pretrained("stabilityai/sd-vae-ft-ema").cuda().eval()
# 🎨 Step 5: Decode to images
with torch.no_grad():
images = vae.decode(sample).sample
images = (images.clamp(-1, 1) + 1) / 2 # rescale to [0, 1]
images = images.cpu().permute(0, 2, 3, 1).numpy()
# 🖼️ Step 6: Plot the decoded images
plt.figure(figsize=(12, 3))
for i in range(len(images)):
plt.subplot(1, len(images), i + 1)
plt.imshow(images[i])
plt.axis("off")
plt.suptitle("Decoded Images from VAE Latents")
plt.show()
- Downloads last month
- 19