Comments (5)
you can try 'amp = True'
from denoising-diffusion-pytorch.
you can try 'amp = True'
thanks but i tried and found that the images turns out total green
from denoising-diffusion-pytorch.
I am also currently trying to get some reasonable results for the FFHQ dataset, and also want to try Celeba-HQ.
from denoising_diffusion_pytorch import Unet, GaussianDiffusion, Trainer
from torch.utils.data import DataLoader
from torchvision.datasets import VisionDataset
from torchvision.transforms.functional import pil_to_tensor
from PIL import Image
class FFHQDataset(VisionDataset):
def __init__(self, root: str):
super().__init__(root)
self.fpaths = sorted(glob(root + '/**/*.png', recursive=True))
assert len(self.fpaths) > 0, "File list is empty. Check the root."
def __len__(self):
return len(self.fpaths)
def __getitem__(self, index: int):
fpath = self.fpaths[index]
img = Image.open(fpath).convert('RGB')
# normalize to [0, 1] range
img = pil_to_tensor(img) / 255.
return img
model = Unet(
dim = 64,
dim_mults = (1, 2, 4, 8, 16, 32),
flash_attn = True
)
diffusion = GaussianDiffusion(
model,
image_size = 128,
timesteps = 1000, # number of steps
sampling_timesteps=500
)
dataset = FFHQDataset(root="/mnt/SSD2/nils/ocean_bench_exps/diffusion/data/ffhq/thumbnails128x128")
dataloader = DataLoader(dataset, batch_size = 32, shuffle = True, pin_memory = True, num_workers = 12)
trainer = Trainer(
diffusion,
'path/to/your/images',
train_lr = 8e-5,
train_num_steps = 50000, # total training steps
gradient_accumulate_every = 2, # gradient accumulation steps
ema_decay = 0.995, # exponential moving average decay
amp = False,
num_samples=16,
save_and_sample_every=10000,
dl = dataloader,
)
trainer.train()
I gave the trainer a dataloader argument, because I wanted control over different dataloaders and their configurations, so effectively, just replaced the dataset and dl code block to just take the dl argument from the Trainer. The following are some samples, loss is around 0.02-0.03.
It was mentioned here that amp=False
helps, but I have tried both and there is no significant change.
Overall I would also expect better results, so I am wondering if people have experience and suggestions?
Edit:
Training for longer seems to improve results a bit (300,000 training steps)
from denoising-diffusion-pytorch.
These are results on the CelebHQ datset:
from denoising-diffusion-pytorch.
you can try 'amp = True'
thanks but i tried and found that the images turns out total green
Have you solved this problem? I meet this problem recently.
from denoising-diffusion-pytorch.
Related Issues (20)
- RePaint Improvements HOT 1
- Bug in RePaint implementation: p_sample input args and resample loop HOT 1
- A question related to batch size and training speed HOT 2
- The ./results folder is empty
- training on CIFAR-10 performs not well, whether L2 loss or FID
- denoising_diffusion_pytorch.py doesn't use eval mode for testing HOT 4
- Enable flash attention for compute capability >= 8.0, not == 8.0 HOT 6
- bug of UNet final step dim HOT 1
- Sanity Check - Looking for a basic CIFAR10 hyperparameter set HOT 6
- sampling loop time step HOT 2
- RMSNorm Implementation Question HOT 1
- How to do image conditioning
- Feature Request: ResSHIFT HOT 3
- KarrasUnet1D fails in the decoder for some sequence length/num. channel combinations HOT 2
- how to load the pretrained model of this code? HOT 1
- How can I choose my preferred GPU? HOT 1
- How to do inpainting? HOT 1
- deprecated issues
- metric to guide Trainer1D sequence denoising
- Hello, I would like to ask about the use of monitoring station data sets in the paper HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from denoising-diffusion-pytorch.