semmyk commited on
Commit
f9088c5
·
1 Parent(s): ee6cd88

baseline08_beta0.3.9.2_03Oct25: fixing slow Marker: @spaces.GPU ~ convert_files and init_worker starting at 180s

Browse files
Files changed (1) hide show
  1. converters/pdf_to_md.py +3 -1
converters/pdf_to_md.py CHANGED
@@ -23,6 +23,8 @@ converter = None #DocumentConverter
23
  #converter:DocumentConverter.converter = None
24
 
25
  #@spaces.GPU
 
 
26
  # Define docextractor in the pool as serialised object and passed to each worker process.
27
  # Note: DocumentConverter must be "picklable".
28
  def init_worker(#self,
@@ -180,7 +182,7 @@ class PdfToMarkdownConverter:
180
  return {"file": md_file.name, "images": images_count, "filepath": md_file, "image_path": image_path} ####SMY should be Dict[str, int, str]. Dicts are not necessarily ordered.
181
 
182
  #duration = 5.75 * pdf_files_count if pdf_files_count>=2 else 7
183
- duration = 20*config_load_models.pdf_files_count if config_load_models.pdf_files_count>=10 else 180 ## sec
184
  @spaces.GPU(duration=duration) ## HF Spaces GPU support
185
  #def convert_files(src_path: str, output_dir: str, max_retries: int = 2) -> str:
186
  #def convert_files(self, src_path: str, output_dir_string: str = None, max_retries: int = 2, progress = gr.Progress()) -> Union[Dict, str]: #str:
 
23
  #converter:DocumentConverter.converter = None
24
 
25
  #@spaces.GPU
26
+ duration = 60*config_load_models.pdf_files_count if config_load_models.pdf_files_count>=10 else 360 ## sec
27
+ @spaces.GPU(duration=duration) ## HF Spaces GPU support
28
  # Define docextractor in the pool as serialised object and passed to each worker process.
29
  # Note: DocumentConverter must be "picklable".
30
  def init_worker(#self,
 
182
  return {"file": md_file.name, "images": images_count, "filepath": md_file, "image_path": image_path} ####SMY should be Dict[str, int, str]. Dicts are not necessarily ordered.
183
 
184
  #duration = 5.75 * pdf_files_count if pdf_files_count>=2 else 7
185
+ duration = 60*config_load_models.pdf_files_count if config_load_models.pdf_files_count>=10 else 360 ## sec
186
  @spaces.GPU(duration=duration) ## HF Spaces GPU support
187
  #def convert_files(src_path: str, output_dir: str, max_retries: int = 2) -> str:
188
  #def convert_files(self, src_path: str, output_dir_string: str = None, max_retries: int = 2, progress = gr.Progress()) -> Union[Dict, str]: #str: