Giter VIP home page Giter VIP logo

saharmor / dalle-playground Goto Github PK

View Code? Open in Web Editor NEW
2.8K 31.0 597.0 3.08 MB

A playground to generate images from any text prompt using Stable Diffusion (past: using DALL-E Mini)

License: MIT License

Python 10.38% Jupyter Notebook 12.10% HTML 5.27% CSS 1.57% JavaScript 68.41% Dockerfile 2.27%
dall-e openai gan text-to-image transformers artificial artificial-intelligence machine-learning dalle dalle-mini

dalle-playground's People

Contributors

cylol2019 avatar kamalkraj avatar katlyn avatar randyau avatar saharmor avatar thegoddessinari avatar vexharbinger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dalle-playground's Issues

Unable to get app.py to run (module not found error)?

I've been trying to run this via local development and, when running the "dalle_playground_backend" notebook, I haven't been able to get app.py to run backend URL output. I'm wondering if this is connected to an error ModuleNotFoundError: No module named 'jaxlib' or ModuleNotFoundError: No module named 'flask' when I try to run python app.py 8080 or python app.py 3000 in the terminal. Is there a step I'm missing? Thanks!

Backend hangs after generating a few pictures (Mega)

I'm on Windows using Docker (WSL2).

My system has 32GB Ram and a RTX 3060 with 12 GB (V)RAM.

Setting up the docker works fine, and I am able to generate a few pictures with "Mega" (not "Mega_full"). Memory usage does not exceed the numbers given above. I only generate one at a time for testing purposes.

However, after some pictures, the container/backend app just hangs indefinitely. I can still get into it using Docker and run commands, so it's not completely frozen. I can actually still ping the Flask server and get a response. It's just the /dalle route that never returns anything, nor does the GPU utilisation spike anymore (it does that while generating). It's like the model has gone "dormant"

When I try to stop the container, Docker just gives me an error code (500). Only way to kill it is to shut down wsl all together: wsl --shutdown

I don't really understand what is happening. It starts up fine, and the memory it uses does not exceed what my system has. Anybody have an idea?

image

image

Running setup.py install for pillow ... error

