jordyvl commited on
Commit
789c81a
·
1 Parent(s): 49508ed

try to run for test set image conversion

Browse files
Files changed (1) hide show
  1. cache_loader.py +12 -4
cache_loader.py CHANGED
@@ -25,12 +25,19 @@ def pymupdf_image_extraction(data: bytes):
25
 
26
 
27
  def batch_get_images(streams, wrapper):
28
- return {"images": [pymupdf_image_extraction(pdf_stream) for pdf_stream in streams]}
 
 
 
 
29
 
30
 
31
  def batch_get_pages(streams, wrapper):
32
  return {
33
- "pages": [len(PyMuPDF.open(stream=pdf_stream, filetype="pdf")) for pdf_stream in streams]
 
 
 
34
  }
35
 
36
 
@@ -40,9 +47,10 @@ testds = testds.map(func, batched=True, keep_in_memory=False)
40
 
41
  func = lambda batch: batch_get_images(batch["file"], wrapper=binding)
42
  testds = testds.map(func, batched=True, keep_in_memory=False)
43
- import pdb; pdb.set_trace() # breakpoint 37054086 //
 
 
44
 
45
  """
46
  Filter based on page count?
47
  """
48
-
 
25
 
26
 
27
  def batch_get_images(streams, wrapper):
28
+ return {
29
+ "images": tqdm(
30
+ [pymupdf_image_extraction(pdf_stream) for pdf_stream in streams], desc="get_images"
31
+ )
32
+ }
33
 
34
 
35
  def batch_get_pages(streams, wrapper):
36
  return {
37
+ "pages": tqdm(
38
+ [len(PyMuPDF.open(stream=pdf_stream, filetype="pdf")) for pdf_stream in streams],
39
+ desc="get_pages",
40
+ )
41
  }
42
 
43
 
 
47
 
48
  func = lambda batch: batch_get_images(batch["file"], wrapper=binding)
49
  testds = testds.map(func, batched=True, keep_in_memory=False)
50
+ import pdb
51
+
52
+ pdb.set_trace() # breakpoint 37054086 //
53
 
54
  """
55
  Filter based on page count?
56
  """