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

Reformat notebooks #874

Merged
merged 3 commits into from
Aug 9, 2020
Merged

Conversation

ghost
Copy link

@ghost ghost commented Aug 7, 2020

Description

  • Incorporate pip installs into the notebook [TypeError in transforms notebook #851]
  • Incorporate dataset download into the notebook
  • Add an environmental variable to choose directory
  • Use a temporary directory as a fall back
  • Remove unused imports
  • Apply isort and black formatting
  • Replace %-formatting with f-string
  • Unify section order, naming, contents
  • Clear display for overly long outputs

Status

Ready

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).

Benjamin Gorman added 2 commits August 7, 2020 10:38
- Incorporate pip installs into the notebook
- Incorporate dataset download into the notebook
- Add an environmental variable to choose directory
- Use a temporary directory as a fall back
- Remove unused imports
- Apply isort and black formatting
- Replace %-formatting with f-string
- Unify section order, naming, contents
- Clear display for overly long outputs
@Nic-Ma Nic-Ma requested a review from wyli August 7, 2020 15:50
@ghost
Copy link
Author

ghost commented Aug 7, 2020

There may be a bug in spleen_segmentation_3d_lightning.ipynb.
See "Check best model output with the input image and label".

RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same

@ghost ghost force-pushed the reformat-notebooks branch from 69c052d to 0c37483 Compare August 7, 2020 17:10
@gagandaroach
Copy link
Contributor

There may be a bug in spleen_segmentation_3d_lightning.ipynb.
See "Check best model output with the input image and label".

RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same

I ran into this problem before. I was able to fix it in the notebook by sending the net to the gpu device. In the last cell, add a net.to(device) line like this

net.eval()
device = torch.device("cuda:0")
net.to(device)
with torch.no_grad():
    for i, val_data in enumerate(net.val_dataloader()):

The weight tensor is on cpu and the incoming tensor is on the gpu. Hard for the computer to multiply those together :)

@wyli
Copy link
Contributor

wyli commented Aug 9, 2020

There may be a bug in spleen_segmentation_3d_lightning.ipynb.
See "Check best model output with the input image and label".

RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same

I ran into this problem before. I was able to fix it in the notebook by sending the net to the gpu device. In the last cell, add a net.to(device) line like this

net.eval()
device = torch.device("cuda:0")
net.to(device)
with torch.no_grad():
    for i, val_data in enumerate(net.val_dataloader()):

The weight tensor is on cpu and the incoming tensor is on the gpu. Hard for the computer to multiply those together :)

please could you file an issue about it

@wyli wyli merged commit 5d6ee8f into Project-MONAI:master Aug 9, 2020
@ghost ghost deleted the reformat-notebooks branch August 10, 2020 15:10
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.

2 participants