Lightning-Universe/lightning-flash

`pip install "lightning-flash[image]==0.8.1"` installs incompatible version of torchmetrics (`==0.11.0`)

yurijmikhalevich opened this issue ยท 3 comments

๐Ÿ› Bug

Doing pip install "lightning-flash[image]==0.8.1" installs torchmetrics==0.11.0 which is incompatible with the latest lightning-flash. This is stated in the lightning-flash requirements.txt, but isn't respected by setup.py ๐Ÿค”:

https://github.com/Lightning-AI/lightning-flash/blob/cf969bcbab349c027f208168973110544c672358/requirements.txt#L5

Installing torchmetrics==0.10.3 fixes the error.

To Reproduce

  1. Create a new project
  2. Install pip install "lightning-flash[image]==0.8.1"
  3. Try running an example from this page https://lightning-flash.readthedocs.io/en/latest/reference/image_classification.html
  4. Get an error:
Traceback (most recent call last):
  File "train.py", line 20, in <module>
    model = ImageClassifier(backbone="resnet18", labels=datamodule.labels)
  File "/Users/yurij/miniforge3/envs/japanese-reader/lib/python3.8/site-packages/flash/image/classification/model.py", line 143, in __init__
    super().__init__(
  File "/Users/yurij/miniforge3/envs/japanese-reader/lib/python3.8/site-packages/flash/core/classification.py", line 120, in __init__
    metrics, loss_fn = self._build(num_classes, labels, loss_fn, metrics, multi_label)
  File "/Users/yurij/miniforge3/envs/japanese-reader/lib/python3.8/site-packages/flash/core/classification.py", line 67, in _build
    metrics = F1Score(num_classes) if (multi_label and num_classes) else Accuracy()
TypeError: __new__() missing 1 required positional argument: 'task'

Expected behavior

No error. Example runs.

Environment

  • OS (e.g., Linux): macOS
  • Python version: 3.8.1
  • PyTorch/Lightning/Flash Version (e.g., 1.10/1.5/0.7):
  • GPU models and configuration:
  • Any other relevant information:

I saw that 34caca4 hadn't been released yet. Leaving this issue open until the fix is out.

Borda commented

I saw that 34caca4 hadn't been released yet. Leaving this issue open until the fix is out.

ok, let's make one post with pining versions also 1e3395f