fastkmeans 0.2.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastkmeans
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: Add your description here
5
5
  Author-email: Ben Clavié <bc@answer.ai>, Benjamin Warner <bw@answer.ai>
6
6
  Maintainer-email: Ben Clavié <bc@answer.ai>, Benjamin Warner <bw@answer.ai>
@@ -1,4 +1,4 @@
1
1
  from .kmeans import FastKMeans
2
2
 
3
3
  __all__ = ["FastKMeans"]
4
- __version__ = "0.2.0"
4
+ __version__ = "0.3.0"
@@ -3,8 +3,6 @@ import time
3
3
  import torch
4
4
  import numpy as np
5
5
 
6
- from fastkmeans.triton_kernels import chunked_kmeans_kernel
7
-
8
6
  def _get_device(preset: str | int | torch.device | None = None):
9
7
  if isinstance(preset, torch.device):
10
8
  return preset
@@ -53,6 +51,9 @@ def _kmeans_torch_double_chunked(
53
51
  Where n_samples_used can be smaller than the original if subsampling occurred.
54
52
  """
55
53
 
54
+ if use_triton:
55
+ from fastkmeans.triton_kernels import chunked_kmeans_kernel
56
+
56
57
  if dtype is None:
57
58
  dtype = torch.float16 if device.type in ['cuda', 'xpu'] else torch.float32
58
59
 
@@ -274,6 +275,8 @@ class FastKMeans:
274
275
  -------
275
276
  labels : np.ndarray of shape (n_samples,), int64
276
277
  """
278
+ if self.use_triton:
279
+ from fastkmeans.triton_kernels import chunked_kmeans_kernel
277
280
  if self.centroids is None:
278
281
  raise RuntimeError("Must call train() or fit() before predict().")
279
282
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastkmeans
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: Add your description here
5
5
  Author-email: Ben Clavié <bc@answer.ai>, Benjamin Warner <bw@answer.ai>
6
6
  Maintainer-email: Ben Clavié <bc@answer.ai>, Benjamin Warner <bw@answer.ai>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fastkmeans"
3
- version = "0.2.0"
3
+ version = "0.3.0"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.8"
File without changes
File without changes
File without changes