Update buckets.py to avoid possible error #177
+5
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'