Spaces:
Sleeping
Sleeping
baseline08_beta0.3.9_03Oct25: fixing slow Marker: @spaces.GPU sets to default at extract() and init_worker
Browse files- converters/pdf_to_md.py +4 -2
converters/pdf_to_md.py
CHANGED
|
@@ -21,6 +21,7 @@ docconverter: DocumentConverter = None
|
|
| 21 |
converter = None #DocumentConverter
|
| 22 |
#converter:DocumentConverter.converter = None
|
| 23 |
|
|
|
|
| 24 |
# Define docextractor in the pool as serialised object and passed to each worker process.
|
| 25 |
# Note: DocumentConverter must be "picklable".
|
| 26 |
def init_worker(#self,
|
|
@@ -112,8 +113,9 @@ class PdfToMarkdownConverter:
|
|
| 112 |
|
| 113 |
|
| 114 |
#duration = 5.75 * pdf_files_count if pdf_files_count>=2 else 7
|
| 115 |
-
duration = 10
|
| 116 |
-
|
|
|
|
| 117 |
## moved from extraction_converter ( to standalone extract_to_md)
|
| 118 |
#def extract(self, src_path: str, output_dir: str) -> Dict[str, int, Union[str, Path]]:
|
| 119 |
def extract(self, src_path: str, output_dir: str): #Dict:
|
|
|
|
| 21 |
converter = None #DocumentConverter
|
| 22 |
#converter:DocumentConverter.converter = None
|
| 23 |
|
| 24 |
+
@spaces.GPU
|
| 25 |
# Define docextractor in the pool as serialised object and passed to each worker process.
|
| 26 |
# Note: DocumentConverter must be "picklable".
|
| 27 |
def init_worker(#self,
|
|
|
|
| 113 |
|
| 114 |
|
| 115 |
#duration = 5.75 * pdf_files_count if pdf_files_count>=2 else 7
|
| 116 |
+
#duration = 10
|
| 117 |
+
#@spaces.GPU(duration=duration) ## HF Spaces GPU support
|
| 118 |
+
@spaces.GPU
|
| 119 |
## moved from extraction_converter ( to standalone extract_to_md)
|
| 120 |
#def extract(self, src_path: str, output_dir: str) -> Dict[str, int, Union[str, Path]]:
|
| 121 |
def extract(self, src_path: str, output_dir: str): #Dict:
|