Skip to content

Conversation

@yiheng-wang-nv
Copy link
Contributor

Signed-off-by: yiheng-wang-nv vennw@nvidia.com

Fixes #1157 .

Status

Ready

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh --codeformat --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

Signed-off-by: yiheng-wang-nv <vennw@nvidia.com>
@wyli
Copy link
Contributor

wyli commented Jan 6, 2021

/black

Copy link
Contributor

@wyli wyli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@wyli wyli merged commit 115f146 into Project-MONAI:master Jan 6, 2021
@sdesutter
Copy link

I was trying to import DiceCELoss as I found it in the documentation of MONAI, but I keep receiving an ImportError. Does this mean this is still in progress or might there be some kind of issue?

Thanks!

@yiheng-wang-nv yiheng-wang-nv deleted the 1157-dice-ce-loss branch January 8, 2021 10:21
@yiheng-wang-nv
Copy link
Contributor Author

I was trying to import DiceCELoss as I found it in the documentation of MONAI, but I keep receiving an ImportError. Does this mean this is still in progress or might there be some kind of issue?

Thanks!

Hi @sdesutter , could you post the error message here? The loss should be imported without errors as the corresponding unit test checked. I just downloaded the latest docker image ( docker pull projectmonai/monai:latest ) and tried to import this loss function and it also worked.

@sdesutter
Copy link

I was trying to import DiceCELoss as I found it in the documentation of MONAI, but I keep receiving an ImportError. Does this mean this is still in progress or might there be some kind of issue?
Thanks!

Hi @sdesutter , could you post the error message here? The loss should be imported without errors as the corresponding unit test checked. I just downloaded the latest docker image ( docker pull projectmonai/monai:latest ) and tried to import this loss function and it also worked.

The error I'm getting is:
ImportError: cannot import name 'DiceCELoss' from 'monai.losses' (/opt/anaconda3/lib/python3.7/site-packages/monai/losses/init.py)

@rijobro
Copy link
Contributor

rijobro commented Jan 8, 2021

Inside of python, could you run:

import monai
monai.config.print_config()

I wonder if, for example, you are using an older version of the code.

@sdesutter
Copy link

Inside of python, could you run:

import monai
monai.config.print_config()

I wonder if, for example, you are using an older version of the code.

This is what I got:

MONAI version: 0.4.0
Numpy version: 1.17.2+intel.0
Pytorch version: 1.5.1
MONAI flags: HAS_EXT = False, USE_COMPILED = False
MONAI rev id: 0563a44

Optional dependencies:
Pytorch Ignite version: 0.3.0
Nibabel version: 3.0.2
scikit-image version: 0.15.0
Pillow version: 6.2.0
Tensorboard version: 2.0.2
gdown version: NOT INSTALLED or UNKNOWN VERSION.
TorchVision version: 0.6.1
ITK version: NOT INSTALLED or UNKNOWN VERSION.
tqdm version: 4.50.2
lmdb version: NOT INSTALLED or UNKNOWN VERSION.
psutil version: 5.6.3

@rijobro
Copy link
Contributor

rijobro commented Jan 8, 2021

Ok, you're using version 0.4.0, and this feature was implemented after that. You'll probably want the master branch:

pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI

Once you have the master branch, the printed config output should have something like:

MONAI version: 0.4.0+22.ga4ef691

Here, 22 is the number of commits since the previous tag, 0.4.0, and ga4ef691 is the most recent git commit hash.

@sdesutter
Copy link

Ok, you're using version 0.4.0, and this feature was implemented after that. You'll probably want the master branch:

pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI

Once you have the master branch, the printed config output should have something like:

MONAI version: 0.4.0+22.ga4ef691

Here, 22 is the number of commits since the previous tag, 0.4.0, and ga4ef691 is the most recent git commit hash.

This worked, the import is working now.
Thanks a lot for your help!

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

Successfully merging this pull request may close these issues.

Dice + Cross entropy loss

4 participants