From 0fe7903a8147cfe95c516f8a68e19d8e5e34eb89 Mon Sep 17 00:00:00 2001 From: elo0i <114620017+elo0i@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:25:21 +0200 Subject: [PATCH 1/3] Update buckets.py Make sure resolution values are integers to avoid this error: Traceback (most recent call last): File "/workspace/ai-toolkit/run.py", line 90, in main() File "/workspace/ai-toolkit/run.py", line 86, in main raise e File "/workspace/ai-toolkit/run.py", line 78, in main job.run() File "/workspace/ai-toolkit/jobs/ExtensionJob.py", line 22, in run process.run() File "/workspace/ai-toolkit/jobs/process/BaseSDTrainProcess.py", line 1567, in run self.data_loader = get_dataloader_from_datasets(self.datasets, self.train_config.batch_size, self.sd) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/workspace/ai-toolkit/toolkit/data_loader.py", line 571, in get_dataloader_from_datasets dataset = AiToolkitDataset(config, batch_size=batch_size, sd=sd) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/workspace/ai-toolkit/toolkit/data_loader.py", line 499, in __init__ self.setup_epoch() File "/workspace/ai-toolkit/toolkit/data_loader.py", line 507, in setup_epoch self.setup_buckets() File "/workspace/ai-toolkit/toolkit/dataloader_mixins.py", line 222, in setup_buckets bucket_resolution = get_bucket_for_image_size( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/workspace/ai-toolkit/toolkit/buckets.py", line 143, in get_bucket_for_image_size resolution = min(resolution, real_resolution) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: '<' not supported between instances of 'int' and 'str' --- toolkit/buckets.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/toolkit/buckets.py b/toolkit/buckets.py index 835c9eb9..f4496a87 100644 --- a/toolkit/buckets.py +++ b/toolkit/buckets.py @@ -140,6 +140,9 @@ def get_bucket_for_image_size( if bucket_size_list is None: # if real resolution is smaller, use that instead real_resolution = get_resolution(width, height) + # Asegurarse de que resolution y real_resolution sean enteros + resolution = int(resolution) + real_resolution = int(real_resolution) resolution = min(resolution, real_resolution) bucket_size_list = get_bucket_sizes(resolution=resolution, divisibility=divisibility) From 0906bde62e5c65140efcc186a80dba8f32c68a0a Mon Sep 17 00:00:00 2001 From: elo0i <114620017+elo0i@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:33:43 +0200 Subject: [PATCH 2/3] Update buckets.py Update buckets.py to avoid possible error Make sure resolution values are integers to avoid this error: Traceback (most recent call last): File "/workspace/ai-toolkit/run.py", line 90, in main() File "/workspace/ai-toolkit/run.py", line 86, in main raise e File "/workspace/ai-toolkit/run.py", line 78, in main job.run() File "/workspace/ai-toolkit/jobs/ExtensionJob.py", line 22, in run process.run() File "/workspace/ai-toolkit/jobs/process/BaseSDTrainProcess.py", line 1567, in run self.data_loader = get_dataloader_from_datasets(self.datasets, self.train_config.batch_size, self.sd) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/workspace/ai-toolkit/toolkit/data_loader.py", line 571, in get_dataloader_from_datasets dataset = AiToolkitDataset(config, batch_size=batch_size, sd=sd) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/workspace/ai-toolkit/toolkit/data_loader.py", line 499, in init self.setup_epoch() File "/workspace/ai-toolkit/toolkit/data_loader.py", line 507, in setup_epoch self.setup_buckets() File "/workspace/ai-toolkit/toolkit/dataloader_mixins.py", line 222, in setup_buckets bucket_resolution = get_bucket_for_image_size( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/workspace/ai-toolkit/toolkit/buckets.py", line 143, in get_bucket_for_image_size resolution = min(resolution, real_resolution) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: '<' not supported between instances of 'int' and 'str' --- toolkit/buckets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/buckets.py b/toolkit/buckets.py index f4496a87..0817b12c 100644 --- a/toolkit/buckets.py +++ b/toolkit/buckets.py @@ -140,7 +140,7 @@ def get_bucket_for_image_size( if bucket_size_list is None: # if real resolution is smaller, use that instead real_resolution = get_resolution(width, height) - # Asegurarse de que resolution y real_resolution sean enteros + # Make sure that resolution and real_resolution are integers resolution = int(resolution) real_resolution = int(real_resolution) resolution = min(resolution, real_resolution) From 9c1447ce15bf2b7f85e12fa5aa3aa9ae8c06562d Mon Sep 17 00:00:00 2001 From: elo0i <114620017+elo0i@users.noreply.github.com> Date: Fri, 8 Nov 2024 20:58:27 +0100 Subject: [PATCH 3/3] Update requirements.txt --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index f45766b8..d0c6017e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ torch torchvision safetensors -git+https://github.com/huggingface/diffusers.git +git+https://github.com/huggingface/diffusers.git@v0.30.1 transformers lycoris-lora==1.8.3 flatten_json @@ -32,4 +32,4 @@ sentencepiece huggingface_hub peft gradio -python-slugify \ No newline at end of file +python-slugify