Lightning-AI / torchmetrics

Torchmetrics - Machine learning metrics for distributed, scalable PyTorch applications.
https://lightning.ai/docs/torchmetrics/
Apache License 2.0
2.1k stars 401 forks source link

Cannot import the "clustering" module #2621

Closed Sinjini15 closed 2 months ago

Sinjini15 commented 3 months ago

🐛 Cannot import the "clustering" module ~even though I have the latest version of torchmetrics~

To Reproduce

from torchmetrics.clustering import VMeasureScore

Running this command gives me the following error:

from torchmetrics.clustering import VMeasureScore ModuleNotFoundError: No module named 'torchmetrics.clustering'

Expected behavior

I hope to import this module because I need it to calculate some metrics.

Environment

Additional context

I did some digging and found that after I install the torchmetrics package, the "clustering" module is missing from the installation


Attributes in torchmetrics: ['AUROC', 'Accuracy', 'AveragePrecision', 'BLEUScore', 'BootStrapper', 'CHRFScore', 
'CalibrationError', 'CatMetric', 'CharErrorRate', 'ClasswiseWrapper', 'CohenKappa', 'ConcordanceCorrCoef', 'ConfusionMatrix', 
'CosineSimilarity', 'CramersV', 'Dice', 'ErrorRelativeGlobalDimensionlessSynthesis', 'ExactMatch', 'ExplainedVariance', 'ExtendedEditDistance',
'F1Score', 'FBetaScore', 'HammingDistance', 'HingeLoss', 'JaccardIndex', 'KLDivergence', 'KendallRankCorrCoef', 'LogCoshError', 
'MatchErrorRate', 'MatthewsCorrCoef', 'MaxMetric', 'MeanAbsoluteError', 'MeanAbsolutePercentageError', 'MeanMetric', 
'MeanSquaredError', 'MeanSquaredLogError', 'Metric', 'MetricCollection', 'MetricTracker', 'MinMaxMetric', 'MinMetric', 
'MultiScaleStructuralSimilarityIndexMeasure', 'MultioutputWrapper', 'PeakSignalNoiseRatio', 'PearsonCorrCoef', 
'PearsonsContingencyCoefficient', 'PermutationInvariantTraining', 'Perplexity', 'Precision', 'PrecisionRecallCurve', 
'R2Score', 'ROC', 'Recall', 'RetrievalFallOut', 'RetrievalHitRate', 'RetrievalMAP', 'RetrievalMRR', 'RetrievalNormalizedDCG', 
'RetrievalPrecision', 'RetrievalPrecisionRecallCurve', 'RetrievalRPrecision', 'RetrievalRecall', 'RetrievalRecallAtFixedPrecision', 
'SQuAD', 'SacreBLEUScore', 'ScaleInvariantSignalDistortionRatio',
 'ScaleInvariantSignalNoiseRatio', 'SignalDistortionRatio', 'SignalNoiseRatio', 'SpearmanCorrCoef', 'Specificity', 
'SpectralAngleMapper', 'SpectralDistortionIndex', 'StatScores', 
'StructuralSimilarityIndexMeasure', 'SumMetric', 'SymmetricMeanAbsolutePercentageError',
 'TheilsU', 'TotalVariation', 'TranslationEditRate', 'TschuprowsT', 
'TweedieDevianceScore', 'UniversalImageQualityIndex', 
'WeightedMeanAbsolutePercentageError', 'WordErrorRate', 'WordInfoLost', 
'WordInfoPreserved', '_PACKAGE_ROOT', '_PROJECT_ROOT', '__about__', '__all__', '__author__', '__author_email__',
 '__builtins__', '__cached__', '__copyright__', '__doc__', '__docs__', '__docs_url__', 
'__file__', '__homepage__', '__license__', '__loader__', '__logging', 
'__name__', '__package__', '__path__', '__spec__', '__version__', '_logger', 'aggregation',
 'audio', 'classification', 'collections', 'functional', 'image', 'metric', 
'nominal', 'os', 'regression', 'retrieval', 'text', 'utilities', 'wrappers']
No clustering module found in torchmetrics.
Torchmetrics path: ['/home/smitra16/anaconda3/envs/audiodiff/lib/python3.7/site-packages/torchmetrics']
Contents of torchmetrics directory: ['regression', 'metric.py', 'wrappers', '__about__.py', 
'collections.py', 'aggregation.py', 'classification', 'functional', 'image', 
'audio', 'py.typed', '__init__.py', 'utilities', 'nominal', 'multimodal', 'retrieval', 'text', '__pycache__', 'detection']```
github-actions[bot] commented 3 months ago

Hi! thanks for your contribution!, great first issue!

Borda commented 3 months ago

Thank you for reaching out, please use latest version...

Sinjini15 commented 3 months ago

Thank you for reaching out, please use latest version...

Hi, after running the pip upgrade command it says 0.11.4 is the latest version of torchmetrics. Is there a newer one? How do I install it if so?

Borda commented 3 months ago

How do I install it if so?

https://pypi.org/project/torchmetrics/

stancld commented 2 months ago

Hi @Sinjini15, as of torchmetrics>=1.0, we support python>=3.8. It is, therefore, necessary to upgrade your python if you want to make use of the newest torchmetrics versions and their features.