borisdayma / dalle-mini

DALL·E Mini - Generate images from a text prompt
https://www.craiyon.com
Apache License 2.0
14.75k stars 1.21k forks source link

Notebook failures on Windows using Docker #320

Open adrianbravo opened 1 year ago

adrianbravo commented 1 year ago

I ran into a couple of issues trying to get the Docker machine generating images on Windows. I'll document both of them, and how I solved them.

First, there were recent changes to the transformers package that causes failures at this step in the notebook:

    encoded_images = p_generate(
        tokenized_prompt,
        shard_prng_key(subkey),
        params,
        gen_top_k,
        gen_top_p,
        temperature,
        cond_scale,
    )

This is downstream of a recent change that was released on tag v4.26.0, PR concerned: https://github.com/huggingface/transformers/pull/20388. What's happening is that a call to _get_logits_warper is failing because the parameters accepted have changed to expect a GenerationConfig object rather than various kwargs. The fix here looks fairly straightforward, import GenerationConfig and wrap the kwargs being passed in to _get_logits_warper with that class for instatiation.

Alternatively, the fix I performed locally was to just pip uninstall transformers and pip install transformers==4.25.1.

Second, I faced an issue with the CUDA version being incompatible. This appears to be possibly fixable in Docker, although it's not as apparent to me exactly how I would do it. Locally, I uninstalled the package that was added with this command: RUN pip install --upgrade "jax[cuda]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html which came out as jaxlib-0.4.2+cuda11.cudnn86 (see: https://github.com/borisdayma/dalle-mini/blob/main/Docker/Dockerfile#L9) and instead installed jaxlib-0.4.2+cuda11.cudnn82. I would have tried jaxlib-0.4.2+cuda11.cudnn84 because the conflict on my machine was between 8.6.0 and 8.4.0, but that package did not exist so I went down further to "cudnn82".

I can try to submit my own PR for this, although obviously it'll take me a bit to figure out how development is done on this repo.

Anyway, thanks for building this and making it fairly simple to set up!

borisdayma commented 1 year ago

Oh that's very interesting. I recently updated the dalle-mini package on pypi so hopefully it solves the first error if you upgrade.

For the docker error it's always good if you have a fix to submit for the docker script.

PlaidJedi commented 1 year ago

I'm experiencing this same issue, I was able to resolve the transformers by following your example. Unsure how to install cudnn82

borisdayma commented 1 year ago

I think it should now work. Can you confirm? I fixed transformers version and updated pypi