subhadarship / kmeans_pytorch

kmeans using PyTorch
https://subhadarship.github.io/kmeans_pytorch
MIT License
479 stars 77 forks source link

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

Open Beluooo-H opened 8 months ago

Beluooo-H commented 8 months ago

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

elephanta-jx commented 6 months ago

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.