Running setup.py install for pillow ... error
Running setup.py install for pillow ... error
Running setup.py install for pillow ... error
Running setup.py install for pillow ... error
ythonhosted.org/packages/44/98/5b86278fbbf250d239ae0ecb724f8572af1c91f4a11edf4d36a206189440/colorama-0.4.4-py2.py3-none-any.whl
Collecting commonmark<0.10.0,>=0.9.0 (from rich~=11.1.0->flax->-r requirements.txt (line 8))
Downloading https://files.pythonhosted.org/packages/b1/92/dfd892312d822f36c55366118b95d914e5f16de11044a27cf10a7d71bbbf/commonmark-0.9.1-py2.py3-none-any.whl (51kB)
|████████████████████████████████| 51kB 25.2MB/s
Collecting fonttools>=4.22.0 (from matplotlib->flax->-r requirements.txt (line 8))
Downloading https://files.pythonhosted.org/packages/2f/85/2f6e42fb4b537b9998835410578fb1973175b81691e9a82ab6668cf64b0b/fonttools-4.33.3-py3-none-any.whl (930kB)
|████████████████████████████████| 931kB 29.0MB/s
Collecting python-dateutil>=2.7 (from matplotlib->flax->-r requirements.txt (line 8))
Downloading https://files.pythonhosted.org/packages/36/7a/87837f39d0296e723bb9b62bbb257d0355c7f6128853c78955f57342a56d/python_dateutil-2.8.2-py2.py3-none-any.whl (247kB)
|████████████████████████████████| 256kB 26.6MB/s
Collecting kiwisolver>=1.0.1 (from matplotlib->flax->-r requirements.txt (line 8))
Downloading https://files.pythonhosted.org/packages/51/50/9a9a94afa26c50fc5d9127272737806990aa698c7a1c220b8e5075e70304/kiwisolver-1.4.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.1MB)
|████████████████████████████████| 1.1MB 26.3MB/s
Collecting cycler>=0.10 (from matplotlib->flax->-r requirements.txt (line 8))
Downloading https://files.pythonhosted.org/packages/5c/f9/695d6bedebd747e5eb0fe8fad57b72fdf25411273a39791cde838d5a8f51/cycler-0.11.0-py3-none-any.whl
Collecting gitdb<5,>=4.0.1 (from GitPython>=1.0.0->wandb->dalle-mini==0.1.0->-r requirements.txt (line 6))
Downloading https://files.pythonhosted.org/packages/a3/7c/5d747655049bfbf75b5fcec57c8115896cb78d6fafa84f6d3ef4c0f13a98/gitdb-4.0.9-py3-none-any.whl (63kB)
|████████████████████████████████| 71kB 38.1MB/s
Collecting flatbuffers<3.0,>=1.12 (from jaxlib>=0.1.37->optax->flax->-r requirements.txt (line 8))
Downloading https://files.pythonhosted.org/packages/3d/d0/26033c70d642fbc1e35d3619cf3210986fb953c173b1226709f75056c149/flatbuffers-2.0-py2.py3-none-any.whl
Collecting toolz>=0.9.0 (from chex>=0.0.4->optax->flax->-r requirements.txt (line 8))
Downloading https://files.pythonhosted.org/packages/b5/f1/3df506b493736e3ee11fc1a3c2de8014a55f025d830a71bb499acc049a2c/toolz-0.11.2-py3-none-any.whl (55kB)
|████████████████████████████████| 61kB 23.0MB/s
Collecting dm-tree>=0.1.5 (from chex>=0.0.4->optax->flax->-r requirements.txt (line 8))
Downloading https://files.pythonhosted.org/packages/a4/b5/f4c721d479c6db0ea15c0fc2ed46c0a06b013e8930bc876aea030ede4805/dm_tree-0.1.7-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (143kB)
|████████████████████████████████| 143kB 31.6MB/s
Collecting smmap<6,>=3.0.1 (from gitdb<5,>=4.0.1->GitPython>=1.0.0->wandb->dalle-mini==0.1.0->-r requirements.txt (line 6))
Downloading https://files.pythonhosted.org/packages/6d/01/7caa71608bc29952ae09b0be63a539e50d2484bc37747797a66a60679856/smmap-5.0.0-py3-none-any.whl
Building wheels for collected packages: transformers, dalle-mini, msgpack
Building wheel for transformers (PEP 517) ... done
Created wheel for transformers: filename=transformers-4.20.0.dev0-cp37-none-any.whl size=4392278 sha256=69a5502f28012f73940815403bd07102a5d9635620bfd4ee96c1a87761f16a5d
Stored in directory: /tmp/pip-ephem-wheel-cache-tdfaawzj/wheels/33/eb/3b/4bf5dd835e865e472d4fc0754f35ac0edb08fe852e8f21655f
Building wheel for dalle-mini (PEP 517) ... done
Created wheel for dalle-mini: filename=dalle_mini-0.1.0-cp37-none-any.whl size=33998 sha256=34c2f0beeafcb64706b42988db283192ff9829a919a75054c071a76923bed870
Stored in directory: /tmp/pip-ephem-wheel-cache-tdfaawzj/wheels/8f/8b/51/446c34cf800feb07516f4a76fd266e67d8fba3e3d0b09f1df8
Building wheel for msgpack (PEP 517) ... done
Created wheel for msgpack: filename=msgpack-1.0.4-cp37-cp37m-linux_x86_64.whl size=310291 sha256=316f1e52413d51cb275ee8393d0ebb5d9fff732127e8235f75c28752cfddfcf2
Stored in directory: /home/anyuser/.cache/pip/wheels/11/d4/bf/9213122db9816a32382b176cdb92ce62cb18fecf3a2a2d0307
Successfully built transformers dalle-mini msgpack
Installing collected packages: zipp, typing-extensions, importlib-metadata, click, itsdangerous, MarkupSafe, Jinja2, Werkzeug, Flask, Six, Flask-Cors, aniso8601, pytz, Flask-RESTful, tqdm, absl-py, numpy, opt-einsum, scipy, jax, flatbuffers, jaxlib, toolz, dm-tree, chex, optax, pygments, colorama, commonmark, rich, msgpack, fonttools, pillow, pyparsing, packaging, python-dateutil, kiwisolver, cycler, matplotlib, flax, pyyaml, filelock, certifi, idna, urllib3, charset-normalizer, requests, huggingface-hub, tokenizers, regex, transformers, vqgan-jax, unidecode, emoji, sentry-sdk, smmap, gitdb, GitPython, psutil, setproctitle, promise, shortuuid, pathtools, docker-pycreds, protobuf, wandb, einops, wcwidth, ftfy, dalle-mini
Running setup.py install for MarkupSafe ... done
Running setup.py install for jax ... done
Running setup.py install for pillow ... error
ERROR: Command errored out with exit status 1:
command: /home/anyuser/Projects/IA/dalle-playground/backend/mydalee_env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-bjfk8s96/pillow/setup.py'"'"'; file='"'"'/tmp/pip-install-bjfk8s96/pillow/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-tdp_o0un/install-record.txt --single-version-externally-managed --compile --install-headers /home/anyuser/Projects/IA/dalle-playground/backend/mydalee_env/include/site/python3.7/pillow
cwd: /tmp/pip-install-bjfk8s96/pillow/
Complete output (177 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageSequence.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/EpsImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/TiffImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageTransform.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/McIdasImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PcfFontFile.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PdfImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/TarIO.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PSDraw.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImagePath.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/SpiderImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/MspImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/BlpImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/_binary.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PaletteFile.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/BufrStubImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/FitsImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/features.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/Image.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/XVThumbImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/GbrImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/TgaImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PalmImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/_version.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/TiffTags.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/JpegPresets.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageMorph.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageGrab.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PpmImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PcxImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageCms.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageColor.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/FpxImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/GifImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/DcxImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/Jpeg2KImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageShow.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImagePalette.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/MicImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageEnhance.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/GimpPaletteFile.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/_util.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/WalImageFile.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageDraw.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/CurImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/FontFile.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/GdImageFile.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageFile.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PngImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImtImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageFont.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ContainerIO.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageWin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/IptcImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/SunImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ExifTags.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageTk.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/SgiImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageFilter.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/_tkinter_finder.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PsdImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/BdfFontFile.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PdfParser.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PixarImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/MpegImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/IcnsImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/JpegImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageChops.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/WmfImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageDraw2.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/IcoImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/WebPImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PyAccess.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/init.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageQt.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageMath.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/DdsImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/XbmImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/Hdf5StubImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageStat.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/MpoImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/FtexImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageMode.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/FitsStubImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageOps.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/GribStubImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PcdImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/GimpGradientFile.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/main.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/BmpImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/XpmImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/FliImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
running egg_info
writing src/Pillow.egg-info/PKG-INFO
writing dependency_links to src/Pillow.egg-info/dependency_links.txt
writing requirements to src/Pillow.egg-info/requires.txt
writing top-level names to src/Pillow.egg-info/top_level.txt
reading manifest file 'src/Pillow.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '.c'
warning: no files found matching '
.h'
warning: no files found matching '.sh'
warning: no previously-included files found matching '.appveyor.yml'
warning: no previously-included files found matching '.clang-format'
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.editorconfig'
warning: no previously-included files found matching '.readthedocs.yml'
warning: no previously-included files found matching 'codecov.yml'
warning: no previously-included files matching '.git
' found anywhere in distribution
warning: no previously-included files matching '.pyc' found anywhere in distribution
warning: no previously-included files matching '
.so' found anywhere in distribution
no previously-included directories found matching '.ci'
writing manifest file 'src/Pillow.egg-info/SOURCES.txt'
running build_ext

The headers or library files could not be found for zlib,
a required dependency when compiling Pillow from source.

Please see the install instructions at:
   https://pillow.readthedocs.io/en/latest/installation.html

Traceback (most recent call last):
  File "/tmp/pip-install-bjfk8s96/pillow/setup.py", line 996, in <module>
    zip_safe=not (debug_build() or PLATFORM_MINGW),
  File "/home/anyuser/Projects/IA/dalle-playground/backend/mydalee_env/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/home/anyuser/anaconda3/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/home/anyuser/anaconda3/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/home/anyuser/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/anyuser/Projects/IA/dalle-playground/backend/mydalee_env/lib/python3.7/site-packages/setuptools/command/install.py", line 61, in run
    return orig.install.run(self)
  File "/home/anyuser/anaconda3/lib/python3.7/distutils/command/install.py", line 545, in run
    self.run_command('build')
  File "/home/anyuser/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/home/anyuser/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/anyuser/anaconda3/lib/python3.7/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/home/anyuser/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/home/anyuser/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/anyuser/Projects/IA/dalle-playground/backend/mydalee_env/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 84, in run
    _build_ext.run(self)
  File "/home/anyuser/anaconda3/lib/python3.7/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/tmp/pip-install-bjfk8s96/pillow/setup.py", line 804, in build_extensions
    raise RequiredDependencyException(f)
__main__.RequiredDependencyException: zlib

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-install-bjfk8s96/pillow/setup.py", line 1009, in <module>
    raise RequiredDependencyException(msg)
__main__.RequiredDependencyException:

The headers or library files could not be found for zlib,
a required dependency when compiling Pillow from source.

Please see the install instructions at:
   https://pillow.readthedocs.io/en/latest/installation.html


----------------------------------------

ERROR: Command errored out with exit status 1: /home/anyuser/Projects/IA/dalle-playground/backend/mydalee_env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-bjfk8s96/pillow/setup.py'"'"'; file='"'"'/tmp/pip-install-bjfk8s96/pillow/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-tdp_o0un/install-record.txt --single-version-externally-managed --compile --install-headers /home/anyuser/Projects/IA/dalle-playground/backend/mydalee_env/include/site/python3.7/pillow Check the logs for full command output.

No Tunnel URL generated

DALL-E-Playground-Backend-Colaboratory

AFAIK all the dependencies installed and the code runs as expected. However, when I run the 4th cell, it just keeps spinning and I see no URL generated as described. Is the last cell supposed to contain the URI after I hit play? I'm sure the mistake is mine or that there is a step most folks would know to get colab running that I am unaware of

Fix requirements

In requirements file change flax to flax==0.3.5. or it will be incompatible on google colab.

Docker install doesn't set up localtunnel

I tried to follow the instructions to run with docker-compose, but:

  • The web interface wouldn't let me enter http://localhost:8080/ as the backend URL, and
  • Neither of the DockerFiles sets up a tunnel

I ran these commands at a terminal:

sudo npm install -g localtunnel
lt --port 8080

I'm not sure of the best place for these, because:

  • The backend service is based on an image that doesn't have node (AFAIK)
  • The commands don't really relate to the interface service (but that service's image does have node)

Google Colab shows an error and doesnt render anything

This happes as soon as I try to open the front end. Im running from google colab.

2022-04-11 17:49:18.477391: E external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_driver.cc:271] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
WARNING:absl:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)

the query returns:
image

Full log:

your url is: https://*********.loca.lt/
2022-04-11 17:49:18.477391: E external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_driver.cc:271] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
WARNING:absl:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)
wandb: Currently logged in as: anony-mouse-234245 (use `wandb login --relogin` to force relogin)
wandb: Tracking run with wandb version 0.12.14
wandb: Run data is saved locally in /content/wandb/run-20220411_174918-1wn83s1g
wandb: Run `wandb offline` to turn off syncing.
wandb: Syncing run different-dust-2
wandb: ⭐️ View project at https://wandb.ai/anony-mouse-234245/uncategorized?apiKey=d234eca2f0b786a223ecace15cce6228271a435d
wandb: 🚀 View run at https://wandb.ai/anony-mouse-234245/uncategorized/runs/1wn83s1g?apiKey=d234eca2f0b786a223ecace15cce6228271a435d
wandb: WARNING Do NOT share these links with anyone. They can be used to claim your runs.
wandb: Downloading large artifact model-mheh9e55:latest, 1673.44MB. 7 files... Done. 0:0:0
tcmalloc: large alloc 1751359488 bytes == 0x5566ab700000 @  0x7f29c23b01e7 0x55669ed79338 0x55669ed43ad7 0x55669eec2575 0x55669ee5c8b8 0x55669ed473a2 0x55669ee25c6e 0x55669ed46ff9 0x55669ee38d4d 0x55669edbaec8 0x55669edb5a2e 0x55669ed4913c 0x55669ed49341 0x55669edb7ff1 0x55669edb5cdd 0x55669ed4888a 0x55669edb7719 0x55669edb5a2e 0x55669edb5723 0x55669ee7f812 0x55669ee7fb8d 0x55669ee7fa36 0x55669ee57183 0x55669ee56e2c 0x7f29c119ac87 0x55669ee56d0a
wandb: Downloading large artifact model-mheh9e55:latest, 1673.44MB. 7 files... Done. 0:0:0
 * Serving Flask app "app" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
