2023-02-23 09:28:56 +00:00
|
|
|
import subprocess
|
2023-02-06 03:09:27 +00:00
|
|
|
import sys
|
2023-02-23 09:28:56 +00:00
|
|
|
from functools import lru_cache
|
2023-02-06 03:09:27 +00:00
|
|
|
|
2022-09-11 20:58:14 +00:00
|
|
|
from setuptools import find_packages, setup
|
2022-09-08 03:59:30 +00:00
|
|
|
|
2023-02-06 03:09:27 +00:00
|
|
|
is_for_windows = len(sys.argv) >= 3 and sys.argv[2].startswith("--plat-name=win")
|
|
|
|
|
|
|
|
if is_for_windows:
|
|
|
|
scripts = None
|
2023-12-12 06:29:36 +00:00
|
|
|
entry_points: dict | None = {
|
2023-02-06 03:09:27 +00:00
|
|
|
"console_scripts": [
|
2023-02-25 20:32:50 +00:00
|
|
|
"imagine=imaginairy.cli.main:imagine_cmd",
|
|
|
|
"aimg=imaginairy.cli.main:aimg",
|
2023-02-06 03:09:27 +00:00
|
|
|
],
|
|
|
|
}
|
|
|
|
else:
|
2023-12-15 20:40:14 +00:00
|
|
|
scripts = ["imaginairy/cli/bin/aimg", "imaginairy/cli/bin/imagine"]
|
2023-02-06 03:09:27 +00:00
|
|
|
entry_points = None
|
|
|
|
|
|
|
|
|
2023-09-29 08:13:50 +00:00
|
|
|
@lru_cache
|
2023-02-23 09:28:56 +00:00
|
|
|
def get_git_revision_hash() -> str:
|
2023-05-20 23:07:27 +00:00
|
|
|
try:
|
|
|
|
return (
|
|
|
|
subprocess.check_output(["git", "rev-parse", "HEAD"])
|
|
|
|
.decode("ascii")
|
|
|
|
.strip()
|
|
|
|
)
|
|
|
|
except FileNotFoundError:
|
|
|
|
return "no-git"
|
2023-02-23 09:28:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
revision_hash = get_git_revision_hash()
|
|
|
|
|
2023-01-02 04:14:22 +00:00
|
|
|
with open("README.md", encoding="utf-8") as f:
|
2022-09-12 04:36:14 +00:00
|
|
|
readme = f.read()
|
2023-02-23 09:28:56 +00:00
|
|
|
readme = readme.replace(
|
|
|
|
'<img src="',
|
|
|
|
f'<img src="https://raw.githubusercontent.com/brycedrennan/imaginAIry/{revision_hash}/',
|
|
|
|
)
|
2022-09-12 04:36:14 +00:00
|
|
|
|
2022-09-08 03:59:30 +00:00
|
|
|
setup(
|
2022-09-12 04:36:14 +00:00
|
|
|
name="imaginAIry",
|
|
|
|
author="Bryce Drennan",
|
2022-09-12 04:47:14 +00:00
|
|
|
# author_email="b r y p y d o t io",
|
2024-01-02 04:01:53 +00:00
|
|
|
version="14.0.0b8",
|
2023-05-05 09:59:53 +00:00
|
|
|
description="AI imagined images. Pythonic generation of images.",
|
2022-09-12 04:36:14 +00:00
|
|
|
long_description=readme,
|
|
|
|
long_description_content_type="text/markdown",
|
2022-09-12 04:47:14 +00:00
|
|
|
project_urls={
|
|
|
|
"Documentation": "https://github.com/brycedrennan/imaginAIry/blob/master/README.md",
|
|
|
|
"Source": "https://github.com/brycedrennan/imaginAIry",
|
|
|
|
},
|
2022-09-10 07:32:31 +00:00
|
|
|
packages=find_packages(include=("imaginairy", "imaginairy.*")),
|
2023-02-06 03:09:27 +00:00
|
|
|
scripts=scripts,
|
|
|
|
entry_points=entry_points,
|
2022-09-18 13:07:07 +00:00
|
|
|
package_data={
|
|
|
|
"imaginairy": [
|
|
|
|
"configs/*.yaml",
|
2023-11-25 23:44:44 +00:00
|
|
|
"weight_management/maps/*.json",
|
2023-01-22 01:36:47 +00:00
|
|
|
"data/*.*",
|
2023-12-15 20:40:14 +00:00
|
|
|
"cli/bin/*.*",
|
2023-11-25 23:44:44 +00:00
|
|
|
"http_app/stablestudio/dist/*.*",
|
|
|
|
"http_app/stablestudio/dist/assets/*.*",
|
|
|
|
"http_app/stablestudio/dist/LICENSE",
|
2022-10-09 01:41:56 +00:00
|
|
|
"enhancers/phraselists/*.txt",
|
2022-09-18 13:07:07 +00:00
|
|
|
"vendored/clip/*.txt.gz",
|
|
|
|
"vendored/clipseg/*.pth",
|
2022-09-21 00:05:11 +00:00
|
|
|
"vendored/blip/configs/*.*",
|
feature: prompt expansion (#51)
You can use `{}` to randomly pull values from lists. A list of values separated by `|` and enclosed in `{ }` will be randomly drawn from in a non-repeating fashion. Values that are surrounded by `_ _` will pull from a phrase list of the same name. Folders containing .txt phraselist files may be specified via
`--prompt_library_path`. The option may be specified multiple times. Built-in categories:
3d-term, adj-architecture, adj-beauty, adj-detailed, adj-emotion, adj-general, adj-horror, animal, art-movement,
art-site, artist, artist-botanical, artist-surreal, aspect-ratio, bird, body-of-water, body-pose, camera-brand,
camera-model, color, cosmic-galaxy, cosmic-nebula, cosmic-star, cosmic-term, dinosaur, eyecolor, f-stop,
fantasy-creature, fantasy-setting, fish, flower, focal-length, food, fruit, games, gen-modifier, hair, hd,
iso-stop, landscape-type, national-park, nationality, neg-weight, noun-beauty, noun-fantasy, noun-general,
noun-horror, occupation, photo-term, pop-culture, pop-location, punk-style, quantity, rpg-item, scenario-desc,
skin-color, spaceship, style, tree-species, trippy, world-heritage-site
Examples:
`imagine "a {red|black} dog" -r 2 --seed 0` will generate both "a red dog" and "a black dog"
`imagine "a {_color_} dog" -r 4 --seed 0` will generate four, different colored dogs. The colors will eb pulled from an included
phraselist of colors.
`imagine "a {_spaceship_|_fruit_|hot air balloon}. low-poly" -r 4 --seed 0` will generate images of spaceships or fruits or a hot air balloon
Credit to [noodle-soup-prompts](https://github.com/WASasquatch/noodle-soup-prompts/) where most, but not all, of the wordlists originate.
2022-10-09 01:34:35 +00:00
|
|
|
"vendored/noodle_soup_prompts/*.*",
|
2022-10-09 01:41:56 +00:00
|
|
|
"vendored/noodle_soup_prompts/LICENSE",
|
2022-09-18 13:07:07 +00:00
|
|
|
]
|
|
|
|
},
|
2022-09-08 03:59:30 +00:00
|
|
|
install_requires=[
|
2023-09-09 20:21:53 +00:00
|
|
|
"click>=8.0.0",
|
|
|
|
"click-help-colors>=0.9.1",
|
|
|
|
"click-shell>=2.0",
|
2022-09-16 15:18:50 +00:00
|
|
|
"protobuf != 3.20.2, != 3.19.5",
|
2023-09-09 20:21:53 +00:00
|
|
|
"facexlib>=0.2.1.1",
|
2022-09-20 04:15:38 +00:00
|
|
|
"fairscale>=0.4.4", # for vendored blip
|
2023-09-09 20:21:53 +00:00
|
|
|
"fastapi>=0.70.0",
|
|
|
|
"ftfy>=6.0.1", # for vendored clip
|
|
|
|
# 2.0.0 produced garbage images on macOS
|
2023-11-16 03:46:56 +00:00
|
|
|
"torch>=2.1.0",
|
2023-09-09 20:21:53 +00:00
|
|
|
# https://numpy.org/neps/nep-0029-deprecation_policy.html
|
|
|
|
"numpy>=1.19.0,<1.26.0",
|
|
|
|
"tqdm>=4.64.0",
|
|
|
|
"diffusers>=0.3.0",
|
2023-01-09 04:45:58 +00:00
|
|
|
"imageio>=2.9.0",
|
2023-05-20 23:44:35 +00:00
|
|
|
"Pillow>=9.1.0",
|
2023-09-09 20:21:53 +00:00
|
|
|
"psutil>5.7.3",
|
2023-03-17 16:40:05 +00:00
|
|
|
# 2.0.0 need to fix `ImportError: cannot import name 'rank_zero_only' from 'pytorch_lightning.utilities.distributed' `
|
|
|
|
"pytorch-lightning>=1.4.2,<2.0.0",
|
2023-01-09 04:45:58 +00:00
|
|
|
"omegaconf>=2.1.1",
|
2023-09-09 20:21:53 +00:00
|
|
|
"open-clip-torch>=2.0.0",
|
|
|
|
"opencv-python>=4.4.0.46",
|
2023-09-09 18:21:02 +00:00
|
|
|
# need to migration to 2.0
|
2023-09-11 02:33:59 +00:00
|
|
|
"pydantic>=2.3.0",
|
2023-09-09 20:21:53 +00:00
|
|
|
"requests>=2.28.1",
|
2023-11-16 03:46:56 +00:00
|
|
|
"refiners>=0.2.0",
|
2023-01-09 04:45:58 +00:00
|
|
|
"einops>=0.3.0",
|
2023-09-09 20:21:53 +00:00
|
|
|
"safetensors>=0.2.1",
|
2023-09-09 18:21:02 +00:00
|
|
|
# scipy is a sub dependency but v1.11 doesn't support python 3.8. https://docs.scipy.org/doc/scipy/dev/toolchain.html#numpy
|
|
|
|
"scipy<1.11",
|
2023-05-13 15:22:53 +00:00
|
|
|
"timm>=0.4.12,!=0.9.0,!=0.9.1", # for vendored blip
|
2023-09-09 20:21:53 +00:00
|
|
|
"torchdiffeq>=0.2.0",
|
2023-01-09 04:45:58 +00:00
|
|
|
"torchmetrics>=0.6.0",
|
2022-09-10 07:32:31 +00:00
|
|
|
"torchvision>=0.13.1",
|
2023-09-29 06:32:30 +00:00
|
|
|
"transformers>=4.19.2",
|
2023-11-25 23:44:44 +00:00
|
|
|
"triton>=2.0.0; sys_platform!='darwin' and platform_machine!='aarch64'",
|
2023-01-09 04:45:58 +00:00
|
|
|
"kornia>=0.6",
|
2023-09-09 20:21:53 +00:00
|
|
|
"uvicorn>=0.16.0",
|
2023-11-29 06:35:49 +00:00
|
|
|
# "xformers>=0.0.22; sys_platform!='darwin' and platform_machine!='aarch64'",
|
2022-09-08 03:59:30 +00:00
|
|
|
],
|
2023-09-09 21:50:46 +00:00
|
|
|
# don't specify maximum python versions as it can cause very long dependency resolution issues as the resolver
|
|
|
|
# goes back to older versions of packages that didn't specify a maximum
|
|
|
|
# https://discuss.python.org/t/requires-python-upper-limits/12663/75
|
|
|
|
# https://github.com/brycedrennan/imaginAIry/pull/341#issuecomment-1574723908
|
2023-11-25 23:44:44 +00:00
|
|
|
python_requires=">=3.10",
|
2022-09-08 03:59:30 +00:00
|
|
|
)
|