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 in training example #23

Closed
robmarkcole opened this issue Aug 11, 2021 · 3 comments
Closed

Error in training example #23

robmarkcole opened this issue Aug 11, 2021 · 3 comments

Comments

@robmarkcole
Copy link

Following the example from the README:

ValueError                                Traceback (most recent call last)
<ipython-input-11-f854c515c2ab> in <module>()
----> 1 trainer.fit(model, datamodule=dm)

23 frames
/usr/local/lib/python3.7/dist-packages/torchmetrics/functional/classification/stat_scores.py in _stat_scores_update(preds, target, reduce, mdmc_reduce, num_classes, top_k, threshold, multiclass, ignore_index)
    123         if not mdmc_reduce:
    124             raise ValueError(
--> 125                 "When your inputs are multi-dimensional multi-class, you have to set the `mdmc_reduce` parameter"
    126             )
    127         if mdmc_reduce == "global":

ValueError: When your inputs are multi-dimensional multi-class, you have to set the `mdmc_reduce` parameter
@isaaccorley
Copy link
Owner

isaaccorley commented Aug 11, 2021

That's odd. I made an example recently that uses the same setup under examples/levircd+.ipynb and didn't run into that error.

When I get a chance I'll try running it locally.

@robmarkcole
Copy link
Author

robmarkcole commented Aug 12, 2021

I launched the examples/levircd+.ipynb straight to colab and hit exactly the same issue there.!

1.4 M     Trainable params
0         Non-trainable params
1.4 M     Total params
5.402     Total estimated model params size (MB)
Validation sanity check: 0%
0/2 [00:00<?, ?it/s]
/usr/local/lib/python3.7/dist-packages/pytorch_lightning/trainer/data_loading.py:106: UserWarning: The dataloader, val dataloader 0, does not have many workers which may be a bottleneck. Consider increasing the value of the `num_workers` argument` (try 4 which is the number of cpus on this machine) in the `DataLoader` init to improve performance.
  f"The dataloader, {name}, does not have many workers which may be a bottleneck."
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-17-f854c515c2ab> in <module>()
----> 1 trainer.fit(model, datamodule=dm)

23 frames
/usr/local/lib/python3.7/dist-packages/torchmetrics/functional/classification/stat_scores.py in _stat_scores_update(preds, target, reduce, mdmc_reduce, num_classes, top_k, threshold, multiclass, ignore_index)
    123         if not mdmc_reduce:
    124             raise ValueError(
--> 125                 "When your inputs are multi-dimensional multi-class, you have to set the `mdmc_reduce` parameter"
    126             )
    127         if mdmc_reduce == "global":

ValueError: When your inputs are multi-dimensional multi-class, you have to set the `mdmc_reduce` parameter

However the good news is I dont have any issue with examples/probav.ipynb

@isaaccorley
Copy link
Owner

Looks like the latest torchmetrics==0.5.0 version required a new parameter for computing Accuracy, Precision, Recall on 2D segmentation mask output. Just had to add mdmc_average="global" to each of the metrics in the lightning modules. I'm able to train now so seems like it's fixed. See #25

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