flaxdiff 0.1.17__py3-none-any.whl → 0.1.18__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,7 +25,7 @@ import cv2
25
25
  USER_AGENT = get_datasets_user_agent()
26
26
 
27
27
  data_queue = Queue(16*2000)
28
- error_queue = Queue(16*2000)
28
+ error_queue = Queue()
29
29
 
30
30
 
31
31
  def fetch_single_image(image_url, timeout=None, retries=0):
@@ -98,7 +98,7 @@ def map_sample(
98
98
  "original_width": original_width,
99
99
  })
100
100
  except Exception as e:
101
- error_queue.put({
101
+ error_queue.put_nowait({
102
102
  "url": url,
103
103
  "caption": caption,
104
104
  "error": str(e)
@@ -135,6 +135,9 @@ def parallel_image_loader(dataset: Dataset, num_workers: int = 8, image_shape=(2
135
135
  iteration += 1
136
136
  print(f"Shuffling dataset with seed {iteration}")
137
137
  dataset = dataset.shuffle(seed=iteration)
138
+ # Clear the error queue
139
+ while not error_queue.empty():
140
+ error_queue.get_nowait()
138
141
 
139
142
 
140
143
  class ImageBatchIterator:
@@ -230,7 +233,6 @@ class OnlineStreamingDataLoader():
230
233
  self.iterator = ImageBatchIterator(self.dataset, image_shape=image_shape,
231
234
  num_workers=num_workers, batch_size=batch_size, num_threads=num_threads,
232
235
  timeout=timeout, retries=retries, image_processor=image_processor)
233
- self.collate_fn = collate_fn
234
236
  self.batch_size = batch_size
235
237
 
236
238
  # Launch a thread to load batches in the background
@@ -238,7 +240,10 @@ class OnlineStreamingDataLoader():
238
240
 
239
241
  def batch_loader():
240
242
  for batch in self.iterator:
241
- self.batch_queue.put(batch)
243
+ try:
244
+ self.batch_queue.put(collate_fn(batch))
245
+ except Exception as e:
246
+ print("Error processing batch", e)
242
247
 
243
248
  self.loader_thread = threading.Thread(target=batch_loader)
244
249
  self.loader_thread.start()
@@ -247,8 +252,8 @@ class OnlineStreamingDataLoader():
247
252
  return self
248
253
 
249
254
  def __next__(self):
250
- return self.collate_fn(self.batch_queue.get())
255
+ return self.batch_queue.get()
251
256
  # return self.collate_fn(next(self.iterator))
252
257
 
253
258
  def __len__(self):
254
- return len(self.dataset)
259
+ return len(self.dataset)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flaxdiff
3
- Version: 0.1.17
3
+ Version: 0.1.18
4
4
  Summary: A versatile and easy to understand Diffusion library
5
5
  Author: Ashish Kumar Singh
6
6
  Author-email: ashishkmr472@gmail.com
@@ -1,7 +1,7 @@
1
1
  flaxdiff/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  flaxdiff/utils.py,sha256=B0GcHlzlVYDNEIdh2v5qmP4u0neIT-FqexNohuyuCvg,2452
3
3
  flaxdiff/data/__init__.py,sha256=PM3PkHihyohT5SHVYKc8vQ4IeVfGPpCktkSVwvqMjQ4,52
4
- flaxdiff/data/online_loader.py,sha256=BM4Le-4BUo8MJpRzGIA2nMHKm4-WynQ2BOdiQz0JCDs,8791
4
+ flaxdiff/data/online_loader.py,sha256=qim6SRRGU1lRO0zQbDNjRYC7Qm6g7jtUfELEXotora0,8987
5
5
  flaxdiff/models/__init__.py,sha256=FAivVYXxM2JrCFIXf-C3374RB2Hth25dBrzOeNFhH1U,26
6
6
  flaxdiff/models/attention.py,sha256=ZbDGIb5Q6FRqJ6qRY660cqw4WvF9IwCnhEuYdTpLPdM,13023
7
7
  flaxdiff/models/common.py,sha256=fd-Fl0VCNEBjijHNwGBqYL5VvXe9u0347h25czNTmRw,10780
@@ -34,7 +34,7 @@ flaxdiff/trainer/__init__.py,sha256=T-vUVq4zHcMK6kpCsG4Gu8vn71q6lZD-lg-Ul7yKfEk,
34
34
  flaxdiff/trainer/autoencoder_trainer.py,sha256=al7AsZ7yeDMEiDD-gbcXf0ADq_xfk1VMxvg24GfA-XQ,7008
35
35
  flaxdiff/trainer/diffusion_trainer.py,sha256=wKkg63DWZjx2MoM3VQNCDIr40rWN8fUGxH9jWWxfZao,9373
36
36
  flaxdiff/trainer/simple_trainer.py,sha256=Z77zRS5viJpd2Mpl6sonJk5WcnEWi2Cd4gl4u5tIX2M,18206
37
- flaxdiff-0.1.17.dist-info/METADATA,sha256=2Nr_T2yg3XHFt2jBuUXo8FxLYM8si-DBLdW_PBKxzc4,22083
38
- flaxdiff-0.1.17.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
39
- flaxdiff-0.1.17.dist-info/top_level.txt,sha256=-2-nXnfkJgSfkki1tjm5Faw6Dso7vhtdn2szwCdX5CQ,9
40
- flaxdiff-0.1.17.dist-info/RECORD,,
37
+ flaxdiff-0.1.18.dist-info/METADATA,sha256=aUSr3lBb9P2mnrpmbcgQa41DT8YYM-DtVMU8NI3CZEE,22083
38
+ flaxdiff-0.1.18.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
39
+ flaxdiff-0.1.18.dist-info/top_level.txt,sha256=-2-nXnfkJgSfkki1tjm5Faw6Dso7vhtdn2szwCdX5CQ,9
40
+ flaxdiff-0.1.18.dist-info/RECORD,,