mirror of
https://github.com/DS4SD/docling.git
synced 2025-07-26 20:14:47 +00:00
Update base_pipeline.py
Signed-off-by: jane-temcious <jane.temcious@iterate.ai>
This commit is contained in:
parent
5ab8792697
commit
1fdfb2bc50
@ -93,8 +93,9 @@ class BasePipeline(ABC):
|
||||
pass
|
||||
|
||||
def _unload(self, conv_res: ConversionResult):
|
||||
pass
|
||||
|
||||
# Clear GPU memory after processingAdd commentMore actions
|
||||
clear_gpu_memory()
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def get_default_options(cls) -> PipelineOptions:
|
||||
@ -196,13 +197,18 @@ class PaginatedPipeline(BasePipeline): # TODO this is a bad name.
|
||||
return conv_res
|
||||
|
||||
def _unload(self, conv_res: ConversionResult) -> ConversionResult:
|
||||
# Unload page backends
|
||||
for page in conv_res.pages:
|
||||
if page._backend is not None:
|
||||
page._backend.unload()
|
||||
|
||||
|
||||
# Unload input backend
|
||||
if conv_res.input._backend:
|
||||
conv_res.input._backend.unload()
|
||||
|
||||
# Call parent _unload to clean up GPU memory
|
||||
super()._unload(conv_res)
|
||||
|
||||
return conv_res
|
||||
|
||||
def _determine_status(self, conv_res: ConversionResult) -> ConversionStatus:
|
||||
|
Loading…
Reference in New Issue
Block a user