Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update buckets.py to avoid possible error #177

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

elo0i
Copy link

@elo0i elo0i commented Sep 16, 2024

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'

Make sure resolution values are integers to avoid this error:

Traceback (most recent call last):
  File "/workspace/ai-toolkit/run.py", line 90, in <module>
    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'
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'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant