saharmor / dalle-playground

A playground to generate images from any text prompt using Stable Diffusion (past: using DALL-E Mini)
MIT License
2.77k stars 596 forks source link

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

Open ethanproia opened 2 years ago

ethanproia commented 2 years ago

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.

loofou commented 2 years ago

You can manipulate the Dockerfile in backend. Last line can be adjusted and you can add "mega" at the end. Then run 'docker compose build' to rebuild the images.

jujaga commented 2 years ago

Would be good to consider allowing mini, mega and mega_full to be parsed as an environment variable. That way you can optionally pass that into the container through higher layers including the docker compose manifest without having to rebuild.

EwolBash commented 2 years ago

You can manipulate the Dockerfile in backend. Last line can be adjusted and you can add "mega" at the end. Then run 'docker compose build' to rebuild the images.

Excuse me, but where do I put 'mega' in the compose file, if so where abouts? Sorry I'm really not good with docker.

ethanproia commented 2 years ago

You can manipulate the Dockerfile in backend. Last line can be adjusted and you can add "mega" at the end. Then run 'docker compose build' to rebuild the images.

Thank you - tried this and rebuilt but anything other than mini wouldn't run on my system.

olivercoad commented 2 years ago

just add command: python3 app.py 8080 mega to the dalle-backend service in the docker-compose.yml file.

Invertisment commented 2 years ago

Why not a parameter of the API... why are you limiting yourselves... Why not resolution then?

hit0wnzzz commented 2 years ago

Having similar issue after adding : python app.py 8080 mega to backend's dockerfile

`(base) root@ubuntu-Sword-15-A11UE:/home/ubuntu/dalle-playground# docker logs 6a78133de5b4 --> Starting DALL-E Server. This might take up to two minutes. Exception in thread Thread-11: Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/wandb/apis/normalize.py", line 22, in wrapper return func(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/wandb/sdk/internal/internal_api.py", line 1429, in upload_urls run = query_result["model"]["bucket"] TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/usr/local/lib/python3.8/dist-packages/wandb/filesync/upload_job.py", line 56, in run success = self.push() File "/usr/local/lib/python3.8/dist-packages/wandb/filesync/uploadjob.py", line 107, in push , upload_headers, result = self._api.upload_urls(project, [self.save_name]) File "/usr/local/lib/python3.8/dist-packages/wandb/apis/normalize.py", line 58, in wrapper raise CommError(message, err).with_traceback(sys.exc_info()[2]) File "/usr/local/lib/python3.8/dist-packages/wandb/apis/normalize.py", line 22, in wrapper return func(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/wandb/sdk/internal/internal_api.py", line 1429, in upload_urls run = query_result["model"]["bucket"] wandb.errors.CommError: 'NoneType' object is not subscriptable Some of the weights of DalleBart were initialized in float16 precision from the model checkpoint at /tmp/tmpzds3u049: [('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. Killed`

If i add mega-full, it runs the mini model

ethanproia commented 2 years ago

Having similar issue after adding : python app.py 8080 mega to backend's dockerfile

`(base) root@ubuntu-Sword-15-A11UE:/home/ubuntu/dalle-playground# docker logs 6a78133de5b4...

If i add mega-full, it runs the mini model

Having identical error and behavior.

hit0wnzzz commented 2 years ago

Having similar issue after adding : python app.py 8080 mega to backend's dockerfile `(base) root@ubuntu-Sword-15-A11UE:/home/ubuntu/dalle-playground# docker logs 6a78133de5b4... If i add mega-full, it runs the mini model

Having identical error and behavior.

got mega running at home with a rtx 2080. using windows docker. when trying mega-full option, it just goes back to mini.

lugia19 commented 2 years ago

Still haven't managed to get mega running myself, the model just fails to download.

trekkie1701c commented 2 years ago

Having similar issue after adding : python app.py 8080 mega to backend's dockerfile `(base) root@ubuntu-Sword-15-A11UE:/home/ubuntu/dalle-playground# docker logs 6a78133de5b4... If i add mega-full, it runs the mini model

Having identical error and behavior.

got mega running at home with a rtx 2080. using windows docker. when trying mega-full option, it just goes back to mini.

Does mega_full work (as opposed to mega-full)?

hit0wnzzz commented 2 years ago

Does mega_full work (as opposed to mega-full)?

Same as behavior as mega-full, just tested.

macsj200 commented 2 years ago

I'm also having issues with the wandb calls. According to this comment it means "there is no run" for the project. I'm not very familiar with wandb, but from the log output it does appear to have created a "run", so I'm not sure what the issue is.

Edit: I also found this SO question that seems to be running into the same wandb issue.

ethanproia commented 2 years ago

Wondering if this could be a system RAM limit issue? Trying to run mega, but my test system only has 16GB of RAM and docker keeps killing the container and giving me a code 137, which I understand can be a memory limit error? Sure enough, looking at my system monitor, my RAM usage is hovering right around 14.5GB and then spikes to just under 16GB and right back down when docker spits the exit code.

EwolBash commented 2 years ago

mega works fine for me, mega_full crashes due to me only having 8GB vram (3070). Wish I had bought a better GPU now.

rodti commented 2 years ago

just add command: python3 app.py 8080 mega to the dalle-backend service in the docker-compose.yml file.

This worked for me but I had to use the correct formats for the options:

command: python3 app.py --port 8080 --model_version mega --save_to_disk false