INFO:werkzeug: * Running on http://0.0.0.0:8000/ (Press CTRL+C to quit)
INFO:werkzeug:127.0.0.1 - - [11/Apr/2022 17:50:33] "OPTIONS / HTTP/1.1" 200 -
INFO:werkzeug:127.0.0.1 - - [11/Apr/2022 17:51:42] "OPTIONS / HTTP/1.1" 200 -
INFO:werkzeug:127.0.0.1 - - [11/Apr/2022 17:51:42] "GET / HTTP/1.1" 200 -
INFO:werkzeug:127.0.0.1 - - [11/Apr/2022 17:51:50] "OPTIONS /dalle HTTP/1.1" 200 -
  0%|          | 0/2 [00:00<?, ?it/s]

"git repository is invalid" when attempting to run DALL-E Mega on Windows

When trying to run DALL-E mega on windows, I get the following error in logs:

2022-06-07 18:40:23,810 DEBUG   HandlerThread:20932 [meta.py:probe():209] probe
2022-06-07 18:40:23,821 DEBUG   HandlerThread:20932 [git.py:repo():29] git repository is invalid

After we run it, everything looks good until it finishes downloading the mega model, then it just spits me back to the cursor with no further information. I found that error after looking through the logs. Me and a friend have tried several troubleshooting steps (including throwing everything out and starting over) but we'e not sure where to go from here. We were able to get DALL-E Mini running correctly, so we think we should be able to get this too with some help.

Thanks all!

Google Colab Free Error

Anyone else getting this error?
Free version of colab.
Dalle "Mini" as option.
Project still runs but wondering if it's missing something.

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
datascience 0.10.6 requires folium==0.2.1, but you have folium 0.8.3 which is incompatible.

Run VQGAN on another GPU

I'm playing around trying to run this on my 12 GB gpu. It just barely fits, however the VQGAN takes up enough memory to overflow. It would be nice if I could use another GPU for vqgan and maybe tokenizer. I'm not entirely sure what I'm doing.

I've loaded in two devices with Docker and jax.devices("gpu") shows them both.

I've modified VQModel.from_pretrained(VQGAN_REPO, revision=VQGAN_COMMIT_ID, device=1) also trying device=jax.devices("gpu")[1] but device argument is unexpected

CPU & GPU usage

Apologies if this isn't the appropriate venue to ask these questions.

I've been toying a bit with this, but I'm seeing two problems so far:

  • The CPU seems heavily underused. Right now the process is only using a single core out of my 12-cores machine, and I couldn't figure out a way to indicate to use more resources.
  • The GPU is totally unused. In fact, there's a message at the beginning talking about it:
WARNING:absl:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)
--> Starting DALL-E Server. This might take up to two minutes.

Running with TF_CPP_MIN_LOG_LEVEL=0 doesn't give much more info:

2022-06-06 13:07:53.761716: I external/org_tensorflow/tensorflow/core/util/util.cc:168] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2022-06-06 13:07:53.761954: I external/org_tensorflow/tensorflow/core/tpu/tpu_initializer_helper.cc:259] Libtpu path is: libtpu.so
2022-06-06 13:07:53.785866: I external/org_tensorflow/tensorflow/core/util/util.cc:168] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2022-06-06 13:07:54.419499: I tensorflow/core/util/util.cc:169] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2022-06-06 13:07:55.545835: I external/org_tensorflow/tensorflow/compiler/xla/service/service.cc:174] XLA service 0x555e2489cb80 initialized for platform Interpreter (this does not guarantee that XLA will be used). Devices:
2022-06-06 13:07:55.545853: I external/org_tensorflow/tensorflow/compiler/xla/service/service.cc:182]   StreamExecutor device (0): Interpreter, <undefined>
2022-06-06 13:07:55.547821: I external/org_tensorflow/tensorflow/compiler/xla/pjrt/tfrt_cpu_pjrt_client.cc:176] TfrtCpuClient created.
2022-06-06 13:07:55.548231: I external/org_tensorflow/tensorflow/stream_executor/tpu/tpu_platform_interface.cc:74] No TPU platform found.
WARNING:absl:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)
--> Starting DALL-E Server. This might take up to two minutes.

I did follow the instructions to install pytorch, including the verification that cuda is detectable:

$ python
Python 3.9.12 (main, Apr  5 2022, 06:56:58) 
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.is_available()
True

To no avail.

Feel free to redirect me to other resources if this isn't the right medium to discuss the problem.

PIP dependency conflict?

When I run all cells on the Google Colab project, I see this error:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
datascience 0.10.6 requires folium==0.2.1, but you have folium 0.8.3 which is incompatible.

Any way to fix it? I'm running on the free version of Google Colab, perhaps the demo no longer works on the free version?

development mode generate images very slow

hi,

when I try this project, the images generate very slow in local development mode.

I am interested in the project, but have no much knowledge of it, while I run it on my laptop following your guide successfully.

so, I wonder if there is a way to speed images generating ?

thanks a lot.

Error if http:// is not specified on backend url

If http:// (or possibly https://) is not specified at the beginning of your backend url the following error is thrown: "Error querying DALL-E service. Check your backend server logs."

Not obvious to inexperienced users. #41

When I implement app.py, it doesn't work

Traceback (most recent call last):
File "app.py", line 9, in
from dalle_mini.model import CustomFlaxBartForConditionalGeneration
ImportError: cannot import name 'CustomFlaxBartForConditionalGeneration' from 'dalle_mini.model' (/home/hahmwj/.local/lib/python3.8/site-packages/dalle_mini/model/init.py)

It doesn't work with, how can I solve this error?

Clarify what constitutes a "strong local machine"

I've got an RTX 2070 SUPER 8GB and 32GB of system RAM.

When running the backend, I run into

2022-06-04 13:02:17.271909: W external/org_tensorflow/tensorflow/core/common_runtime/bfc_allocator.cc:479] Allocator (GPU_0_bfc) ran out of memory trying to allocate 768.00MiB (rounded to 805306368)requested by op 
2022-06-04 13:02:17.272293: W external/org_tensorflow/tensorflow/core/common_runtime/bfc_allocator.cc:491] *********************************************************************_****************************__
2022-06-04 13:02:17.273116: E external/org_tensorflow/tensorflow/compiler/xla/pjrt/pjrt_stream_executor_client.cc:2141] Execution of replica 0 failed: RESOURCE_EXHAUSTED: Out of memory while trying to allocate 805306368 bytes.
BufferAssignment OOM Debugging.
BufferAssignment stats:
             parameter allocation:    16.4KiB
              constant allocation:        64B
        maybe_live_out allocation:    5.25GiB
     preallocated temp allocation:  288.04MiB
  preallocated temp fragmentation:       496B (0.00%)
                 total allocation:    5.53GiB
              total fragmentation:     5.3KiB (0.00%)

But I'm not sure if it is due to a configuration error, or if my system simply cannot handle the Mega model. Does anyone know the minimum requirement for GPU RAM?

This sort of information should be added to the readme, if it is available.

Mega model does not work at all

I have a Colab Pro subscription and everything. Whenever I try to use the Mega model, it results in “Error querying DALL-E service. Check your backend server logs.”

But the server logs say that it generated images just fine. Where are the images?!

Out of GPU memory using rewritten backend

  • using rewritten backend (consts.py, dalle_model.py, etc.) with a docker build on a 3060. Out of memory loading Mini on 12GB of VRAM?
  • Also needs a README update on instructions for using Mega.

cuda error out of memory dalle playground

