mlx-cluster 0.0.1__cp311-cp311-macosx_14_0_arm64.whl

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.
@@ -0,0 +1,4 @@
1
+ import mlx.core as mx
2
+
3
+ from ._ext import random_walk
4
+ from ._ext import rejection_sampling
Binary file
Binary file
Binary file
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 vinayhpandya
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,74 @@
1
+ Metadata-Version: 2.1
2
+ Name: mlx_cluster
3
+ Version: 0.0.1
4
+ Summary: C++ and Metal extensions for MLX CTC Loss
5
+ Author-email: Vinay Pandya <vinayharshadpandya27@gmail.com>
6
+ Project-URL: Homepage, https://github.com/vinayhpandya/mlx_cluster
7
+ Project-URL: Issues, https://github.com/vinayhpandya/mlx_cluster/Issues
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: C++
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Provides-Extra: dev
17
+ Provides-Extra: test
18
+ Requires-Dist: torch-geometric ; extra == 'test'
19
+ Requires-Dist: pytest ; extra == 'test'
20
+
21
+ # mlx_cluster
22
+
23
+ A C++ extension for generating ramdom walks for Homogeneous graphs using mlx
24
+
25
+ ## Installation
26
+
27
+ To install the necessary dependencies:
28
+
29
+ Clone the repositories:
30
+ ```bash
31
+ git clone https://github.com/vinayhpandya/mlx_cluster.git
32
+ ```
33
+
34
+ After cloning the repository install library using
35
+
36
+ ```bash
37
+ python setup.py build_ext -j8 --inplace
38
+ ```
39
+
40
+ for testing purposes you need to have `mlx-graphs` installed
41
+
42
+ ## Usage
43
+
44
+
45
+ ```
46
+ from mlx_graphs.utils.sorting import sort_edge_index
47
+ from mlx_graphs.loaders import Dataloader
48
+ from mlx_graphs_extension import random_walk
49
+
50
+
51
+ cora_dataset = PlanetoidDataset(name="cora", base_dir="~")
52
+ start = mx.arange(0, 1000)
53
+ start_time = time.time()
54
+ edge_index = cora_dataset.graphs[0].edge_index
55
+ num_nodes = cora_dataset.graphs[0].num_nodes
56
+ sorted_edge_index = sort_edge_index(edge_index=edge_index)
57
+ row_mlx = sorted_edge_index[0][0]
58
+ col_mlx = sorted_edge_index[0][1]
59
+ unique_vals, counts_mlx = np.unique(np.array(row_mlx, copy=False), return_counts=True)
60
+ cum_sum_mlx = counts_mlx.cumsum()
61
+ rand = mx.random.uniform(shape=[start.shape[0], 100])
62
+ row_ptr_mlx = mx.concatenate([mx.array([0]), mx.array(cum_sum_mlx)])
63
+ random_walk(row_ptr_mlx, col_mlx, start, rand, 1000, stream = mx.gpu)
64
+ ```
65
+
66
+ ## TODO
67
+
68
+ - [x] Add metal shaders to optimize the code
69
+ - [ ] Benchmark random walk against different frameworks
70
+ - [ ] Add more algorithms
71
+
72
+ ## Credits:
73
+
74
+ torch_cluster random walk implementation : [random_walk](https://github.com/rusty1s/pytorch_cluster/blob/master/csrc/cpu/rw_cpu.cpp)
@@ -0,0 +1,9 @@
1
+ mlx_cluster/__init__.py,sha256=PNgjmiw5F4DRhwCXwtJH5B22C-eB6dVD8Nqctj_3kaY,90
2
+ mlx_cluster/_ext.cpython-311-darwin.so,sha256=_puyYR4x5DK3RtvrOwvkbpwOKGm5d2WqqIfCTGQIPNA,132360
3
+ mlx_cluster/libmlx_cluster.dylib,sha256=b7YcEY6lj7bdco_9P-EOU5uccRpa6j17MrX7Z9ljtTU,68808
4
+ mlx_cluster/mlx_cluster.metallib,sha256=ysmhLDXKt7OvwRS4cQZhn9c1Mwxji29gpCvFKwh3Df4,5416
5
+ mlx_cluster-0.0.1.dist-info/LICENSE,sha256=7ixsoVuroKzGl84-ZV90CDH6bQrQF2UXvgnTqtW4Zb4,1069
6
+ mlx_cluster-0.0.1.dist-info/METADATA,sha256=bGWxSL6z-m4faVhSxNx2Z5G78aoBemy7BGXJqMfQfyA,2254
7
+ mlx_cluster-0.0.1.dist-info/WHEEL,sha256=j3-yksFZs2SDtXJbm_EOXsPslt0JPXMfrvzk2bCbj2A,109
8
+ mlx_cluster-0.0.1.dist-info/top_level.txt,sha256=sERi0kZuQnKmsHnqOkAda1kkBXdQAwV25Y9L-ATj110,12
9
+ mlx_cluster-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.1.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp311-cp311-macosx_14_0_arm64
5
+
@@ -0,0 +1 @@
1
+ mlx_cluster