update replicate, clear cuda cache if cuda available

This commit is contained in:
Brett Kuprel 2022-07-04 07:28:44 -04:00
parent 256fd1aab0
commit a21ea6ea14
4 changed files with 13 additions and 13 deletions

12
README.rst vendored
View File

@ -4,13 +4,13 @@ min(DALL·E)
|Open In Colab|   |Replicate|   |Join us on Discord| |Open In Colab|   |Replicate|   |Join us on Discord|
This is a fast, minimal implementation of Boris Daymas `DALL·E This is a fast, minimal implementation of Boris Daymas `DALL·E
Mini <https://github.com/borisdayma/dalle-mini>`__. It has been stripped Mega <https://github.com/borisdayma/dalle-mini>`__. It has been stripped
down for inference and converted to PyTorch. The only third party down for inference and converted to PyTorch. The only third party
dependencies are numpy, requests, pillow and torch. dependencies are numpy, requests, pillow and torch.
To generate a 3x3 grid of DALL·E Mega images it takes - **35 seconds** It takes - **35 seconds** to generate a 3x3 grid with a P100 in Colab -
with a P100 in Colab - **15 seconds** with an A100 on Replicate - **16 seconds** to generate a 4x4 grid with an A100 on Replicate -
**TBD** with an H100 (@NVIDIA?) **TBD** to generate a 4x4 grid with an H100 (@NVIDIA?)
The flax model and code for converting it to torch can be found The flax model and code for converting it to torch can be found
`here <https://github.com/kuprel/min-dalle-flax>`__. `here <https://github.com/kuprel/min-dalle-flax>`__.
@ -40,7 +40,7 @@ not already there. Once everything has finished initializing, call
.. code:: python .. code:: python
text = 'Dali painting of WallE' text = 'Dali painting of WALL·E'
image = model.generate_image(text, seed=0, grid_size=4) image = model.generate_image(text, seed=0, grid_size=4)
display(image) display(image)
@ -81,7 +81,7 @@ Use ``image_from_text.py`` to generate images from the command line.
.. code:: bash .. code:: bash
$ python image_from_text.py --text='artificial intelligence' --seed=7 $ python image_from_text.py --text='artificial intelligence' --no-mega --seed=7
.. code:: bash .. code:: bash

2
cog.yaml vendored
View File

@ -6,7 +6,7 @@ build:
- "libgl1-mesa-glx" - "libgl1-mesa-glx"
- "libglib2.0-0" - "libglib2.0-0"
python_packages: python_packages:
- "min-dalle==0.2.13" - "min-dalle==0.2.14"
run: run:
- pip install torch==1.10.0+cu113 -f https://download.pytorch.org/whl/torch_stable.html - pip install torch==1.10.0+cu113 -f https://download.pytorch.org/whl/torch_stable.html

View File

@ -11,17 +11,17 @@ class Predictor(BasePredictor):
self, self,
text: str = Input( text: str = Input(
description='Text', description='Text',
default='court sketch of godzilla on trial' default='Dali painting of WALL·E'
), ),
seed: int = Input( seed: int = Input(
description='Seed', description='Set the seed to a positive number for reproducible results',
default=6 default=-1
), ),
grid_size: int = Input( grid_size: int = Input(
description='Grid Size', description='Size of the image grid',
ge=1, ge=1,
le=4, le=4,
default=3 default=4
) )
) -> Path: ) -> Path:
image = self.model.generate_image(text, seed, grid_size=grid_size) image = self.model.generate_image(text, seed, grid_size=grid_size)

View File

@ -5,7 +5,7 @@ setuptools.setup(
name='min-dalle', name='min-dalle',
description = 'min(DALL·E)', description = 'min(DALL·E)',
long_description=(Path(__file__).parent / "README.rst").read_text(), long_description=(Path(__file__).parent / "README.rst").read_text(),
version='0.2.13', version='0.2.14',
author='Brett Kuprel', author='Brett Kuprel',
author_email='brkuprel@gmail.com', author_email='brkuprel@gmail.com',
url='https://github.com/kuprel/min-dalle', url='https://github.com/kuprel/min-dalle',