Skip to content

TypeError when using lung_nodule_ct_detection #492

Open
@fordanic

Description

Describe the bug
I have downloaded the lung_nodule_ct_detection bundle (0.5.9) and I try to follow the steps of https://docs.monai.io/projects/monai-deploy-app-sdk/en/latest/notebooks/tutorials/06_monai_bundle_app.html# to create a MAP using the downloaded bundle. Unfortunately, I fail already when trying to run the app locally, i.e., using something like:

app = LungNoduleDetectionApp()

app.run(
    input=str(input_dir),
    output=str(output_dir),
    model=str(model_dir),
)

This fails with the following error:

Going to initiate execution of operator MonaiBundleInferenceOperator
Executing operator MonaiBundleInferenceOperator (Process ID: 2193, Operator ID: 44d6d5d5-79ea-497e-bed5-469f23959f76)
/home/da-for/.pyenv/versions/monai/lib/python3.10/site-packages/monai/utils/deprecate_utils.py:321: FutureWarning: monai.transforms.io.dictionary LoadImaged.__init__:image_only: Current default value of argument `image_only=False` has been deprecated since version 1.1. It will be changed to `image_only=True` in version 1.3.
  warn_deprecated(argname, msg, warning_category)
/home/da-for/.pyenv/versions/monai/lib/python3.10/site-packages/monai/utils/deprecate_utils.py:221: FutureWarning: monai.transforms.utility.dictionary EnsureChannelFirstd.__init__:meta_key_postfix: Argument `meta_key_postfix` has been deprecated since version 0.9. not needed if image is type `MetaTensor`.
  warn_deprecated(argname, msg, warning_category)
Traceback (most recent call last):
  File "/home/da-for/code/byoai-workshop/workshops/monai-application-package/lung_nodule_ct_detection/run_model_locally.py", line 22, in <module>
    app.run(
  File "/home/da-for/code/byoai-workshop/workshops/monai-application-package/lung_nodule_ct_detection/app.py", line 52, in run
    super().run(*args, **kwargs)
  File "/home/da-for/.pyenv/versions/monai/lib/python3.10/site-packages/monai/deploy/core/application.py", line 429, in run
    executor_obj.run()
  File "/home/da-for/.pyenv/versions/monai/lib/python3.10/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/da-for/.pyenv/versions/monai/lib/python3.10/site-packages/monai/deploy/operators/monai_bundle_inference_operator.py", line 579, in compute
    outputs: Any = self.predict(data=first_input, **other_inputs)  # Use type Any to quiet MyPy complaints.
  File "/home/da-for/.pyenv/versions/monai/lib/python3.10/site-packages/monai/deploy/operators/monai_bundle_inference_operator.py", line 604, in predict
    return self._inferer(inputs=data, network=self._model_network, *args, **kwargs)
  File "/home/da-for/code/byoai-workshop/workshops/monai-application-package/lung_nodule_ct_detection/scripts/detection_inferer.py", line 55, in __call__
    self.detector.network = network
  File "/home/da-for/.pyenv/versions/monai/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1304, in __setattr__
    raise TypeError("cannot assign '{}' as child module '{}' "
TypeError: cannot assign 'monai.deploy.core.models.torch_model.TorchScriptModel' as child module 'network' (torch.nn.Module or None expected)

Environment
Windows 11 with WSL2 and Ubuntu 22.04

Ensuring you use the relevant python executable, please paste the output of:

MONAI version: 1.2.0
Numpy version: 1.22.2
Pytorch version: 1.13.1+cu117
MONAI flags: HAS_EXT = False, USE_COMPILED = False, USE_META_DICT = False
MONAI rev id: c33f1ba588ee00229a309000e888f9817b4f1934
MONAI __file__: /home/da-for/.pyenv/versions/monai/lib/python3.10/site-packages/monai/__init__.py

Optional dependencies:
Pytorch Ignite version: 0.4.9
ITK version: NOT INSTALLED or UNKNOWN VERSION.
Nibabel version: 4.0.1
scikit-image version: 0.21.0
Pillow version: 10.0.0
Tensorboard version: NOT INSTALLED or UNKNOWN VERSION.
gdown version: NOT INSTALLED or UNKNOWN VERSION.
TorchVision version: 0.14.1+cu117
tqdm version: 4.66.1
lmdb version: NOT INSTALLED or UNKNOWN VERSION.
psutil version: 5.9.5
pandas version: 2.0.3
einops version: NOT INSTALLED or UNKNOWN VERSION.
transformers version: NOT INSTALLED or UNKNOWN VERSION.
mlflow version: NOT INSTALLED or UNKNOWN VERSION.
pynrrd version: NOT INSTALLED or UNKNOWN VERSION.

For details about installing the optional dependencies, please visit:
    https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies

System: Linux
Linux version: Ubuntu 22.04.3 LTS
Platform: Linux-6.1.21.1-microsoft-standard-WSL2+-x86_64-with-glibc2.35
Processor: x86_64
Machine: x86_64
Python version: 3.10.4
Process name: python
Command: ['/home/da-for/.pyenv/versions/monai/bin/python', '-c', 'import monai; monai.config.print_debug_info()']
Open files: []
Num physical CPUs: 2
Num logical CPUs: 4
Num usable CPUs: 4
CPU usage (%): [7.8, 7.3, 8.2, 100.0]
CPU freq. (MHz): 2304
Load avg. in last 1, 5, 15 mins (%): [0.7, 1.1, 0.3]
Disk usage (%): 27.3
Avg. sensor temp. (Celsius): UNKNOWN for given OS
Total physical memory (GB): 15.6
Available memory (GB): 12.2
Used memory (GB): 3.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions