Repository: Lightning-AI/torchmetrics

Issue:
TypeError: `NoTrainInceptionV3.__init__()` takes 1 positional argument but 4 were given
Hello, 

trying to init NoTrainInceptionV3  with latest version 

```
    feature_list=["2048"]
    inception = NoTrainInceptionV3(name="inception-v3-compat", features_list=feature_list)

```
but I get 

```
   445     raise TypeError("{}.__init__() got an unexpected keyword argument '{}'"
    446                     "".format(type(self).__name__, next(iter(kwargs))))
    448 if self.call_super_init is False and bool(args):
--> 449     raise TypeError("{}.__init__() takes 1 positional argument but {} were"
    450                     " given".format(type(self).__name__, len(args) + 1))
    452 """
    453 Calls super().__setattr__('a', a) instead of the typical self.a = a
    454 to avoid Module.__setattr__ overhead. Module's __setattr__ has special
    455 handling for parameters, submodules, and buffers but simply calls into
    456 super().__setattr__ for all other attributes.
    457 """
    458 super().__setattr__('training', True)

TypeError: NoTrainInceptionV3.__init__() takes 1 positional argument but 4 were given

```



Discussion:
@segalinc could you pls chare more details like what package versions you are using?
torchmetrics @ git+https://github.com/Lightning-AI/torchmetrics.git@0d7d6c7ccfedbb4941dfc55e65bbfca88506b2dc

I also tried with version 1.1.12 and 1.2.0

I am using python not conda 
I assume it's because you do not have torch-fidelity installed and it therefore is a dummy class that is trying to be initialized which does only take one argument.
@segalinc could you please confirm if this is true?
@Borda we should probably guard against this in some way 
Yes installing torch-fidelity solved the problem
Maybe adding this note in the readme.md or as requirements can help
thank you

Resolving patch:
diff --git a/src/torchmetrics/image/fid.py b/src/torchmetrics/image/fid.py
--- a/src/torchmetrics/image/fid.py
+++ b/src/torchmetrics/image/fid.py
@@ -55,6 +55,12 @@ def __init__(
         features_list: List[str],
         feature_extractor_weights_path: Optional[str] = None,
     ) -> None:
+        if not _TORCH_FIDELITY_AVAILABLE:
+            raise ModuleNotFoundError(
+                "NoTrainInceptionV3 module requires that `Torch-fidelity` is installed."
+                " Either install as `pip install torchmetrics[image]` or `pip install torch-fidelity`."
+            )
+
         super().__init__(name, features_list, feature_extractor_weights_path)
         # put into evaluation mode
         self.eval()


Test patch:
diff --git a/tests/unittests/image/test_fid.py b/tests/unittests/image/test_fid.py
--- a/tests/unittests/image/test_fid.py
+++ b/tests/unittests/image/test_fid.py
@@ -19,12 +19,21 @@
 import torch
 from torch.nn import Module
 from torch.utils.data import Dataset
-from torchmetrics.image.fid import FrechetInceptionDistance
+from torchmetrics.image.fid import FrechetInceptionDistance, NoTrainInceptionV3
 from torchmetrics.utilities.imports import _TORCH_FIDELITY_AVAILABLE, _TORCH_GREATER_EQUAL_1_9
 
 torch.manual_seed(42)
 
 
+@pytest.mark.skipif(_TORCH_FIDELITY_AVAILABLE, reason="test only works if torch-fidelity is not installed")
+def test_no_train_network_missing_torch_fidelity():
+    """Assert that NoTrainInceptionV3 raises an error if torch-fidelity is not installed."""
+    with pytest.raises(
+        ModuleNotFoundError, match="NoTrainInceptionV3 module requires that `Torch-fidelity` is installed.*"
+    ):
+        NoTrainInceptionV3(name="inception-v3-compat", features_list=["2048"])
+
+
 @pytest.mark.skipif(not _TORCH_GREATER_EQUAL_1_9, reason="test requires torch>=1.9")
 @pytest.mark.skipif(not _TORCH_FIDELITY_AVAILABLE, reason="test requires torch-fidelity")
 def test_no_train():