dalle-backend | 2022-06-09 14:00:57.289965: E external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_driver.cc:802] failed to alloc 198967552 bytes on host: CUDA_ERROR_OUT_OF_MEMORY: out of memory

Generate and show rankings with CLIP

Add the backend the ability to generate rankings using CLIP, then send these back along with the generated images so the user can see the score each image got.
This should be a toggleable option within the user interface as CLIP inference would add more time to the request.

More on the implementation here.

CORS

Getting a frontend error:

Error querying DALL-E service. Check your backend server logs.

This is in the Chrome dev console:

Access to fetch at 'https://empty-oranges-juggle-*-*-*-222.loca.lt/dalle' from origin 'https://saharmor.me' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Backend service is showing 200. Either the server needs to send the header, or the frontend fetch call needs to be fixed. Right now it sends no-cors as a header instead of as a root-level property.

The server nevers finish the start process

I let the backend run for hours but it never starts, I got some kind of error on output:

--> Starting DALL-E Server. This might take up to two minutes.
WARNING:absl:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)
Some of the weights of DalleBart were initialized in float16 precision from the model checkpoint at /var/folders/96/q4j34l5j1k14yq56kcys66q00000gn/T/tmptpfziy1j:
[('lm_head', 'kernel'), ('model', 'decoder', 'embed_positions', 'embedding'), ('model', 'decoder', 'embed_tokens', 'embedding'), ('model', 'decoder', 'final_ln', 'bias'), ('model', 'decoder', 'layernorm_embedding', 'bias'), ('model', 'decoder', 'layernorm_embedding', 'scale'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'FlaxBartAttention_0', 'k_proj', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'FlaxBartAttention_0', 'out_proj', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'FlaxBartAttention_0', 'q_proj', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'FlaxBartAttention_0', 'v_proj', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'FlaxBartAttention_1', 'k_proj', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'FlaxBartAttention_1', 'out_proj', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'FlaxBartAttention_1', 'q_proj', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'FlaxBartAttention_1', 'v_proj', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'GLU_0', 'Dense_0', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'GLU_0', 'Dense_1', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'GLU_0', 'Dense_2', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'GLU_0', 'LayerNorm_0', 'bias'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'GLU_0', 'LayerNorm_1', 'bias'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'LayerNorm_0', 'bias'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'LayerNorm_1', 'bias'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'LayerNorm_1', 'scale'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'LayerNorm_2', 'bias'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'LayerNorm_3', 'bias'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'LayerNorm_3', 'scale'), ('model', 'encoder', 'embed_positions', 'embedding'), ('model', 'encoder', 'embed_tokens', 'embedding'), ('model', 'encoder', 'final_ln', 'bias'), ('model', 'encoder', 'layernorm_embedding', 'bias'), ('model', 'encoder', 'layernorm_embedding', 'scale'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'FlaxBartAttention_0', 'k_proj', 'kernel'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'FlaxBartAttention_0', 'out_proj', 'kernel'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'FlaxBartAttention_0', 'q_proj', 'kernel'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'FlaxBartAttention_0', 'v_proj', 'kernel'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'GLU_0', 'Dense_0', 'kernel'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'GLU_0', 'Dense_1', 'kernel'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'GLU_0', 'Dense_2', 'kernel'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'GLU_0', 'LayerNorm_0', 'bias'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'GLU_0', 'LayerNorm_1', 'bias'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'LayerNorm_0', 'bias'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'LayerNorm_1', 'bias'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'LayerNorm_1', 'scale')]
You should probably UPCAST the model weights to float32 if this was not intended. See [`~FlaxPreTrainedModel.to_fp32`] for further information on how to do this.

system info:

OS: macOS 12.4 21F79 x86_64
Host: MacBookPro12,1
Kernel: 21.5.0
Shell: zsh 5.8.1
CPU: Intel i7-5557U (4) @ 3.10GHz
GPU: Intel Iris Graphics 6100
Memory: 4535MiB / 16384MiB

How can i install jaxlib?

hello im trying to run dall e playground on my pc but i cant install jaxlib its only available for mac and linux how can i install it on windows so i can use dall e

Does not see GPU on start

When attempting to start the backend, I see the following:

~/Desktop/dalle-playground/backend$ python3 app.py 8000
--> Starting DALL-E Server. This might take up to two minutes.
2022-06-12 13:16:41.035513: I external/org_tensorflow/tensorflow/core/tpu/tpu_initializer_helper.cc:259] Libtpu path is: libtpu.so
2022-06-12 13:16:51.303810: I external/org_tensorflow/tensorflow/compiler/xla/service/service.cc:174] XLA service 0x90bd0b0 initialized for platform Interpreter (this does not guarantee that XLA will be used). Devices:
2022-06-12 13:16:51.303839: I external/org_tensorflow/tensorflow/compiler/xla/service/service.cc:182]   StreamExecutor device (0): Interpreter, <undefined>
2022-06-12 13:16:51.305845: I external/org_tensorflow/tensorflow/compiler/xla/pjrt/tfrt_cpu_pjrt_client.cc:176] TfrtCpuClient created.
2022-06-12 13:16:51.306543: I external/org_tensorflow/tensorflow/stream_executor/tpu/tpu_platform_interface.cc:74] No TPU platform found.
WARNING:absl:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)

When checking tensorflow to make sure I didn't mess something up, I see the device is seen:

Python 3.8.10 (default, Mar 15 2022, 12:22:08) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from tensorflow.python.client import device_lib
>>> print(device_lib.list_local_devices())
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 9644359123142212818
xla_global_id: -1
, name: "/device:GPU:0"
device_type: "GPU"
memory_limit: 10567155712
locality {
  bus_id: 1
  links {
  }
}
incarnation: 80875608830553824
physical_device_desc: "device: 0, name: NVIDIA GeForce RTX 3060, pci bus id: 0000:01:00.0, compute capability: 8.6"
xla_global_id: 416903419
]
>>>

Output of nvcc -V

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Tue_May__3_18:49:52_PDT_2022
Cuda compilation tools, release 11.7, V11.7.64
Build cuda_11.7.r11.7/compiler.31294372_0

Crash when trying to use mega_full model

Hello,

I am experiencing a crash when I try to run the mega_full model on my machine. the other 2 models run with no issue, but when I try to launch with mega_full, the terminal I am running in just crashes after a minute or so. No error, no output.

Running on Ubuntu, with a RTX 3060 12gb

versioneer not working -- "AttributeError: module 'versioneer' has no attribute 'get_version'"

I'm trying to install this playground on Windows (not in Docker), and the pip install of requirements showed some errors for versioneer and it looks like it's downloading a dozen or more versions of every package and then stalls out on "Using cached Pillow-6.2.0.tar.gz (37.4 MB)". Maybe it's unable to download that one, which comes after a long string of higher version numbers of Pillow.

Maybe the latest versioneer dropped the 'get_version' function?

Cannot install flax because these package versions have conflicting dependencies.

ERROR: Cannot install flax because these package versions have conflicting dependencies.

The conflict is caused by:
    optax 0.1.2 depends on jaxlib>=0.1.37
    optax 0.1.1 depends on jaxlib>=0.1.37
    optax 0.1.0 depends on jaxlib>=0.1.37
    optax 0.0.91 depends on jaxlib>=0.1.37
    optax 0.0.9 depends on jaxlib>=0.1.37
    optax 0.0.8 depends on jaxlib>=0.1.37
    optax 0.0.6 depends on jaxlib>=0.1.37
    optax 0.0.5 depends on jaxlib>=0.1.37
    optax 0.0.3 depends on jaxlib>=0.1.37
    optax 0.0.2 depends on jaxlib>=0.1.37
    optax 0.0.1 depends on jaxlib>=0.1.37

WIn 11
Python 3.10.5
PIP 22.0.4

Mega model incomplete input error

Whenever I try running the mega model, I get this error:

