Skip to content

Commit

Permalink
test: improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
percevalw committed Feb 17, 2024
1 parent 3175775 commit 85b02eb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion edspdf/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def to_doc(doc):
backend = accelerator
elif isinstance(accelerator, dict):
kwargs = dict(accelerator)
backend = accelerator.pop("@accelerator", "simple")
backend = kwargs.pop("@accelerator", "simple")
elif "Accelerator" in type(accelerator).__name__:
backend = (
"multiprocessing"
Expand Down
5 changes: 0 additions & 5 deletions edspdf/trainable_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,6 @@ def named_component_children(self):
if isinstance(module, TrainablePipe):
yield name, module

def named_component_modules(self):
for name, module in self.named_modules():
if isinstance(module, TrainablePipe):
yield name, module

def post_init(self, gold_data: Iterable[PDFDoc], exclude: Set[str]):
"""
This method completes the attributes of the component, by looking at some
Expand Down
13 changes: 7 additions & 6 deletions tests/core/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,13 @@ def error_pipe(doc: PDFDoc):

def test_deprecated_multiprocessing_gpu_stub(frozen_pipeline, pdf, letter_pdf):
edspdf.accelerators.multiprocessing.MAX_NUM_PROCESSES = 2
accelerator = edspdf.accelerators.multiprocessing.MultiprocessingAccelerator(
batch_size=2,
num_gpu_workers=1,
num_cpu_workers=1,
gpu_worker_devices=["cpu"],
)
accelerator = {
"@accelerator": "multiprocessing",
"batch_size": 2,
"num_gpu_workers": 1,
"num_cpu_workers": 1,
"gpu_worker_devices": ["cpu"],
}
list(
frozen_pipeline.pipe(
chain.from_iterable(
Expand Down

0 comments on commit 85b02eb

Please sign in to comment.