import subprocess import sys from functools import lru_cache from setuptools import find_packages, setup is_for_windows = len(sys.argv) >= 3 and sys.argv[2].startswith("--plat-name=win") if is_for_windows: scripts = None entry_points = { "console_scripts": [ "imagine=imaginairy.cli.main:imagine_cmd", "aimg=imaginairy.cli.main:aimg", ], } else: scripts = ["imaginairy/bin/aimg", "imaginairy/bin/imagine"] entry_points = None @lru_cache() def get_git_revision_hash() -> str: try: return ( subprocess.check_output(["git", "rev-parse", "HEAD"]) .decode("ascii") .strip() ) except FileNotFoundError: return "no-git" revision_hash = get_git_revision_hash() with open("README.md", encoding="utf-8") as f: readme = f.read() readme = readme.replace( '=0.4.4", # for vendored blip "fastapi", "ftfy", # for vendored clip # 2.0.0 produced garbage images on MacOS "torch>=1.13.1,<2.0.0", "numpy", "tqdm", "diffusers", "imageio>=2.9.0", "Pillow>=9.1.0", "psutil", # 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", "omegaconf>=2.1.1", "open-clip-torch", "opencv-python", "pydantic", "requests", "einops>=0.3.0", "safetensors", "timm>=0.4.12,!=0.9.0,!=0.9.1", # for vendored blip "torchdiffeq", "transformers>=4.19.2", "torchmetrics>=0.6.0", "torchvision>=0.13.1", "kornia>=0.6", "uvicorn", "xformers>=0.0.16; sys_platform!='darwin' and platform_machine!='aarch64'", ], )