From 2a26495653bbe8bca2abb5ecc0640e676fd5fe59 Mon Sep 17 00:00:00 2001 From: Bryce Date: Sat, 20 May 2023 16:07:27 -0700 Subject: [PATCH] fix: package will not try to install xformers on `aarch64` machines. While this will allow the dockerfile to build on MacOS M1, [torch will not be able to use the M1 when generating images.](https://github.com/pytorch/pytorch/issues/81224#issuecomment-1499741152) --- .dockerignore | 4 +++- README.md | 8 +++++--- imaginairy/http/app.py | 2 +- setup.py | 11 +++++++++-- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.dockerignore b/.dockerignore index ff63666..59b8db9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -18,4 +18,6 @@ coverage.xml .mypy_cache .pytest_cache .hypothesis -.DS_Store \ No newline at end of file +.DS_Store +other +outputs \ No newline at end of file diff --git a/README.md b/README.md index 1baebac..a60ece1 100644 --- a/README.md +++ b/README.md @@ -486,13 +486,15 @@ A: The AI models are cached in `~/.cache/` (or `HUGGINGFACE_HUB_CACHE`). To dele **13.0.0** - ๐ŸŽ‰ feature: multi-controlnet support. pass in multiple `--control-mode`, `--control-image`, and `--control-image-raw` arguments. - ๐ŸŽ‰ feature: "better" memory management. If GPU is full, least-recently-used model is moved to RAM. -- alpha feature: `aimg run-api-server` command. Runs a http webserver (not finished). After running, visit http://127.0.0.1:8000/docs for api. -- feature: add colorization controlnet. improve `aimg colorize` command +- ๐ŸŽ‰ feature: add colorization controlnet. improve `aimg colorize` command +- ๐Ÿงช alpha feature: `aimg run-api-server` command. Runs a http webserver (not finished). After running, visit http://127.0.0.1:8000/docs for api. - feature: [disabled] inpainting controlnet can be used instead of finetuned inpainting model - The inpainting controlnet doesn't work as well as the finetuned model - feature: python interface allows configuration of controlnet strength -- fix: hide the "triton" error messages - feature: show full stack trace on error in cli +- fix: hide the "triton" error messages +- fix: package will not try to install xformers on `aarch64` machines. While this will allow the dockerfile to build on +MacOS M1, [torch will not be able to use the M1 when generating images.](https://github.com/pytorch/pytorch/issues/81224#issuecomment-1499741152) **12.0.3** - fix: exclude broken versions of timm as dependencies diff --git a/imaginairy/http/app.py b/imaginairy/http/app.py index e1c0fb2..6cd145c 100644 --- a/imaginairy/http/app.py +++ b/imaginairy/http/app.py @@ -5,7 +5,7 @@ from typing import Optional from fastapi import FastAPI, Query from fastapi.concurrency import run_in_threadpool from fastapi.responses import StreamingResponse -from pydantic import BaseModel +from pydantic import BaseModel # noqa from imaginairy import ImaginePrompt, imagine from imaginairy.log_utils import configure_logging diff --git a/setup.py b/setup.py index c96239c..dbf30c3 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,14 @@ else: @lru_cache() def get_git_revision_hash() -> str: - return subprocess.check_output(["git", "rev-parse", "HEAD"]).decode("ascii").strip() + try: + return ( + subprocess.check_output(["git", "rev-parse", "HEAD"]) + .decode("ascii") + .strip() + ) + except FileNotFoundError: + return "no-git" revision_hash = get_git_revision_hash() @@ -94,6 +101,6 @@ setup( "torchvision>=0.13.1", "kornia>=0.6", "uvicorn", - "xformers>=0.0.16; sys_platform!='darwin'", + "xformers>=0.0.16; sys_platform!='darwin' and platform_machine!='aarch64'", ], )