Downloads · 30 days
0
hussamalafandi/DCGAN_CelebA
DCGAN_CelebA is a machine learning model from hussamalafandi. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
This is a Deep Convolutional Generative Adversarial Network (DCGAN) trained on the CelebA dataset to generate realistic 64x64 RGB images of human faces. The model was developed as part of the Generative AI course.
Downloads · 30 days
0
Access
Public
Updated Mar 27, 2025
Repo size
51 MB
Likes
1
Public
Click a slice to open those files.
.pth25.4 MB · 99%
From the Hugging Face model README
This is a Deep Convolutional Generative Adversarial Network (DCGAN) trained on the CelebA dataset to generate realistic 64x64 RGB images of human faces. The model was developed as part of the Generative AI course.
The training process was tracked using Weights and Biases. You can view the full training logs and metrics here.
To load the trained model, use the following code snippet:
import torch
from dcgan import Generator
# Load the configuration
config = {
"latent_dim": 100,
"ngf": 64,
"nc": 3
}
# Initialize the generator
generator = Generator(config)
# Load the trained weights
model_path = "./dcgan_celeba.pth"
generator.load_state_dict(torch.load(checkpoint_path, map_location=torch.device('cuda' if torch.cuda.is_available() else 'cpu')))
# Set the model to evaluation mode
generator.eval()
# Example: Generate an image
latent_vector = torch.randn(1, config["latent_dim"], 1, 1) # Batch size of 1
if torch.cuda.is_available():
latent_vector = latent_vector.cuda()
generator = generator.cuda()
generated_image = generator(latent_vector)
