Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] MONAI 0.9.1 is not (backwards) compatible with MONAI Seg Inference Operator #320

Closed
MMelQin opened this issue Aug 2, 2022 · 6 comments · Fixed by #360
Closed

[BUG] MONAI 0.9.1 is not (backwards) compatible with MONAI Seg Inference Operator #320

MMelQin opened this issue Aug 2, 2022 · 6 comments · Fixed by #360
Assignees
Labels
bug Something isn't working
Projects

Comments

@MMelQin
Copy link
Collaborator

MMelQin commented Aug 2, 2022

Describe the bug

Steps/Code to reproduce bug

  • pip install monai v0.9.1
  • run the existing example apps, Spleen, LiverTumor, UNETR etc.
    Expected behavior
    Ideally monai v0.9.1 should not have broken existing consumers, especially when it is supposed to be largely backward compatible.

Given that monai v0.9.1 has been released and published, the App SDK needs to declare incompatibility with this version until the App SDK implementation is updated and tested working with monai 0.9.1.

Environment details (please complete the following information)

  • OS/Platform: Ubuntu 20.04 LTS, GPU Nvidia GV100 with 32 GB mem
  • Python Version: 3.8
  • Method of MONAI Deploy App SDK install: [pip install from source]
  • SDK Version: main branch

Additional context
See attached log files from running the apps (to be attached), with a brief snippet shown below:

Traceback (most recent call last):
  File "/home/mqin/src/monai-app-sdk/.venv/lib/python3.8/site-packages/monai/transforms/transform.py", line 90, in apply_transform
    return _apply_transform(transform, data, unpack_items)
  File "/home/mqin/src/monai-app-sdk/.venv/lib/python3.8/site-packages/monai/transforms/transform.py", line 54, in _apply_transform
    return transform(parameters)
  File "/home/mqin/src/monai-app-sdk/.venv/lib/python3.8/site-packages/monai/transforms/post/dictionary.py", line 642, in __call__
    transform_info = d[InvertibleTransform.trace_key(orig_key)]
KeyError: 'image_transforms'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/mqin/src/monai-app-sdk/.venv/bin/monai-deploy", line 33, in <module>
    sys.exit(load_entry_point('monai-deploy-app-sdk', 'console_scripts', 'monai-deploy')())
  File "/home/mqin/src/monai-app-sdk/.venv/lib/python3.8/site-packages/monai/deploy/cli/main.py", line 116, in main
    execute_exec_command(args)
  File "/home/mqin/src/monai-app-sdk/.venv/lib/python3.8/site-packages/monai/deploy/cli/exec_command.py", line 76, in execute_exec_command
    runpy.run_path(app_path, run_name="__main__")
  File "/usr/lib/python3.8/runpy.py", line 265, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/mqin/src/monai-app-sdk/examples/apps/ai_livertumor_seg_app/app.py", line 90, in <module>
    app_instance.run()
  File "/home/mqin/src/monai-app-sdk/examples/apps/ai_livertumor_seg_app/app.py", line 37, in run
    super().run(*args, **kwargs)
  File "/home/mqin/src/monai-app-sdk/.venv/lib/python3.8/site-packages/monai/deploy/core/application.py", line 429, in run
    executor_obj.run()
  File "/home/mqin/src/monai-app-sdk/.venv/lib/python3.8/site-packages/monai/deploy/core/executors/single_process_executor.py", line 125, in run
    op.compute(op_exec_context.input_context, op_exec_context.output_context, op_exec_context)
  File "/home/mqin/src/monai-app-sdk/examples/apps/ai_livertumor_seg_app/livertumor_seg_operator.py", line 105, in compute
    infer_operator.compute(op_input, op_output, context)
  File "/home/mqin/src/monai-app-sdk/.venv/lib/python3.8/site-packages/monai/deploy/operators/monai_seg_inference_operator.py", line 226, in compute
    d = [post_transforms(i) for i in decollate_batch(d)]
  File "/home/mqin/src/monai-app-sdk/.venv/lib/python3.8/site-packages/monai/deploy/operators/monai_seg_inference_operator.py", line 226, in <listcomp>
    d = [post_transforms(i) for i in decollate_batch(d)]
  File "/home/mqin/src/monai-app-sdk/.venv/lib/python3.8/site-packages/monai/transforms/compose.py", line 173, in __call__
    input_ = apply_transform(_transform, input_, self.map_items, self.unpack_items, self.log_stats)
  File "/home/mqin/src/monai-app-sdk/.venv/lib/python3.8/site-packages/monai/transforms/transform.py", line 114, in apply_transform
    raise RuntimeError(f"applying transform {transform}") from e
RuntimeError: applying transform <monai.transforms.post.dictionary.Invertd object at 0x7f5e3e4ac4f0>
@MMelQin MMelQin added the bug Something isn't working label Aug 2, 2022
@MMelQin MMelQin self-assigned this Aug 2, 2022
@MMelQin MMelQin added this to To do in v0.5.0 via automation Aug 2, 2022
@wyli
Copy link
Member

wyli commented Aug 18, 2022

I think the issue is from the v0.9.1 change of ToTensor (the transform removes the meta dict in this version). In fact the images are now metatensors, ToTensor is not needed anymore, so removing all the ToTensor would probably address this issue, e.g. here

@MMelQin
Copy link
Collaborator Author

MMelQin commented Aug 18, 2022

I think the issue is from the v0.9.1 change of ToTensor (the transform removes the meta dict in this version). In fact the images are now metatensors, ToTensor is not needed anymore, so removing all the ToTensor would probably address this issue, e.g. here

Thanks, yes, a separate issue was create to fix/update the code to migrate to MetaTensor. My plan is to get this PR to merge first and then circle back once the compatibility issue is addressed.

@MMelQin MMelQin moved this from To do to In progress in v0.5.0 Sep 22, 2022
@pdogra89
Copy link

@MMelQin @dbericat @deepib - Thanks Ming ! When would this be fixed ?Please share ETA ?

@MMelQin
Copy link
Collaborator Author

MMelQin commented Sep 26, 2022

@MMelQin @dbericat @deepib - Thanks Ming ! When would this be fixed ?Please share ETA ?

It will be released in App SDK 0.5, which has been delayed till early Oct due to the additional work for IHE Connectathon IAIP.

@Nic-Ma
Copy link

Nic-Ma commented Sep 27, 2022

Hi @MMelQin ,

I just want to double confirm, will this early Oct release 0.5 be compatible with MONAI 1.0.0?

Thanks in advance.

@MMelQin
Copy link
Collaborator Author

MMelQin commented Sep 27, 2022

Hi @MMelQin ,

I just want to double confirm, will this early Oct release 0.5 be compatible with MONAI 1.0.0?

Thanks in advance.

Yes, @Nic-Ma , the App SDK v0.5 needs to be compatible with MONAI 1.0.0.

@MMelQin MMelQin moved this from In progress to Review in progress in v0.5.0 Oct 12, 2022
@MMelQin MMelQin moved this from Review in progress to Reviewer approved in v0.5.0 Oct 12, 2022
@MMelQin MMelQin moved this from Reviewer approved to Done in v0.5.0 Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
4 participants