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

Error AttributeError: 'CpnResNeXt101UNet' object has no attribute 'model' #19

Open
Flooooooooooooower opened this issue Nov 7, 2024 · 3 comments

Comments

@Flooooooooooooower
Copy link

Hello, dear Professor. I apologize for disturbing you, but I encountered the following error while using such an excellent software. I hope you can take the time to help me resolve it and reply. Once again, thank you very much.

apptainer exec  ~/00.Software/01.Docker/celldetection.sif python /app/cpn_inference.py -i input/01-01_GFP.tiff -o output/ -m '/home/xxx/16.Repoter_systerm/model/ginoro_CpnResNeXt101UNet-fbe875f1a3e5ce2c.pt'
Args: Namespace(inputs='input/01-01_GFP.tiff', outputs='output/', inputs_glob='*.*', inputs_method='imageio', inputs_dataset=None, models='/home/xxx/16.Repoter_systerm/model/ginoro_CpnResNeXt101UNet-fbe875f1a3e5ce2c.pt', devices='auto', accelerator='auto', strategy='auto', precision='32-true', num_workers=0, prefetch_factor=2, pin_memory=None, batch_size=1, tile_size=1024, stride=768, border_removal=4, stitching_rule='nms', min_vote=1, labels=False, flat_labels=False, demo_figure=False, truncated_images=False, properties=None, spacing=1.0, separator='-')
Unknown args: []
Summary:
  Number of inputs: 1
  Number of models: 1
  Output path: output/
  Workers: 0
  Devices: auto
GPU available: False, used: False
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
HPU available: False, using: 0 HPUs
/usr/local/lib/python3.10/site-packages/pytorch_lightning/trainer/connectors/logger_connector/logger_connector.py:67: UserWarning: Starting from v1.9.0, `tensorboardX` has been removed as a dependency of the `pytorch_lightning` package, due to potential conflicts with other packages in the ML ecosystem. For this reason, `logger=True` will use `CSVLogger` as the default logger, unless the `tensorboard` or `tensorboardX` packages are found. Please `pip install lightning[extra]` or one of them to enable TensorBoard support by default
  warning_cache.warn(
input/01-01_GFP.tiff --> output/01-01_GFP.*
Traceback (most recent call last):
  File "/app/cpn_inference.py", line 390, in <module>
    main()
  File "/app/cpn_inference.py", line 342, in main
    y = cd.asnumpy(apply_model(
  File "/app/cpn_inference.py", line 182, in apply_model
    nms_thresh = kwargs.get('nms_thresh', model.model.nms_thresh)
  File "/usr/local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1614, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'CpnResNeXt101UNet' object has no attribute 'model'
@ericup
Copy link
Collaborator

ericup commented Nov 7, 2024

Hello, I'm not a Professor, but thanks for creating this issue! :)
It looks like you are using an older version of celldetection.
With the latest version, you should not get this error.
Unfortunately our Docker images on Docker Hub are currently a bit behind, due to unresolved issues with the respective GitHub workflow.

For now I'd recommend to clone the repository and build an image yourself.
You can find two Dockerfiles here: https://github.com/FZJ-INM1-BDA/celldetection/tree/main/docker
One is based on python:3.10-buster, the other on Nvidia's nvcr.io/nvidia/pytorch:23.10-py3.
If you are using apptainer in an HPC environment, I'd recommend the latter.

Hope it helps!

@Flooooooooooooower
Copy link
Author

Hello, I apologize for disturbing you again. I tried installing with conda as you suggested, but encountered the following error. Could you give me some advice? I am using Python version 3.10.15.

conda install PyTorch
pip install -U celldetection -i https://pypi.tuna.tsinghua.edu.cn/simple/
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for simsimd
Failed to build simsimd
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (simsimd)

@ericup
Copy link
Collaborator

ericup commented Nov 11, 2024

I was suggesting to build your own Docker/Apptainer container, as I saw in your question that you were are already using Apptainer.
But you can also use conda of course.

However, I was unable to reproduce this error.
Also this seems to be an issue outside of this project.
Do you need to rely on this specific package index?
In the context of celldetection, simsimdis required by the albumentations package.
You may check their installation documentation or try installing different version of simsimd:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants