Coder Social home page Coder Social logo

mbrukman / paella Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dome272/paella

0.0 1.0 0.0 8.47 MB

Official Implementation of Paella https://arxiv.org/abs/2211.07292v1

License: MIT License

Shell 0.03% Python 1.27% Jupyter Notebook 98.69%

paella's Introduction

Open In Colab Huggingface Space

Paella

Conditional text-to-image generation has seen countless recent improvements in terms of quality, diversity and fidelity. Nevertheless, most state-of-the-art models require numerous inference steps to produce faithful generations, resulting in performance bottlenecks for end-user applications. In this paper we introduce Paella, a novel text-to-image model requiring less than 10 steps to sample high-fidelity images, using a speed-optimized architecture allowing to sample a single image in less than 500 ms, while having 573M parameters. The model operates on a compressed & quantized latent space, it is conditioned on CLIP embeddings and uses an improved sampling function over previous works. Aside from text-conditional image generation, our model is able to do latent space interpolation and image manipulations such as inpainting, outpainting, and structural editing.

cover-figure

Please find all details about the model and how it was trained in our preprint paper on arxiv.


Code

We especially want to highlight the minimalistic amount of code that is necessary to run & train Paella. The entire code including training, sampling, architecture and utilities can fit in approx. 400 lines of code. We hope to make this method more accessible to more people this way. In order to just understand the basic logic you can take a look at paella_minimal.py.

Sampling

Open In Colab

For sampling you can just take a look at the sampling.ipynb notebook. ๐Ÿ˜Ž

Train your own Paella

The main file for training will be paella.py. You can adjust all hyperparameters to your own needs. During training we use webdataset, but you are free to replace that with your own custom dataloader. Just change the line on 119 in paella.py to point to your own dataloader. Make sure it returns a tuple of (images, captions) where images is a torch.Tensor of shape batch_size x channels x height x width and captions is a List of length batch_size. Now decide if you want to finetune Paella or start a new training from scratch:

From Scratch

python3 paella.py

Finetune

If you want to finetune you first need to download the latest checkpoint and it's optimizer state, set the finetune hyperparameter to True and create a folder models/<RUN_NAME> and move both checkpoints to this folder. After that you can also just run:

python3 paella.py

License

The model code and weights are released under the MIT license.

paella's People

Contributors

dome272 avatar maubreville avatar backnotprop avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.