models_root command line argument

This commit is contained in:
Brett Kuprel 2022-07-01 23:39:48 -04:00
parent 21c633b56e
commit 4b632555b5
4 changed files with 13 additions and 6 deletions

1
.gitignore vendored
View File

@ -14,3 +14,4 @@
*.egg *.egg
dist dist
build build
README

8
README.md vendored
View File

@ -37,14 +37,14 @@ text = "a comfy chair that looks like an avocado"
image = model.generate_image(text) image = model.generate_image(text)
display(image) display(image)
``` ```
![Avocado Armchair](examples/avocado_armchair.png) ![Avocado Armchair](https://github.com/kuprel/min-dalle/raw/main/examples/avocado_armchair.png)
```python ```python
text = "trail cam footage of gollum eating watermelon" text = "trail cam footage of gollum eating watermelon"
image = model.generate_image(text, seed=1) image = model.generate_image(text, seed=1)
display(image) display(image)
``` ```
![Gollum Trailcam](examples/gollum_trailcam.png) ![Gollum Trailcam](https://github.com/kuprel/min-dalle/raw/main/examples/gollum_trailcam.png)
### Command Line ### Command Line
@ -54,9 +54,9 @@ Use `image_from_text.py` to generate images from the command line.
```bash ```bash
$ python image_from_text.py --text='artificial intelligence' --seed=7 $ python image_from_text.py --text='artificial intelligence' --seed=7
``` ```
![Artificial Intelligence](examples/artificial_intelligence.png) ![Artificial Intelligence](https://github.com/kuprel/min-dalle/raw/main/examples/artificial_intelligence.png)
```bash ```bash
$ python image_from_text.py --text='court sketch of godzilla on trial' --mega $ python image_from_text.py --text='court sketch of godzilla on trial' --mega
``` ```
![Godzilla Trial](examples/godzilla_on_trial.png) ![Godzilla Trial](https://github.com/kuprel/min-dalle/raw/main/examples/godzilla_on_trial.png)

View File

@ -12,6 +12,7 @@ parser.set_defaults(mega=False)
parser.add_argument('--text', type=str, default='alien life') parser.add_argument('--text', type=str, default='alien life')
parser.add_argument('--seed', type=int, default=-1) parser.add_argument('--seed', type=int, default=-1)
parser.add_argument('--image_path', type=str, default='generated') parser.add_argument('--image_path', type=str, default='generated')
parser.add_argument('--models_root', type=str, default='pretrained')
parser.add_argument('--token_count', type=int, default=256) # for debugging parser.add_argument('--token_count', type=int, default=256) # for debugging
@ -38,11 +39,12 @@ def generate_image(
text: str, text: str,
seed: int, seed: int,
image_path: str, image_path: str,
models_root: str,
token_count: int token_count: int
): ):
model = MinDalle( model = MinDalle(
is_mega=is_mega, is_mega=is_mega,
models_root='pretrained', models_root=models_root,
is_reusable=False, is_reusable=False,
sample_token_count=token_count, sample_token_count=token_count,
is_verbose=True is_verbose=True
@ -65,5 +67,6 @@ if __name__ == '__main__':
text=args.text, text=args.text,
seed=args.seed, seed=args.seed,
image_path=args.image_path, image_path=args.image_path,
models_root=args.models_root,
token_count=args.token_count token_count=args.token_count
) )

View File

@ -1,11 +1,14 @@
import setuptools import setuptools
from pathlib import Path
setuptools.setup( setuptools.setup(
name='min-dalle', name='min-dalle',
description = 'min(DALL·E)', description = 'min(DALL·E)',
version='0.2.0', long_description=(Path(__file__).parent / "README").read_text(),
version='0.2.5',
author='Brett Kuprel', author='Brett Kuprel',
author_email='brkuprel@gmail.com', author_email='brkuprel@gmail.com',
url='https://github.com/kuprel/min-dalle',
packages=[ packages=[
'min_dalle', 'min_dalle',
'min_dalle.models' 'min_dalle.models'