eleutherai / dalle-mtf Goto Github PK
View Code? Open in Web Editor NEWOpen-AI's DALL-E for large scale training in mesh-tensorflow.
Home Page: https://www.eleuther.ai/
License: MIT License
Open-AI's DALL-E for large scale training in mesh-tensorflow.
Home Page: https://www.eleuther.ai/
License: MIT License
You can pretty much copy the following code with appropriate modifications. To be more specific, the following is important ingredients:
blocks()
, consisting of a certain number of Res blocks.block()
(no modification preferred)blocks()
and up/down-sampler()
matters.def block(self, x, dim, name=None):
with tf.variable_scope(name):
hidden_dim = dim // 4
res = x
x = self.activation(x, name="activ1")
x = self.conv2d(x, hidden_dim, (1, 1), (1, 1), padding="SAME", name="conv1",
variable_dtype=self.variable_dtype)
x = self.activation(x, name="activ2")
x = self.conv2d(x, hidden_dim, (3, 3), (1, 1), padding="SAME", name="conv2",
variable_dtype=self.variable_dtype)
x = self.activation(x, name="activ3")
x = self.conv2d(x, dim, (1, 1), (1, 1), padding="SAME", name="conv3",
variable_dtype=self.variable_dtype)
x += res
return x
def blocks(self, x, dim, num_blocks, name=None):
with tf.variable_scope(name):
for idx in range(num_blocks):
x = block(x, dim, name="block"+str(idx))
def decoder(self, num_res, num_blocks):
with tf.variable_scope("decoder"):
dim = tf.shape(x)[1] # dim = c
# num_res is the number of resolutions. e.g. if 32 -> 64 -> 128 -> 256, then = 4
for idx in range(num_res):
x = self.blocks(x, dim//(2 ** idx), num_blocks, name='blocks'+str(idx))
if idx != num_res - 1: # not the last layer
x = upsample(x) # nearest neighbor interpolation upsampling by the factor of 2
x = self.conv2d(x, self.channels_dim, (1, 1), (1, 1), variable_dtype=self.variable_dtype)
return x
def encoder(self, x, num_res, dim, num_blocks):
with tf.variable_scope("encoder"):
# dim is the embedding dimension of the first layer of encoder
x = self.conv2d(x, dim, (3, 3), (1, 1), padding="SAME", name="conv_in",
variable_dtype=self.variable_dtype)
dim = tf.shape(x)[1] # dim = c
for idx in range(num_res):
x = self.blocks(x, dim * (2 ** idx), num_blocks, name='blocks'+str(idx))
if idx != num_res - 1: # not the last layer
x = downsample(x) # average pooling with stride = 2
return x
I got error when run the command:
python3 src/data/create_tfrecords.py
Error:
Downloading: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.04M/1.04M [00:00<00:00, 6.36MB/s] Downloading: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 456k/456k [00:00<00:00, 3.31MB/s] Downloading: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.36M/1.36M [00:00<00:00, 7.19MB/s] 0it [00:00, ?it/s]Traceback (most recent call last): File "src/data/create_tfrecords.py", line 184, in <module> tokenizer=None) File "src/data/create_tfrecords.py", line 158, in create_paired_dataset data = load_jsonl(path) File "src/data/create_tfrecords.py", line 32, in load_jsonl with open(input_path, 'r', encoding='utf-8') as f: FileNotFoundError: [Errno 2] No such file or directory: '/home/data/coco/coco_captions.jsonl' 0it [00:00, ?it/s]
The COCO dataset is a high-quality dataset both in terms of images and text. Each image has multiple captions and it consists of around 100 000 images. I have created a Google Colab which does the following:
od-captions.txt (<image_path> : <image_caption>)
train2017/000000203564.jpg : A bicycle replica with a clock as the front wheel.
train2017/000000322141.jpg : A room with blue walls and a white sink and door.
train2017/00000016977.jpg : A car that seems to be parked illegally behind a legally parked car
train2017/000000106140.jpg : A large passenger airplane flying through the air.
train2017/000000571635.jpg : A bathroom with a toilet, sink, and shower.
od-captionsonly.txt (<image_caption>)
A bicycle replica with a clock as the front wheel.
A room with blue walls and a white sink and door.
A car that seems to be parked illegally behind a legally parked car
A large passenger airplane flying through the air.
A bathroom with a toilet, sink, and shower.
Here is an example image and caption:
The man at bat readies to swing at the pitch while the umpire looks on.
I have written this hoping it will be somewhat compatible with @htoyryla's fork of a similar project. Might be of interest to you. Feel free to use this to generate a dataset for DALL-E!
lucidrains/DALLE-pytorch#10 (comment)
"wow! temperature feature is awesome! Gradually decreasing it from 5 to 0.05 over 5 epochs and convergence is really fast as well as results look much better!!!"
The image generation takes a good amount of time because of the training.
When the pretrained models are released, how big is the size of the pretrained model, and how long will image generation take then? And how much computing power?
And around what time to you plan to release pretrained models?
Best regards
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.