Failed to import from `torchmetrics.image.lpip`
bug / fixhelp wanted
## 🐛 Bug
Even importing TM with the latest Torch and TorchVision on GPU fails, I just do it with kaggle
### To Reproduce
```py
from torchmetrics.image.lpip import LearnedPerceptualImagePatchSimilarity
```
<details>
<summary>Code sample</summary>
```
/usr/local/lib/python3.11/dist-packages/torchmetrics/__init__.py in <module>
35 scipy.signal.hamming = scipy.signal.windows.hamming
36
---> 37 from torchmetrics import functional # noqa: E402
38 from torchmetrics.aggregation import ( # noqa: E402
39 CatMetric,
/usr/local/lib/python3.11/dist-packages/torchmetrics/functional/__init__.py in <module>
54 )
55 from torchmetrics.functional.detection._deprecated import _panoptic_quality as panoptic_quality
---> 56 from torchmetrics.functional.image._deprecated import (
57 _error_relative_global_dimensionless_synthesis as error_relative_global_dimensionless_synthesis,
58 )
/usr/local/lib/python3.11/dist-packages/torchmetrics/functional/image/__init__.py in <module>
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
---> 14 from torchmetrics.functional.image.arniqa import arniqa
15 from torchmetrics.functional.image.d_lambda import spectral_distortion_index
16 from torchmetrics.functional.image.d_s import spatial_distortion_index
/usr/local/lib/python3.11/dist-packages/torchmetrics/functional/image/arniqa.py in <module>
29
30 if _TORCHVISION_AVAILABLE:
---> 31 from torchvision import transforms
32 from torchvision.models import resnet50
33
/usr/local/lib/python3.11/dist-packages/torchvision/__init__.py in <module>
8 # .extensions) before entering _meta_registrations.
9 from .extension import _HAS_OPS # usort:skip
---> 10 from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils # usort:skip
11
12 try:
/usr/local/lib/python3.11/dist-packages/torchvision/_meta_registrations.py in <module>
23
24
---> 25 @register_meta("roi_align")
26 def meta_roi_align(input, rois, spatial_scale, pooled_height, pooled_width, sampling_ratio, aligned):
27 torch._check(rois.size(1) == 5, lambda: "rois must have shape as Tensor[K, 5]")
/usr/local/lib/python3.11/dist-packages/torchvision/_meta_registrations.py in wrapper(fn)
16 def register_meta(op_name, overload_name="default"):
17 def wrapper(fn):
---> 18 if torchvision.extension._has_ops():
19 get_meta_lib().impl(getattr(getattr(torch.ops.torchvision, op_name), overload_name), fn)
20 return fn
AttributeError: partially initialized module 'torchvision' has no attribute 'extension' (most likely due to a circular import)
```
</details>
<details>
<summary>Environment</summary>
```
torch 2.9.1
torchao 0.10.0
torchaudio 2.6.0+cu124
torchdata 0.11.0
torchinfo 1.8.0
torchmetrics 1.8.2
torchsummary 1.5.1
torchtune 0.6.1
torchvision 0.24.1
```
</details>
### Additional context
<!-- Add any other context about the problem here. -->
0 条评论