From 652a783bdc3f0ee2b11dc8d3d8a30b7834635f32 Mon Sep 17 00:00:00 2001 From: bghira Date: Sun, 20 Oct 2024 16:32:44 -0600 Subject: [PATCH 1/2] fix model card display of is_regularisation_data --- helpers/data_backend/factory.py | 8 ++++++-- helpers/multiaspect/sampler.py | 8 +++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/helpers/data_backend/factory.py b/helpers/data_backend/factory.py index bcecbbd8..6770b244 100644 --- a/helpers/data_backend/factory.py +++ b/helpers/data_backend/factory.py @@ -561,8 +561,11 @@ def configure_multi_databackend(args: dict, accelerator, text_encoders, tokenize raise ValueError("Each dataset needs a unique 'id' field.") info_log(f"Configuring data backend: {backend['id']}") conditioning_type = backend.get("conditioning_type") - if backend.get("dataset_type") == "conditioning" or conditioning_type is not None: - backend['dataset_type'] = 'conditioning' + if ( + backend.get("dataset_type") == "conditioning" + or conditioning_type is not None + ): + backend["dataset_type"] = "conditioning" resolution_type = backend.get("resolution_type", args.resolution_type) if resolution_type == "pixel_area": pixel_edge_length = backend.get("resolution", int(args.resolution)) @@ -897,6 +900,7 @@ def configure_multi_databackend(args: dict, accelerator, text_encoders, tokenize ), instance_prompt=backend.get("instance_prompt", args.instance_prompt), conditioning_type=conditioning_type, + is_regularisation_data=is_regularisation_data, ) if init_backend["sampler"].caption_strategy == "parquet": configure_parquet_database(backend, args, init_backend["data_backend"]) diff --git a/helpers/multiaspect/sampler.py b/helpers/multiaspect/sampler.py index b98237ef..6e5f7834 100644 --- a/helpers/multiaspect/sampler.py +++ b/helpers/multiaspect/sampler.py @@ -39,6 +39,7 @@ def __init__( prepend_instance_prompt=False, instance_prompt: str = None, conditioning_type: str = None, + is_regularisation_data: bool = False, ): """ Initializes the sampler with provided settings. @@ -67,6 +68,7 @@ def __init__( f"Unknown conditioning image type: {conditioning_type}" ) self.conditioning_type = conditioning_type + self.is_regularisation_data = is_regularisation_data self.rank_info = rank_info() self.accelerator = accelerator @@ -377,10 +379,6 @@ def log_state(self, show_rank: bool = True, alt_stats: bool = False): total_image_count *= self.accelerator.num_processes total_image_count = f"~{total_image_count}" data_backend_config = StateTracker.get_data_backend_config(self.id) - is_regularisation_data = data_backend_config.get( - "is_regularisation_data", - data_backend_config.get("is_regularization_data", False), - ) printed_state = ( f"- Repeats: {data_backend_config.get('repeats', 0)}\n" f"- Total number of images: {total_image_count}\n" @@ -389,7 +387,7 @@ def log_state(self, show_rank: bool = True, alt_stats: bool = False): f"- Cropped: {data_backend_config.get('crop')}\n" f"- Crop style: {'None' if not data_backend_config.get('crop') else data_backend_config.get('crop_style')}\n" f"- Crop aspect: {'None' if not data_backend_config.get('crop') else data_backend_config.get('crop_aspect')}\n" - f"- Used for regularisation data: {'Yes' if is_regularisation_data else 'No'}\n" + f"- Used for regularisation data: {'Yes' if self.is_regularisation_data else 'No'}\n" ) if self.conditioning_type: printed_state += f"- Conditioning type: {self.conditioning_type}\n" From 362a7b6eee47bc8abba0b9c227a37c6d7edd7ffb Mon Sep 17 00:00:00 2001 From: bghira Date: Tue, 22 Oct 2024 09:03:12 -0600 Subject: [PATCH 2/2] update diffusers for SD 3.5 --- install/apple/poetry.lock | 22 +++++++++------------- install/apple/pyproject.toml | 2 +- install/rocm/poetry.lock | 22 +++++++++------------- install/rocm/pyproject.toml | 2 +- poetry.lock | 22 +++++++++------------- pyproject.toml | 2 +- 6 files changed, 30 insertions(+), 42 deletions(-) diff --git a/install/apple/poetry.lock b/install/apple/poetry.lock index e3f39a24..dde26187 100644 --- a/install/apple/poetry.lock +++ b/install/apple/poetry.lock @@ -535,17 +535,19 @@ triton = ["triton (==2.1.0)"] [[package]] name = "diffusers" -version = "0.31.0.dev0" +version = "0.31.0" description = "State-of-the-art diffusion in PyTorch and JAX." optional = false python-versions = ">=3.8.0" -files = [] -develop = false +files = [ + {file = "diffusers-0.31.0-py3-none-any.whl", hash = "sha256:cbc498ae63f4abfc7c3a07649cdcbee229ef2f9a9a1f0d19c9bbaf22f8d30c1f"}, + {file = "diffusers-0.31.0.tar.gz", hash = "sha256:b1d01a73e45d43a0630c299173915dddd69fc50f2ae8f2ab5de4fd245eaed72f"}, +] [package.dependencies] filelock = "*" huggingface-hub = ">=0.23.2" -importlib_metadata = "*" +importlib-metadata = "*" numpy = "*" Pillow = "*" regex = "!=2019.12.17" @@ -553,20 +555,14 @@ requests = "*" safetensors = ">=0.3.1" [package.extras] -dev = ["GitPython (<3.1.19)", "Jinja2", "Jinja2", "accelerate (>=0.31.0)", "accelerate (>=0.31.0)", "compel (==0.1.8)", "datasets", "datasets", "flax (>=0.4.1)", "hf-doc-builder (>=0.3.0)", "hf-doc-builder (>=0.3.0)", "invisible-watermark (>=0.2.0)", "isort (>=5.5.4)", "jax (>=0.4.1)", "jaxlib (>=0.4.1)", "k-diffusion (>=0.0.12)", "librosa", "parameterized", "peft (>=0.6.0)", "protobuf (>=3.20.3,<4)", "pytest", "pytest-timeout", "pytest-xdist", "requests-mock (==1.10.0)", "ruff (==0.1.5)", "safetensors (>=0.3.1)", "scipy", "sentencepiece (>=0.1.91,!=0.1.92)", "tensorboard", "torch (>=1.4)", "torchvision", "transformers (>=4.41.2)", "urllib3 (<=2.0.0)"] +dev = ["GitPython (<3.1.19)", "Jinja2", "accelerate (>=0.31.0)", "compel (==0.1.8)", "datasets", "flax (>=0.4.1)", "hf-doc-builder (>=0.3.0)", "invisible-watermark (>=0.2.0)", "isort (>=5.5.4)", "jax (>=0.4.1)", "jaxlib (>=0.4.1)", "k-diffusion (>=0.0.12)", "librosa", "parameterized", "peft (>=0.6.0)", "protobuf (>=3.20.3,<4)", "pytest", "pytest-timeout", "pytest-xdist", "requests-mock (==1.10.0)", "ruff (==0.1.5)", "safetensors (>=0.3.1)", "scipy", "sentencepiece (>=0.1.91,!=0.1.92)", "tensorboard", "torch (>=1.4,<2.5.0)", "torchvision", "transformers (>=4.41.2)", "urllib3 (<=2.0.0)"] docs = ["hf-doc-builder (>=0.3.0)"] flax = ["flax (>=0.4.1)", "jax (>=0.4.1)", "jaxlib (>=0.4.1)"] quality = ["hf-doc-builder (>=0.3.0)", "isort (>=5.5.4)", "ruff (==0.1.5)", "urllib3 (<=2.0.0)"] test = ["GitPython (<3.1.19)", "Jinja2", "compel (==0.1.8)", "datasets", "invisible-watermark (>=0.2.0)", "k-diffusion (>=0.0.12)", "librosa", "parameterized", "pytest", "pytest-timeout", "pytest-xdist", "requests-mock (==1.10.0)", "safetensors (>=0.3.1)", "scipy", "sentencepiece (>=0.1.91,!=0.1.92)", "torchvision", "transformers (>=4.41.2)"] -torch = ["accelerate (>=0.31.0)", "torch (>=1.4)"] +torch = ["accelerate (>=0.31.0)", "torch (>=1.4,<2.5.0)"] training = ["Jinja2", "accelerate (>=0.31.0)", "datasets", "peft (>=0.6.0)", "protobuf (>=3.20.3,<4)", "tensorboard"] -[package.source] -type = "git" -url = "https://github.com/huggingface/diffusers" -reference = "quantization-config" -resolved_reference = "9b9a6107a76239700d4fa7c365ac8b69a1792637" - [[package]] name = "dill" version = "0.3.7" @@ -4206,4 +4202,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = ">=3.10,<3.13" -content-hash = "090a7321fa0ffd07e8488c2e95edafe0a6994b4603f07c150a750924ab4731b1" +content-hash = "c24ef2004b2191f79e139e629ba8258fb92b6d6a15ad0d827b6042fa62440ebd" diff --git a/install/apple/pyproject.toml b/install/apple/pyproject.toml index 50666399..98e7c4a1 100644 --- a/install/apple/pyproject.toml +++ b/install/apple/pyproject.toml @@ -11,7 +11,7 @@ package-mode = false python = ">=3.10,<3.13" torch = "^2.5.0" torchvision = "^0.20.0" -diffusers = {git = "https://github.com/huggingface/diffusers", rev = "quantization-config"} +diffusers = "^0.31.0" transformers = "^4.44.2" datasets = "^3.0.0" wandb = "^0.18.1" diff --git a/install/rocm/poetry.lock b/install/rocm/poetry.lock index 93944bef..f69963e2 100644 --- a/install/rocm/poetry.lock +++ b/install/rocm/poetry.lock @@ -539,17 +539,19 @@ triton = ["triton (==2.1.0)"] [[package]] name = "diffusers" -version = "0.31.0.dev0" +version = "0.31.0" description = "State-of-the-art diffusion in PyTorch and JAX." optional = false python-versions = ">=3.8.0" -files = [] -develop = false +files = [ + {file = "diffusers-0.31.0-py3-none-any.whl", hash = "sha256:cbc498ae63f4abfc7c3a07649cdcbee229ef2f9a9a1f0d19c9bbaf22f8d30c1f"}, + {file = "diffusers-0.31.0.tar.gz", hash = "sha256:b1d01a73e45d43a0630c299173915dddd69fc50f2ae8f2ab5de4fd245eaed72f"}, +] [package.dependencies] filelock = "*" huggingface-hub = ">=0.23.2" -importlib_metadata = "*" +importlib-metadata = "*" numpy = "*" Pillow = "*" regex = "!=2019.12.17" @@ -557,20 +559,14 @@ requests = "*" safetensors = ">=0.3.1" [package.extras] -dev = ["GitPython (<3.1.19)", "Jinja2", "Jinja2", "accelerate (>=0.31.0)", "accelerate (>=0.31.0)", "compel (==0.1.8)", "datasets", "datasets", "flax (>=0.4.1)", "hf-doc-builder (>=0.3.0)", "hf-doc-builder (>=0.3.0)", "invisible-watermark (>=0.2.0)", "isort (>=5.5.4)", "jax (>=0.4.1)", "jaxlib (>=0.4.1)", "k-diffusion (>=0.0.12)", "librosa", "parameterized", "peft (>=0.6.0)", "protobuf (>=3.20.3,<4)", "pytest", "pytest-timeout", "pytest-xdist", "requests-mock (==1.10.0)", "ruff (==0.1.5)", "safetensors (>=0.3.1)", "scipy", "sentencepiece (>=0.1.91,!=0.1.92)", "tensorboard", "torch (>=1.4)", "torchvision", "transformers (>=4.41.2)", "urllib3 (<=2.0.0)"] +dev = ["GitPython (<3.1.19)", "Jinja2", "accelerate (>=0.31.0)", "compel (==0.1.8)", "datasets", "flax (>=0.4.1)", "hf-doc-builder (>=0.3.0)", "invisible-watermark (>=0.2.0)", "isort (>=5.5.4)", "jax (>=0.4.1)", "jaxlib (>=0.4.1)", "k-diffusion (>=0.0.12)", "librosa", "parameterized", "peft (>=0.6.0)", "protobuf (>=3.20.3,<4)", "pytest", "pytest-timeout", "pytest-xdist", "requests-mock (==1.10.0)", "ruff (==0.1.5)", "safetensors (>=0.3.1)", "scipy", "sentencepiece (>=0.1.91,!=0.1.92)", "tensorboard", "torch (>=1.4,<2.5.0)", "torchvision", "transformers (>=4.41.2)", "urllib3 (<=2.0.0)"] docs = ["hf-doc-builder (>=0.3.0)"] flax = ["flax (>=0.4.1)", "jax (>=0.4.1)", "jaxlib (>=0.4.1)"] quality = ["hf-doc-builder (>=0.3.0)", "isort (>=5.5.4)", "ruff (==0.1.5)", "urllib3 (<=2.0.0)"] test = ["GitPython (<3.1.19)", "Jinja2", "compel (==0.1.8)", "datasets", "invisible-watermark (>=0.2.0)", "k-diffusion (>=0.0.12)", "librosa", "parameterized", "pytest", "pytest-timeout", "pytest-xdist", "requests-mock (==1.10.0)", "safetensors (>=0.3.1)", "scipy", "sentencepiece (>=0.1.91,!=0.1.92)", "torchvision", "transformers (>=4.41.2)"] -torch = ["accelerate (>=0.31.0)", "torch (>=1.4)"] +torch = ["accelerate (>=0.31.0)", "torch (>=1.4,<2.5.0)"] training = ["Jinja2", "accelerate (>=0.31.0)", "datasets", "peft (>=0.6.0)", "protobuf (>=3.20.3,<4)", "tensorboard"] -[package.source] -type = "git" -url = "https://github.com/huggingface/diffusers" -reference = "quantization-config" -resolved_reference = "9b9a6107a76239700d4fa7c365ac8b69a1792637" - [[package]] name = "dill" version = "0.3.8" @@ -3943,4 +3939,4 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", [metadata] lock-version = "2.0" python-versions = ">=3.10,<3.13" -content-hash = "11b589a404f2be5100a6e7679c390c0989be1237face75a79a0d339b625319ad" +content-hash = "fea230f8f01b80f605e5a94e1af32a07cf62ff24c14c45407cbad39f8b1bc108" diff --git a/install/rocm/pyproject.toml b/install/rocm/pyproject.toml index 942adf1f..fbfab424 100644 --- a/install/rocm/pyproject.toml +++ b/install/rocm/pyproject.toml @@ -22,7 +22,7 @@ colorama = "^0.4.6" compel = "^2" datasets = "^3.0.0" deepspeed = "^0.15.1" -diffusers = {git = "https://github.com/huggingface/diffusers", rev = "quantization-config"} +diffusers = "^0.31.0" iterutils = "^0.1.6" numpy = "1.26" open-clip-torch = "^2.26.1" diff --git a/poetry.lock b/poetry.lock index 1a68a159..df55bdf5 100644 --- a/poetry.lock +++ b/poetry.lock @@ -679,17 +679,19 @@ triton = ["triton (==2.1.0)"] [[package]] name = "diffusers" -version = "0.31.0.dev0" +version = "0.31.0" description = "State-of-the-art diffusion in PyTorch and JAX." optional = false python-versions = ">=3.8.0" -files = [] -develop = false +files = [ + {file = "diffusers-0.31.0-py3-none-any.whl", hash = "sha256:cbc498ae63f4abfc7c3a07649cdcbee229ef2f9a9a1f0d19c9bbaf22f8d30c1f"}, + {file = "diffusers-0.31.0.tar.gz", hash = "sha256:b1d01a73e45d43a0630c299173915dddd69fc50f2ae8f2ab5de4fd245eaed72f"}, +] [package.dependencies] filelock = "*" huggingface-hub = ">=0.23.2" -importlib_metadata = "*" +importlib-metadata = "*" numpy = "*" Pillow = "*" regex = "!=2019.12.17" @@ -697,20 +699,14 @@ requests = "*" safetensors = ">=0.3.1" [package.extras] -dev = ["GitPython (<3.1.19)", "Jinja2", "Jinja2", "accelerate (>=0.31.0)", "accelerate (>=0.31.0)", "compel (==0.1.8)", "datasets", "datasets", "flax (>=0.4.1)", "hf-doc-builder (>=0.3.0)", "hf-doc-builder (>=0.3.0)", "invisible-watermark (>=0.2.0)", "isort (>=5.5.4)", "jax (>=0.4.1)", "jaxlib (>=0.4.1)", "k-diffusion (>=0.0.12)", "librosa", "parameterized", "peft (>=0.6.0)", "protobuf (>=3.20.3,<4)", "pytest", "pytest-timeout", "pytest-xdist", "requests-mock (==1.10.0)", "ruff (==0.1.5)", "safetensors (>=0.3.1)", "scipy", "sentencepiece (>=0.1.91,!=0.1.92)", "tensorboard", "torch (>=1.4)", "torchvision", "transformers (>=4.41.2)", "urllib3 (<=2.0.0)"] +dev = ["GitPython (<3.1.19)", "Jinja2", "accelerate (>=0.31.0)", "compel (==0.1.8)", "datasets", "flax (>=0.4.1)", "hf-doc-builder (>=0.3.0)", "invisible-watermark (>=0.2.0)", "isort (>=5.5.4)", "jax (>=0.4.1)", "jaxlib (>=0.4.1)", "k-diffusion (>=0.0.12)", "librosa", "parameterized", "peft (>=0.6.0)", "protobuf (>=3.20.3,<4)", "pytest", "pytest-timeout", "pytest-xdist", "requests-mock (==1.10.0)", "ruff (==0.1.5)", "safetensors (>=0.3.1)", "scipy", "sentencepiece (>=0.1.91,!=0.1.92)", "tensorboard", "torch (>=1.4,<2.5.0)", "torchvision", "transformers (>=4.41.2)", "urllib3 (<=2.0.0)"] docs = ["hf-doc-builder (>=0.3.0)"] flax = ["flax (>=0.4.1)", "jax (>=0.4.1)", "jaxlib (>=0.4.1)"] quality = ["hf-doc-builder (>=0.3.0)", "isort (>=5.5.4)", "ruff (==0.1.5)", "urllib3 (<=2.0.0)"] test = ["GitPython (<3.1.19)", "Jinja2", "compel (==0.1.8)", "datasets", "invisible-watermark (>=0.2.0)", "k-diffusion (>=0.0.12)", "librosa", "parameterized", "pytest", "pytest-timeout", "pytest-xdist", "requests-mock (==1.10.0)", "safetensors (>=0.3.1)", "scipy", "sentencepiece (>=0.1.91,!=0.1.92)", "torchvision", "transformers (>=4.41.2)"] -torch = ["accelerate (>=0.31.0)", "torch (>=1.4)"] +torch = ["accelerate (>=0.31.0)", "torch (>=1.4,<2.5.0)"] training = ["Jinja2", "accelerate (>=0.31.0)", "datasets", "peft (>=0.6.0)", "protobuf (>=3.20.3,<4)", "tensorboard"] -[package.source] -type = "git" -url = "https://github.com/huggingface/diffusers" -reference = "quantization-config" -resolved_reference = "569dd960d1ef7b3a3b5ce62f6673e32554db521d" - [[package]] name = "dill" version = "0.3.8" @@ -5373,4 +5369,4 @@ cffi = ["cffi (>=1.11)"] [metadata] lock-version = "2.0" python-versions = ">=3.10,<3.12" -content-hash = "408fcfac6a3fec222ca96e5909d86724d1217b8b4932f42fa1526b28a2a7ab34" +content-hash = "cc52561a982e94a5036ece9935d605f8828e7fa191db688ebe4a32f5593d7d30" diff --git a/pyproject.toml b/pyproject.toml index 8d4dfc71..b7ede8b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ package-mode = false python = ">=3.10,<3.12" torch = {version = "^2.5.0+cu124", source = "pytorch"} torchvision = {version = "^0.20.0+cu124", source = "pytorch"} -diffusers = {git = "https://github.com/huggingface/diffusers", rev = "quantization-config"} +diffusers = "^0.31.0" transformers = "^4.45.1" datasets = "^3.0.1" bitsandbytes = "^0.44.1"