CoolFace
Modelpublic

arzumanabbasov/DCGAN_CELEBA_50_EPOCH

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes11downloads
Model Card

DCGAN — Human Face Generation (CelebA)

A Deep Convolutional GAN trained on CelebA to generate 64×64 human face images.

Config

PropertyValue
ArchitectureDCGAN (Radford et al., 2015)
DatasetCelebA — train split (162,770 images)
Resolution64×64 RGB
Latent dim100
Epochs50
Batch size256
OptimizerAdam lr=0.0002 β₁=0.5
Mixed precisiontorch.bfloat16

Usage

python
import torch, torch.nn as nn
from huggingface_hub import hf_hub_download

class Generator(nn.Module):
    def __init__(self, nz=100, ngf=64, nc=3):
        super().__init__()
        self.main = nn.Sequential(
            nn.ConvTranspose2d(nz,    ngf*8, 4, 1, 0, bias=False), nn.BatchNorm2d(ngf*8), nn.ReLU(True),
            nn.ConvTranspose2d(ngf*8, ngf*4, 4, 2, 1, bias=False), nn.BatchNorm2d(ngf*4), nn.ReLU(True),
            nn.ConvTranspose2d(ngf*4, ngf*2, 4, 2, 1, bias=False), nn.BatchNorm2d(ngf*2), nn.ReLU(True),
            nn.ConvTranspose2d(ngf*2, ngf,   4, 2, 1, bias=False), nn.BatchNorm2d(ngf),   nn.ReLU(True),
            nn.ConvTranspose2d(ngf,   nc,    4, 2, 1, bias=False), nn.Tanh()
        )
    def forward(self, x): return self.main(x)

weights = hf_hub_download(repo_id="arzumanabbasov/DCGAN_CELEBA_50_EPOCH", filename="generator.pt")
netG = Generator()
netG.load_state_dict(torch.load(weights, map_location="cpu"))
netG.eval()

with torch.no_grad():
    noise = torch.randn(16, 100, 1, 1)
    faces = netG(noise)       # (16, 3, 64, 64) in [-1, 1]
    faces = (faces + 1) / 2  # → [0, 1] for display