VibecoderMcSwaggins commited on
Commit
7b2629d
·
1 Parent(s): 26f14be

fix(inference): correct DeepISLES Docker volume mounts and CLI args

Browse files

Fixes two critical bugs discovered during Docker integration testing:

1. --fast flag: Changed from `--fast True` to `--fast` (flag-style)
- DeepISLES CLI expects --fast as a boolean flag, not key-value
- Previous implementation caused: "unrecognized arguments: True"

2. Volume mounts: Changed from /input, /output to /app/data, /app/output
- DeepISLES expects files at /app/data/ internally
- Previous mounts caused: "FileNotFoundError: /app/data/dwi.nii.gz"

Also updates integration test to skip gracefully when nvidia-smi
is not available (DeepISLES requires GPU even with gpu=False).

src/stroke_deepisles_demo/inference/deepisles.py CHANGED
@@ -154,12 +154,13 @@ def _run_via_docker(
154
  command.extend(["--flair_file_name", "flair.nii.gz"])
155
 
156
  if fast:
157
- command.extend(["--fast", "True"])
158
 
159
  # Set up volume mounts
 
160
  volumes = {
161
- input_dir.resolve(): "/input",
162
- output_dir.resolve(): "/output",
163
  }
164
 
165
  logger.info("Running DeepISLES via Docker: input=%s, fast=%s, gpu=%s", input_dir, fast, gpu)
 
154
  command.extend(["--flair_file_name", "flair.nii.gz"])
155
 
156
  if fast:
157
+ command.append("--fast")
158
 
159
  # Set up volume mounts
160
+ # DeepISLES expects input files at /app/data/ and outputs to /app/output/
161
  volumes = {
162
+ input_dir.resolve(): "/app/data",
163
+ output_dir.resolve(): "/app/output",
164
  }
165
 
166
  logger.info("Running DeepISLES via Docker: input=%s, fast=%s, gpu=%s", input_dir, fast, gpu)
tests/test_pipeline.py CHANGED
@@ -287,21 +287,28 @@ class TestPipelineIntegration:
287
  @pytest.mark.skipif(not REAL_DATA_PATH.exists(), reason="Real data not found in data/isles24")
288
  def test_run_on_real_case(self, temp_dir: Path) -> None:
289
  """Run pipeline on actual ISLES24-MR-Lite case."""
290
- # Requires: real ISLES24 data, Docker, DeepISLES image
291
  # Run with: pytest -m "integration and slow"
292
 
 
293
  from stroke_deepisles_demo.inference.docker import check_docker_available
294
 
295
  if not check_docker_available():
296
  pytest.skip("Docker not available")
297
 
298
- result = run_pipeline_on_case(
299
- 0, # First case
300
- fast=True,
301
- gpu=False,
302
- compute_dice=True,
303
- output_dir=temp_dir / "pipeline_test_output",
304
- )
 
 
 
 
 
 
305
 
306
  assert result.prediction_mask.exists()
307
  # Dice might be None if no ground truth, but ISLES24 has masks
 
287
  @pytest.mark.skipif(not REAL_DATA_PATH.exists(), reason="Real data not found in data/isles24")
288
  def test_run_on_real_case(self, temp_dir: Path) -> None:
289
  """Run pipeline on actual ISLES24-MR-Lite case."""
290
+ # Requires: real ISLES24 data, Docker, DeepISLES image, GPU
291
  # Run with: pytest -m "integration and slow"
292
 
293
+ from stroke_deepisles_demo.core.exceptions import DeepISLESError
294
  from stroke_deepisles_demo.inference.docker import check_docker_available
295
 
296
  if not check_docker_available():
297
  pytest.skip("Docker not available")
298
 
299
+ try:
300
+ result = run_pipeline_on_case(
301
+ 0, # First case
302
+ fast=True,
303
+ gpu=False,
304
+ compute_dice=True,
305
+ output_dir=temp_dir / "pipeline_test_output",
306
+ )
307
+ except DeepISLESError as e:
308
+ # DeepISLES requires nvidia-smi even with gpu=False for model loading
309
+ if "nvidia-smi" in str(e).lower():
310
+ pytest.skip("DeepISLES requires GPU (nvidia-smi not available)")
311
+ raise
312
 
313
  assert result.prediction_mask.exists()
314
  # Dice might be None if no ground truth, but ISLES24 has masks