Traceback (most recent call last):

  File "app.py", line 47, in <module>

    dalle_model = DalleModel(dalle_version)

  File "/app/dalle_model.py", line 62, in __init__

    self.model, params = DalleBart.from_pretrained(

  File "/usr/local/lib/python3.8/dist-packages/dalle_mini/model/utils.py", line 25, in from_pretrained

    return super(PretrainedFromWandbMixin, cls).from_pretrained(

  File "/usr/local/lib/python3.8/dist-packages/transformers/modeling_flax_utils.py", line 603, in from_pretrained

    state = from_bytes(cls, state_f.read())

  File "/usr/local/lib/python3.8/dist-packages/flax/serialization.py", line 368, in from_bytes

    state_dict = msgpack_restore(encoded_bytes)

  File "/usr/local/lib/python3.8/dist-packages/flax/serialization.py", line 350, in msgpack_restore

    state_dict = msgpack.unpackb(

  File "msgpack/_unpacker.pyx", line 205, in msgpack._cmsgpack.unpackb

ValueError: Unpack failed: incomplete input

Any fix?

Error using Docker: app.py: error: unrecognized arguments: 8080

Hello,
I'm getting this error after running docker compose up command:

Compiled with warnings.
dalle-interface |
dalle-interface | ./src/TextPromptInput.js
dalle-interface | Line 1:17: 'useState' is defined but never used no-unused-vars
dalle-interface |
dalle-interface | ./src/BackendUrlInput.js
dalle-interface | Line 30:8: React Hook useEffect has a missing dependency: 'onChange'. Either include it or remove the dependency array react-hooks/exhaustive-deps
dalle-interface |
dalle-interface | ./src/LoadingSpinner.js
dalle-interface | Line 33:8: React Hook useEffect has a missing dependency: 'textIdx'. Either include it or remove the dependency array react-hooks/exhaustive-deps
dalle-interface |
dalle-interface | Search for the keywords to learn more about each warning.
dalle-interface | To ignore, add // eslint-disable-next-line to the line before.
dalle-interface |
dalle-backend | --> Starting DALL-E Server. This might take up to two minutes.
dalle-backend | usage: app.py
dalle-backend | [-h]
dalle-backend | [--port PORT]
dalle-backend | [--model_version MODEL_VERSION]
dalle-backend | [--save_to_disk SAVE_TO_DISK]
dalle-backend | app.py: error: unrecognized arguments: 8080
dalle-backend exited with code 2

after this it just repeats the dalle-backend error over and over again.
Changing the port number on the Dockerfile or the yaml file doesn't make a difference.

I have docker and nvidia container installed properly.
Running on Ubuntu 22.04
3090 RTX

Thanks!

'DalleBart' object has no attribute '_is_initialized'

Trying to run the DALL-E backend using Google Colab, I get the error bellow:

File "dalle-playground/backend/app.py", line 62, in
model = DalleBart.from_pretrained(DALLE_MODEL, revision=DALLE_COMMIT_ID)
File "/usr/local/lib/python3.7/dist-packages/dalle_mini/model/utils.py", line 26, in from_pretrained
pretrained_model_name_or_path, *model_args, **kwargs
File "/usr/local/lib/python3.7/dist-packages/dalle_mini/model/modeling.py", line 1395, in from_pretrained
model = cls(config, *model_args, **model_kwargs)
File "/usr/local/lib/python3.7/dist-packages/dalle_mini/model/modeling.py", line 1247, in init
self.params = random_params
File "/usr/local/lib/python3.7/dist-packages/transformers/modeling_flax_utils.py", line 191, in params
if not self._is_initialized:
AttributeError: 'DalleBart' object has no attribute '_is_initialized'

Local Development guide leads to misconfigured environment when using a GPU

Hello,

Going through the steps to set up a local development environment seems to be missing steps and leading people to have misconfigured environments if they want to utilize their GPU.

The main culprit that seems to be causing the greatest amount of trouble is the current step that installs jax to the user's machine is the non CUDA version.

To be able to install the CUDA version of jax, the user has to follow the installation instructions on nvidia's website to install the latest version of the CUDA toolkit, then sign up as an nVidia developer to get access to the cuDNN library, install that, then follow the instructions on the jax github page to get the cuda version of jax. This works on Ubuntu and I'm pretty sure that this is doable on WSL, but not 100% sure on that.

Hopefully this will clear up a lot of issues people are having setting up

app.py hangs/freezes

When trying to run on my local Ubuntu following the "Local development" steps app.py hangs when running
python app.py 8080
these are the last few lines printed on the console, then nothing happens even waiting some hours.

wandb: WARNING Do NOT share these links with anyone. They can be used to claim your runs.
wandb: Downloading large artifact mega-1:latest, 9873.84MB. 7 files... Done. 0:0:0
wandb: Downloading large artifact mega-1:latest, 9873.84MB. 7 files... Done. 0:0:0
0%| | 0/1 [00:00<?, ?it/s]

Not only. The line "your url is: https........." which is printed in the jupiter collab when running app.py never gets printed out when running local.
Any help?

Error on any model - DenseElementsAttr could not be constructed from the given buffer

Doesn't seem to matter much which model I pick (mini, mega, etc.) they all fail with the same error. Jaxlib 1.3.7 installed

> D:\dalle\dalle-playground\backend>python app.py --port 8080 --model_version mega --save_to_disk true

--> Starting DALL-E Server. This might take up to two minutes.
wandb: Currently logged in as: anony-moose-315442. Use `wandb login --relogin` to force relogin
wandb: Tracking run with wandb version 0.12.18
wandb: Run data is saved locally in D:\dalle\dalle-playground\backend\wandb\run-20220615_222754-1tbnwomv
wandb: Run `wandb offline` to turn off syncing.
wandb: Syncing run lilac-field-9
wandb:  View project at https://wandb.ai/anony-moose-315442/dalle-playground-backend?apiKey=cb614629a73707160e3c82c72823ef954bcad91c
wandb:  View run at https://wandb.ai/anony-moose-315442/dalle-playground-backend/runs/1tbnwomv?apiKey=cb614629a73707160e3c82c72823ef954bcad91c
wandb: WARNING Do NOT share these links with anyone. They can be used to claim your runs.
wandb: Downloading large artifact mega-1-fp16:latest, 4938.53MB. 7 files... Done. 0:0:5.4
Some of the weights of DalleBart were initialized in float16 precision from the model checkpoint at C:\Users\blood\AppData\Local\Temp\tmp_nwoes5j:
[('lm_head', 'kernel'), ('model', 'decoder', 'embed_positions', 'embedding'), ('model', 'decoder', 'embed_tokens', 'embedding'), ('model', 'decoder', 'final_ln', 'bias'), ('model', 'decoder', 'layernorm_embedding', 'bias'), ('model', 'decoder', 'layernorm_embedding', 'scale'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'FlaxBartAttention_0', 'k_proj', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'FlaxBartAttention_0', 'out_proj', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'FlaxBartAttention_0', 'q_proj', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'FlaxBartAttention_0', 'v_proj', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'FlaxBartAttention_1', 'k_proj', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'FlaxBartAttention_1', 'out_proj', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'FlaxBartAttention_1', 'q_proj', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'FlaxBartAttention_1', 'v_proj', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'GLU_0', 'Dense_0', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'GLU_0', 'Dense_1', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'GLU_0', 'Dense_2', 'kernel'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'GLU_0', 'LayerNorm_0', 'bias'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'GLU_0', 'LayerNorm_1', 'bias'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'LayerNorm_0', 'bias'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'LayerNorm_1', 'bias'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'LayerNorm_1', 'scale'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'LayerNorm_2', 'bias'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'LayerNorm_3', 'bias'), ('model', 'decoder', 'layers', 'FlaxBartDecoderLayers', 'LayerNorm_3', 'scale'), ('model', 'encoder', 'embed_positions', 'embedding'), ('model', 'encoder', 'embed_tokens', 'embedding'), ('model', 'encoder', 'final_ln', 'bias'), ('model', 'encoder', 'layernorm_embedding', 'bias'), ('model', 'encoder', 'layernorm_embedding', 'scale'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'FlaxBartAttention_0', 'k_proj', 'kernel'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'FlaxBartAttention_0', 'out_proj', 'kernel'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'FlaxBartAttention_0', 'q_proj', 'kernel'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'FlaxBartAttention_0', 'v_proj', 'kernel'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'GLU_0', 'Dense_0', 'kernel'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'GLU_0', 'Dense_1', 'kernel'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'GLU_0', 'Dense_2', 'kernel'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'GLU_0', 'LayerNorm_0', 'bias'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'GLU_0', 'LayerNorm_1', 'bias'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'LayerNorm_0', 'bias'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'LayerNorm_1', 'bias'), ('model', 'encoder', 'layers', 'FlaxBartEncoderLayers', 'LayerNorm_1', 'scale')]
You should probably UPCAST the model weights to float32 if this was not intended. See [`~FlaxPreTrainedModel.to_fp32`] for further information on how to do this.
wandb: Downloading large artifact mega-1-fp16:latest, 4938.53MB. 7 files... Done. 0:0:2.7
Traceback (most recent call last):
  File "D:\dalle\dalle-playground\backend\app.py", line 61, in <module>
    dalle_model.generate_images("warm-up", 1)
  File "D:\dalle\dalle-playground\backend\dalle_model.py", line 92, in generate_images
    key, subkey = jax.random.split(key)
  File "C:\Python\Python39\site-packages\jax\_src\random.py", line 194, in split
    return _return_prng_keys(wrapped, _split(key, num))
  File "C:\Python\Python39\site-packages\jax\_src\random.py", line 180, in _split
    return key._split(num)
  File "C:\Python\Python39\site-packages\jax\_src\prng.py", line 203, in _split
    return PRNGKeyArray(self.impl, self.impl.split(self._keys, num))
  File "C:\Python\Python39\site-packages\jax\_src\prng.py", line 474, in threefry_split
    return _threefry_split(key, int(num))  # type: ignore
  File "C:\Python\Python39\site-packages\jax\_src\prng.py", line 479, in _threefry_split
    return lax.reshape(threefry_2x32(key, counts), (num, 2))
  File "C:\Python\Python39\site-packages\jax\_src\prng.py", line 467, in threefry_2x32
    x = threefry2x32_p.bind(key1, key2, x[0], x[1])
jax._src.source_info_util.JaxStackTraceBeforeTransformation: ValueError: DenseElementsAttr could not be constructed from the given buffer. This may mean that the Python buffer layout does not match that MLIR expected layout and is a bug.

The preceding stack trace is the source of the JAX operation that, once transformed by JAX, triggered the following exception.

--------------------

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\dalle\dalle-playground\backend\app.py", line 61, in <module>
    dalle_model.generate_images("warm-up", 1)
  File "D:\dalle\dalle-playground\backend\dalle_model.py", line 92, in generate_images
    key, subkey = jax.random.split(key)
  File "C:\Python\Python39\site-packages\jax\_src\random.py", line 194, in split
    return _return_prng_keys(wrapped, _split(key, num))
  File "C:\Python\Python39\site-packages\jax\_src\random.py", line 180, in _split
    return key._split(num)
  File "C:\Python\Python39\site-packages\jax\_src\prng.py", line 203, in _split
    return PRNGKeyArray(self.impl, self.impl.split(self._keys, num))
  File "C:\Python\Python39\site-packages\jax\_src\prng.py", line 474, in threefry_split
    return _threefry_split(key, int(num))  # type: ignore
  File "C:\Python\Python39\site-packages\jax\_src\traceback_util.py", line 162, in reraise_with_filtered_traceback
    return fun(*args, **kwargs)
  File "C:\Python\Python39\site-packages\jax\_src\api.py", line 473, in cache_miss
    out_flat = xla.xla_call(
  File "C:\Python\Python39\site-packages\jax\core.py", line 1765, in bind
    return call_bind(self, fun, *args, **params)
  File "C:\Python\Python39\site-packages\jax\core.py", line 1781, in call_bind
    outs = top_trace.process_call(primitive, fun_, tracers, params)
  File "C:\Python\Python39\site-packages\jax\core.py", line 678, in process_call
    return primitive.impl(f, *tracers, **params)
  File "C:\Python\Python39\site-packages\jax\_src\dispatch.py", line 182, in _xla_call_impl
    compiled_fun = _xla_callable(fun, device, backend, name, donated_invars,
  File "C:\Python\Python39\site-packages\jax\linear_util.py", line 285, in memoized_fun
    ans = call(fun, *args)
  File "C:\Python\Python39\site-packages\jax\_src\dispatch.py", line 230, in _xla_callable_uncached
    return lower_xla_callable(fun, device, backend, name, donated_invars, False,
  File "C:\Python\Python39\site-packages\jax\_src\profiler.py", line 206, in wrapper
    return func(*args, **kwargs)
  File "C:\Python\Python39\site-packages\jax\_src\dispatch.py", line 340, in lower_xla_callable
    module, keepalive = mlir.lower_jaxpr_to_module(
  File "C:\Python\Python39\site-packages\jax\interpreters\mlir.py", line 556, in lower_jaxpr_to_module
    lower_jaxpr_to_fun(
  File "C:\Python\Python39\site-packages\jax\interpreters\mlir.py", line 810, in lower_jaxpr_to_fun
    out_vals, tokens_out = jaxpr_subcomp(ctx.replace(name_stack=callee_name_stack),
  File "C:\Python\Python39\site-packages\jax\interpreters\mlir.py", line 929, in jaxpr_subcomp
    ans = rule(rule_ctx, *map(_unwrap_singleton_ir_values, in_nodes),
  File "C:\Python\Python39\site-packages\jax\_src\prng.py", line 400, in _threefry2x32_gpu_lowering
    return threefry2x32_lowering(
  File "C:\Python\Python39\site-packages\jaxlib\cuda_prng.py", line 76, in threefry2x32_lowering
    layout = ir.DenseIntElementsAttr.get(np.arange(ndims - 1, -1, -1),
jax._src.traceback_util.UnfilteredStackTrace: ValueError: DenseElementsAttr could not be constructed from the given buffer. This may mean that the Python buffer layout does not match that MLIR expected layout and is a bug.

The stack trace below excludes JAX-internal frames.
The preceding is the original exception that occurred, unmodified.

--------------------

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\dalle\dalle-playground\backend\app.py", line 61, in <module>
    dalle_model.generate_images("warm-up", 1)
  File "D:\dalle\dalle-playground\backend\dalle_model.py", line 92, in generate_images
    key, subkey = jax.random.split(key)
  File "C:\Python\Python39\site-packages\jax\_src\random.py", line 194, in split
    return _return_prng_keys(wrapped, _split(key, num))
  File "C:\Python\Python39\site-packages\jax\_src\random.py", line 180, in _split
    return key._split(num)
  File "C:\Python\Python39\site-packages\jax\_src\prng.py", line 203, in _split
    return PRNGKeyArray(self.impl, self.impl.split(self._keys, num))
  File "C:\Python\Python39\site-packages\jax\_src\prng.py", line 474, in threefry_split
    return _threefry_split(key, int(num))  # type: ignore
  File "C:\Python\Python39\site-packages\jax\_src\prng.py", line 400, in _threefry2x32_gpu_lowering
    return threefry2x32_lowering(
  File "C:\Python\Python39\site-packages\jaxlib\cuda_prng.py", line 76, in threefry2x32_lowering
    layout = ir.DenseIntElementsAttr.get(np.arange(ndims - 1, -1, -1),
ValueError: DenseElementsAttr could not be constructed from the given buffer. This may mean that the Python buffer layout does not match that MLIR expected layout and is a bug.
wandb: Waiting for W&B process to finish... (failed 1). Press Ctrl-C to abort syncing.
wandb:
wandb: Synced lilac-field-9: https://wandb.ai/anony-moose-315442/dalle-playground-backend/runs/1tbnwomv?apiKey=cb614629a73707160e3c82c72823ef954bcad91c
wandb: Synced 5 W&B file(s), 0 media file(s), 0 artifact file(s) and 0 other file(s)
wandb: Find logs at: .\wandb\run-20220615_222754-1tbnwomv\logs

docker build on ubuntu 20.04 LTS breaks

simply doing docker compose up --detach leads to a pip install error

Here's the full traceback

[+] Building 439.8s (16/24)
 => [dalle-playground_dalle-interface internal] load build definition from Dockerfile                                                                              0.1s
 => => transferring dockerfile: 32B                                                                                                                                0.1s
 => [dalle-playground_dalle-interface internal] load .dockerignore                                                                                                 0.0s
 => => transferring context: 2B                                                                                                                                    0.0s
 => [dalle-playground_dalle-backend internal] load build definition from Dockerfile                                                                                0.0s
 => => transferring dockerfile: 32B                                                                                                                                0.0s
 => [dalle-playground_dalle-backend internal] load .dockerignore                                                                                                   0.1s
 => => transferring context: 2B                                                                                                                                    0.1s
 => [dalle-playground_dalle-interface internal] load metadata for docker.io/library/node:lts-slim                                                                  0.1s
 => [dalle-playground_dalle-backend internal] load metadata for docker.io/nvidia/cuda:11.4.3-cudnn8-devel-ubuntu20.04                                              0.1s
 => [dalle-playground_dalle-interface 1/6] FROM docker.io/library/node:lts-slim@sha256:989dc486196a861f0ccc6c72f2eb7a5d3edb3451f2325bb8e81702ae42ed40e1            0.0s
 => [dalle-playground_dalle-interface internal] load build context                                                                                                 0.0s
 => => transferring context: 843B                                                                                                                                  0.0s
 => CACHED [dalle-playground_dalle-interface 2/6] COPY package.json /code/package.json                                                                             0.0s
 => CACHED [dalle-playground_dalle-interface 3/6] COPY package-lock.json /code/package-lock.json                                                                   0.0s
 => CACHED [dalle-playground_dalle-interface 4/6] WORKDIR /code                                                                                                    0.0s
 => CACHED [dalle-playground_dalle-interface 5/6] COPY . /code                                                                                                     0.0s
 => [dalle-playground_dalle-interface 6/6] RUN npm install                                                                                                       279.7s
 => [dalle-playground_dalle-backend 1/9] FROM docker.io/nvidia/cuda:11.4.3-cudnn8-devel-ubuntu20.04@sha256:275d35f7985cfe12dc3e6e40a3df5fff2bb217b1c248f0f70dad  439.5s
 => => resolve docker.io/nvidia/cuda:11.4.3-cudnn8-devel-ubuntu20.04@sha256:275d35f7985cfe12dc3e6e40a3df5fff2bb217b1c248f0f70dadaa298d1b938b                       0.1s
 => => sha256:275d35f7985cfe12dc3e6e40a3df5fff2bb217b1c248f0f70dadaa298d1b938b 2.43kB / 2.43kB                                                                     0.0s
 => => sha256:21c6ada6eafc65a3d872cc265726e98ccafdb9ca440977e644fa49e41d8572a3 14.87kB / 14.87kB                                                                   0.0s
 => => sha256:8e5c1b329fe39c318c0d49821b339fb94a215c5dc0a2898c8030b5a4d091bcba 28.57MB / 28.57MB                                                                   1.2s
 => => sha256:7f1ba713f7bc7d2f024e53707865310ba3598f4c672a3eb43a7d80a579f24ccd 7.93MB / 7.93MB                                                                     0.5s
 => => sha256:c6ce639536d2eb5588528344bdb11cc344b2665d3b23489b80c9c967d27cebbb 11.90MB / 11.90MB                                                                   0.7s
 => => sha256:80565d12228abcb3881d875754fb50e585808e2dc4a1fdfd6b115ce402f8ab4b 188B / 188B                                                                         1.2s
 => => sha256:cda944862fc4727530a6076be56b31755825191b8628bf396df5db891d8f8d63 6.43kB / 6.43kB                                                                     1.2s
 => => sha256:c5a3e503682d3fe7537937f4f4d6abb11686532ecbda0908858a8162603c83ef 62.87kB / 62.87kB                                                                   1.3s
 => => sha256:2552b309a76214f646371475dae9addac6200da3aa0da89a202703a01f7fa0fc 1.30GB / 1.30GB                                                                    84.0s
 => => sha256:b708836e94fc4d712c2f7883732795fb6091ade2d929aee88eb8d00d477fe8d6 1.71GB / 1.71GB                                                                   106.8s
 => => sha256:7ddd299e309f01d661432978534a1a9fda3fac6ab6b11627f6fad543ec677b49 85.87kB / 85.87kB                                                                   1.5s
 => => sha256:233934f1b026bb75e03939a8eaf7841cd6bb3be4828c813d739b866f8d0f3074 1.90GB / 1.90GB                                                                   118.1s
 => => extracting sha256:8e5c1b329fe39c318c0d49821b339fb94a215c5dc0a2898c8030b5a4d091bcba                                                                         15.6s
 => => extracting sha256:7f1ba713f7bc7d2f024e53707865310ba3598f4c672a3eb43a7d80a579f24ccd                                                                          3.9s
 => => extracting sha256:c6ce639536d2eb5588528344bdb11cc344b2665d3b23489b80c9c967d27cebbb                                                                          4.7s
 => => extracting sha256:80565d12228abcb3881d875754fb50e585808e2dc4a1fdfd6b115ce402f8ab4b                                                                          0.0s
 => => extracting sha256:cda944862fc4727530a6076be56b31755825191b8628bf396df5db891d8f8d63                                                                          0.1s
 => => extracting sha256:2552b309a76214f646371475dae9addac6200da3aa0da89a202703a01f7fa0fc                                                                         98.2s
 => => extracting sha256:c5a3e503682d3fe7537937f4f4d6abb11686532ecbda0908858a8162603c83ef                                                                          0.0s
 => => extracting sha256:b708836e94fc4d712c2f7883732795fb6091ade2d929aee88eb8d00d477fe8d6                                                                        125.5s
 => => extracting sha256:7ddd299e309f01d661432978534a1a9fda3fac6ab6b11627f6fad543ec677b49                                                                          0.0s
 => => extracting sha256:233934f1b026bb75e03939a8eaf7841cd6bb3be4828c813d739b866f8d0f3074                                                                        109.2s
 => [dalle-playground_dalle-backend internal] load build context                                                                                                   0.1s
 => => transferring context: 172B                                                                                                                                  0.0s
 => [dalle-playground_dalle-interface] exporting to image                                                                                                        159.7s
 => => exporting layers                                                                                                                                          159.7s
 => [dalle-playground_dalle-backend 2/9] WORKDIR /app                                                                                                              8.5s
 => ERROR [dalle-playground_dalle-backend 3/9] RUN apt-get update && apt-get install -y python3-pip                                                                1.2s
------
 > [dalle-playground_dalle-backend 3/9] RUN apt-get update && apt-get install -y python3-pip:
#0 1.092 exec /bin/sh: exec format error
------
failed to solve: executor failed running [/bin/sh -c apt-get update && apt-get install -y python3-pip]: exit code: 1

Error Importing Flax Module

I've followed all the steps outlined in the readme, including jaxlib and pytorch. This is python version 3.9.6

(venv) PS D:\DallE> .\venv\Scripts\python.exe .\dalle-playground\backend\app.py
--> Starting DALL-E Server. This might take up to two minutes.
2022-06-12 23:52:23.958841: W external/org_tensorflow/tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2022-06-12 23:52:23.974713: W external/org_tensorflow/tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
Traceback (most recent call last):
  File "D:\DallE\dalle-playground\backend\app.py", line 13, in <module>
    from dalle_model import DalleModel
  File "D:\DallE\dalle-playground\backend\dalle_model.py", line 11, in <module>
    from dalle_mini import DalleBart, DalleBartProcessor
  File "D:\DallE\venv\lib\site-packages\dalle_mini\__init__.py", line 3, in <module>
    from .model import DalleBart, DalleBartProcessor
  File "D:\DallE\venv\lib\site-packages\dalle_mini\model\__init__.py", line 2, in <module>
    from .modeling import DalleBart
  File "D:\DallE\venv\lib\site-packages\dalle_mini\model\modeling.py", line 28, in <module>
    from flax.linen import partitioning as nn_partitioning
ImportError: cannot import name 'partitioning' from 'flax.linen' (D:\DallE\venv\lib\site-packages\flax\linen\__init__.py)

[OOM] Does the maker know what those 'partial(jax.pmap...' actually do?

Or just mindlessly copypasta?

I tried to solve the OOM problem and found out that those replicate(...) /flax.jax_utils.replicate are the major cause.
That replicate thing literally doubled the ram usage and made mega-fp16 to crash on a 12gb colab vm.

Till now what I know is:

  1. To remove 'replicate', function prefix like @partial(jax.pmap, axis_name="batch", static_broadcasted_argnums=(0)), @partial(jax.pmap, axis_name="batch", static_broadcasted_argnums=(3, 4, 5, 6, 7)) should also be removed. Here's a non-replicate example of p_decode:
import cv2
from io import BytesIO
import random
from functools import partial

import jax
import numpy as np
import jax.numpy as jnp
from PIL import Image

from vqgan_jax.modeling_flax_vqgan import VQModel

from flax.jax_utils import replicate



# VQGAN model
VQGAN_REPO = "dalle-mini/vqgan_imagenet_f16_16384"
VQGAN_COMMIT_ID = "e93a26e7707683d349bf5d5c41c5b0ef69b677a9"



vqgan = VQModel.from_pretrained(VQGAN_REPO, revision=VQGAN_COMMIT_ID)

'''
without @partial(jax.pmap... 'indices' shape should be (?,256), not (1,?,256)
'''
def p_decode(indices, params):
  return vqgan.decode_code(indices, params=params)

'''
encoded_images is a 1D seq generated by DalleBart,generate()

'''
def generate_images_from_ndarray(encoded_images):
  encoded_images=encoded_images.reshape((-1,256))
  images = []
  # decode images
  decoded_images = p_decode(encoded_images, vqgan.params)
  decoded_images = decoded_images.clip(0.0, 1.0).reshape((-1, 256, 256, 3))
  for img in decoded_images:
      images.append(Image.fromarray(np.asarray(img * 255, dtype=np.uint8)))
        
  return images
  1. Codes above works. By the 'should be (?,256), not (1,?,256)' rule above, I remove the prefix above p_generate, and modify tokenize_prompt(self, prompt: str) to:
    def tokenize_prompt(self, prompt: str):
        tokenized_prompt = self.processor([prompt])
        zet = replicate(tokenized_prompt)
        for ky in zet:
          zet[ky]=zet[ky][0]
        return zet

and generate_images to:

def generate_images(self, prompt: str, num_predictions: int):
        tokenized_prompt = self.tokenize_prompt(prompt)

        # create a random key
        seed = random.randint(0, 2 ** 32 - 1)
        key = jax.random.PRNGKey(seed)

        # generate images
        images = []
        # get a new key
        key, subkey = jax.random.split(key)
        
        encoded_images = p_generate(
            tokenized_prompt,
            subkey,
            self.params,
            GEN_TOP_K,
            GEN_TOP_P,
            TEMPERATURE,
            COND_SCALE,
            self.model
        )

        # remove BOS
        encoded_images = encoded_images.sequences[..., 1:]

        # decode images
        decoded_images = p_decode(self.vqgan, encoded_images[0], self.vqgan_params)
        decoded_images = decoded_images.clip(0.0, 1.0).reshape((-1, 256, 256, 3))
        for img in decoded_images:
            images.append(Image.fromarray(np.asarray(img * 255, dtype=np.uint8)))

        return images

But no luck by now.

If the maker of this actually understand his codes (guess not, otherwise this line 'for i in range(max(num_predictions // jax.device_count(), 1))' should have been optimized away, since 'dalle_model.generate_images("warm-up", 1)' in app.py),

please tell us how to remove these pmap/batch thing which made for cluster VMs and NOT for standalone VM enviroment like free-tier Google Colab GPU.

INTERNAL: All algorithms tried for %cudnn-conv

Running on nixOS with CUDA.

dalle-backend      | Original error: INTERNAL: All algorithms tried for %cudnn-conv = (f32[1,256,256,128]{2,1,3,0}, u8[0]{0}) custom-call(f32[1,256,256,3]{2,1,3,0} %copy, f32[3,3,3,128]{1,0,2,3} %copy.1), window={size=3x3 pad=1_1x1_1}, dim_labels=b01f_01io->b01f, custom_call_target="__cudnn$convForward", metadata={op_name="jit(conv_general_dilated)/jit(main)/conv_general_dilated[window_strides=(1, 1) padding=((1, 1), (1, 1)) lhs_dilation=(1, 1) rhs_dilation=(1, 1) dimension_numbers=ConvDimensionNumbers(lhs_spec=(0, 3, 1, 2), rhs_spec=(3, 2, 0, 1), out_spec=(0, 3, 1, 2)) feature_group_count=1 batch_group_count=1 lhs_shape=(1, 256, 256, 3) rhs_shape=(3, 3, 3, 128) precision=None preferred_element_type=None]" source_file="/usr/local/lib/python3.8/dist-packages/flax/linen/linear.py" source_line=406}, backend_config="{\"conv_result_scale\":1,\"activation_mode\":\"0\",\"side_input_scale\":0}" failed. Falling back to default algorithm.  Per-algorithm errors:
dalle-backend      |   Profiling failure on cuDNN engine eng30{k4=1,k5=0,k6=0,k7=0,k2=2}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng34{k4=1,k5=1,k6=0,k7=0,k2=0,k19=0}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng30{k2=1,k4=2,k5=1,k6=0,k7=0}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng34{k2=2,k19=0,k4=1,k5=0,k6=0,k7=0}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng34{k2=0,k19=0,k4=2,k5=1,k6=0,k7=0}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng34{k2=2,k19=0,k4=2,k5=0,k6=0,k7=0}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng30{k4=2,k5=0,k6=0,k7=0,k2=2}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng30{k2=0,k4=2,k5=1,k6=0,k7=0}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng30{k4=3,k5=1,k6=0,k7=0,k2=1}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng42{k4=1,k5=0,k6=0,k7=0,k2=2}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng0{}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng1{}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng2{}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng4{}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng6{}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng12{}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng28{}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng30{}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng31{}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng34{}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'
dalle-backend      |   Profiling failure on cuDNN engine eng42{}: UNKNOWN: CUDNN_STATUS_EXECUTION_FAILED
dalle-backend      | in external/org_tensorflow/tensorflow/stream_executor/cuda/cuda_dnn.cc(4369): 'status'

How to run mega or mega-full with docker build?

Have a working Docker build on Win 11. When I load the model and start the server using docker-compose up, everything builds and works properly but it automatically selects Mini as the model.

Fairly new to Docker -- how can I start the app.py with the mega or mega-full flag in a Docker build? If it were installed locally it would just be python app.py 8080 mega.

DALL-E server doesn't work with AMD GPU

Running on Ubuntu 20.4 LTS native, with AMD RX 6600 XT GPU. Local development - no docker

GPU works with OpenGL as I can run glmark2 and Blender using OpenGL and my GPU, but can't seem to run with DALL-E server.

$ python3 app.py 8080 --> Starting DALL-E Server. This might take up to two minutes. "hipErrorNoBinaryForGpu: Unable to find code object for all current devices!" Aborted (core dumped)

Any help would be great!

IndexError: list index out of range`

Hello! Help me with this error please

`
�[34m�[1mwandb�[39m�[22m: Downloading large artifact wzoooa1c:latest, 1672.79MB. 7 files... Done. 0:0:0
Downloading: 100%|██████████████████████████████████████████████████████████████████████| 434/434 [00:00<00:00, 130kB/s]

Downloading: 100%|███████████████████████████████████████████████████████████████████| 290M/290M [00:25<00:00, 11.8MB/s]

�[34m�[1mwandb�[39m�[22m: Downloading large artifact wzoooa1c:latest, 1672.79MB. 7 files... Done. 0:0:0

Downloading: 100%|█████████████████████████████████████████████████████████████████| 33.8M/33.8M [00:02<00:00, 11.9MB/s]
0%| | 0/1 [00:00<?, ?it/s]
--> DALL-E Server is up and running!
Traceback (most recent call last):
File "app.py", line 152, in
app.run(host="0.0.0.0", port=int(sys.argv[1]), debug=False)
IndexError: list index out of range`

ImportError: cannot import name 'escape' from 'jinja2'

After following the instructions and running app.py in the backend folder I get this error message:

Traceback (most recent call last):
File "/home/griffisu/AI/dalle-playground/backend/app.py", line 16, in
from flask import Flask, request, jsonify
File "/home/griffisu/AI/dalle-playground/backend/dalleplay/lib/python3.9/site-packages/flask/init.py", line 14, in
from jinja2 import escape
ImportError: cannot import name 'escape' from 'jinja2' (/home/griffisu/AI/dalle-playground/backend/dalleplay/lib/python3.9/site-packages/jinja2/init.py)

Running Ubuntu with a 3090RTX
Driver version 510.60.02
CUDA version 11.6
if that helps.

Any ideas? Thanks!

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.