kmeans_pytorch icon indicating copy to clipboard operation
kmeans_pytorch copied to clipboard

TypeError: kmeans() got an unexpected keyword argument 'cluster_centers'

Open Beluooo-H opened this issue 1 year ago • 1 comments

x_batch size is [100,256,3,3], len(x_batch) is 400,I want to use these datas to get the cluster is 100 of kmeans. When it is not the first time, I want to choose the preview cluster_centers to retrain(According example). But I got the below error. What should I do? Thankes! image

Beluooo-H avatar Mar 12 '24 06:03 Beluooo-H

I had the same issue in my environment. My problem was that I installed the kmeans package via pip install kmeans-pytorch. For some reasons, the actual kmeans function in the package was a cpu version of kmeans_pytorch. It did not accept 'cluster_centers' argument. You can check the source code of your kmeans function and make sure it is the one shown on github. My fix was quite simple. What I did was using git to download the package and installed it locally.

elephanta-jx avatar Apr 25 '24 01:04 elephanta-jx