deep-atomic 0.2.0__tar.gz → 0.2.1__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.
- deep_atomic-0.2.1/.pre-commit-config.yaml +7 -0
- {deep_atomic-0.2.0 → deep_atomic-0.2.1}/PKG-INFO +20 -11
- {deep_atomic-0.2.0 → deep_atomic-0.2.1}/README.md +17 -9
- {deep_atomic-0.2.0 → deep_atomic-0.2.1}/pyproject.toml +9 -3
- {deep_atomic-0.2.0 → deep_atomic-0.2.1}/src/deep_atomic/__init__.py +2 -2
- {deep_atomic-0.2.0 → deep_atomic-0.2.1}/src/deep_atomic/graph.py +162 -155
- deep_atomic-0.2.1/src/deep_atomic/nn.py +381 -0
- deep_atomic-0.2.1/src/deep_atomic/op.py +277 -0
- deep_atomic-0.2.1/src/deep_atomic/optimizer.py +12 -0
- {deep_atomic-0.2.0 → deep_atomic-0.2.1}/src/deep_atomic/tensor.py +90 -78
- {deep_atomic-0.2.0 → deep_atomic-0.2.1}/src/deep_atomic/utils.py +3 -2
- deep_atomic-0.2.1/tests/conftest.py +44 -0
- deep_atomic-0.2.1/tests/init_test.py +41 -0
- deep_atomic-0.2.1/tests/op_test.py +398 -0
- {deep_atomic-0.2.0 → deep_atomic-0.2.1}/tests/utils.py +10 -12
- deep_atomic-0.2.1/uv.lock +797 -0
- deep_atomic-0.2.0/src/deep_atomic/op.py +0 -230
- deep_atomic-0.2.0/tests/backward_test.py +0 -686
- deep_atomic-0.2.0/tests/init_test.py +0 -40
- deep_atomic-0.2.0/tests/op_test.py +0 -492
- deep_atomic-0.2.0/uv.lock +0 -1249
- {deep_atomic-0.2.0 → deep_atomic-0.2.1}/.github/workflows/publish-pypi.yml +0 -0
- {deep_atomic-0.2.0 → deep_atomic-0.2.1}/.gitignore +0 -0
- {deep_atomic-0.2.0 → deep_atomic-0.2.1}/.vscode/settings.json +0 -0
- {deep_atomic-0.2.0 → deep_atomic-0.2.1}/LICENSE +0 -0
- {deep_atomic-0.2.0 → deep_atomic-0.2.1}/tests/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: deep_atomic
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: A simple deep learning framework built upon numpy only
|
|
5
5
|
Author-email: Elliot Zhang <elliot_zh@proton.me>
|
|
6
6
|
License: MIT
|
|
@@ -8,11 +8,12 @@ License-File: LICENSE
|
|
|
8
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
9
9
|
Classifier: Operating System :: OS Independent
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Requires-Python: >=3.
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
12
|
Requires-Dist: numpy>=1.24.4
|
|
13
13
|
Requires-Dist: pytest>=8.3.5
|
|
14
14
|
Provides-Extra: dev
|
|
15
15
|
Requires-Dist: black>=23.0; extra == 'dev'
|
|
16
|
+
Requires-Dist: pre-commit>=4.6.0; extra == 'dev'
|
|
16
17
|
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
|
|
17
18
|
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
18
19
|
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
@@ -80,13 +81,13 @@ c = da.maximum(a, b)
|
|
|
80
81
|
c = da.fmin(a, b)
|
|
81
82
|
c = da.minimum(a, b)
|
|
82
83
|
|
|
83
|
-
c = d
|
|
84
|
-
c = d
|
|
85
|
-
c = d
|
|
86
|
-
c = da.logical_not(d)
|
|
87
|
-
c = d.all(axis=-1)
|
|
88
|
-
c = d.any(axis=-1)
|
|
89
|
-
c = da.where(d, a, b)
|
|
84
|
+
c = da.logical_and(d, e) # element-wise and
|
|
85
|
+
c = da.logical_or(d, e) # element-wise or
|
|
86
|
+
c = da.logical_xor(d, e) # element-wise xor
|
|
87
|
+
c = da.logical_not(d) # element-wise not
|
|
88
|
+
c = d.all(axis=-1, keepdims=False) # reduction of and operation. axis=None, keepdims=False by default
|
|
89
|
+
c = d.any(axis=-1, keepdims=False) # reduction of or operation. axis=None, keepdims=False by default
|
|
90
|
+
c = da.where(d, a, b) # return elements chosen from a or b depending on condition
|
|
90
91
|
|
|
91
92
|
c = da.topk(a, 2, axis=-1, largest=True) # same as pytorch. axis=-1, largest=True by default
|
|
92
93
|
|
|
@@ -94,6 +95,7 @@ c = da.sum(a) # shape: (1,)
|
|
|
94
95
|
c = da.sum(a, axis=1) # shape: (3,)
|
|
95
96
|
c = da.sum(a, axis=1, keepdims=True) # shape: (3, 1)
|
|
96
97
|
# min, max, argmin, argmax follow the same signature
|
|
98
|
+
# all reductions set axis=None, keepdims=False by default
|
|
97
99
|
|
|
98
100
|
c = da.softmax(a, axis=-1, temperature=0.6) # support temperature. temperature=1 by default
|
|
99
101
|
c = da.log_softmax(a, axis=-1, temperature=0.6)
|
|
@@ -132,22 +134,29 @@ print(res.grad) # gradient get!
|
|
|
132
134
|
- [x] gather or take_along_axis
|
|
133
135
|
- [ ] scatter
|
|
134
136
|
- [ ] convolution and 2d convolution
|
|
137
|
+
- [ ] pooling
|
|
138
|
+
- [ ] softmax attention
|
|
135
139
|
- [ ] direct masking and indexing via `[]` syntax
|
|
136
140
|
- [ ] einsum
|
|
141
|
+
- [ ] normalization
|
|
137
142
|
- [ ] support backward with Vector-Jacobian Product like pytorch
|
|
138
|
-
- [ ] basic neural network
|
|
143
|
+
- [ ] basic neural network modules
|
|
139
144
|
- [ ] optimizers and loss functions
|
|
145
|
+
- [ ] dataset pipelines
|
|
146
|
+
- [ ] save and load state dict file
|
|
140
147
|
- [ ] full training test
|
|
141
148
|
- [ ] benchmark with pytorch on CPU
|
|
142
|
-
- [ ]
|
|
149
|
+
- [ ] full LLM training
|
|
143
150
|
- [ ] finer type annotations, comments and documentation
|
|
144
151
|
|
|
145
152
|
## Development
|
|
146
153
|
|
|
147
154
|
Recommend manage dependencies using [uv](https://github.com/astral-sh/uv).
|
|
155
|
+
We use [pre-commit](https://github.com/pre-commit/pre-commit) to manage hooks which help to lint and format our code.
|
|
148
156
|
|
|
149
157
|
```bash
|
|
150
158
|
uv sync
|
|
159
|
+
pre-commit install # install pre-commit git hooks for lint and format
|
|
151
160
|
```
|
|
152
161
|
|
|
153
162
|
Run tests:
|
|
@@ -60,13 +60,13 @@ c = da.maximum(a, b)
|
|
|
60
60
|
c = da.fmin(a, b)
|
|
61
61
|
c = da.minimum(a, b)
|
|
62
62
|
|
|
63
|
-
c = d
|
|
64
|
-
c = d
|
|
65
|
-
c = d
|
|
66
|
-
c = da.logical_not(d)
|
|
67
|
-
c = d.all(axis=-1)
|
|
68
|
-
c = d.any(axis=-1)
|
|
69
|
-
c = da.where(d, a, b)
|
|
63
|
+
c = da.logical_and(d, e) # element-wise and
|
|
64
|
+
c = da.logical_or(d, e) # element-wise or
|
|
65
|
+
c = da.logical_xor(d, e) # element-wise xor
|
|
66
|
+
c = da.logical_not(d) # element-wise not
|
|
67
|
+
c = d.all(axis=-1, keepdims=False) # reduction of and operation. axis=None, keepdims=False by default
|
|
68
|
+
c = d.any(axis=-1, keepdims=False) # reduction of or operation. axis=None, keepdims=False by default
|
|
69
|
+
c = da.where(d, a, b) # return elements chosen from a or b depending on condition
|
|
70
70
|
|
|
71
71
|
c = da.topk(a, 2, axis=-1, largest=True) # same as pytorch. axis=-1, largest=True by default
|
|
72
72
|
|
|
@@ -74,6 +74,7 @@ c = da.sum(a) # shape: (1,)
|
|
|
74
74
|
c = da.sum(a, axis=1) # shape: (3,)
|
|
75
75
|
c = da.sum(a, axis=1, keepdims=True) # shape: (3, 1)
|
|
76
76
|
# min, max, argmin, argmax follow the same signature
|
|
77
|
+
# all reductions set axis=None, keepdims=False by default
|
|
77
78
|
|
|
78
79
|
c = da.softmax(a, axis=-1, temperature=0.6) # support temperature. temperature=1 by default
|
|
79
80
|
c = da.log_softmax(a, axis=-1, temperature=0.6)
|
|
@@ -112,22 +113,29 @@ print(res.grad) # gradient get!
|
|
|
112
113
|
- [x] gather or take_along_axis
|
|
113
114
|
- [ ] scatter
|
|
114
115
|
- [ ] convolution and 2d convolution
|
|
116
|
+
- [ ] pooling
|
|
117
|
+
- [ ] softmax attention
|
|
115
118
|
- [ ] direct masking and indexing via `[]` syntax
|
|
116
119
|
- [ ] einsum
|
|
120
|
+
- [ ] normalization
|
|
117
121
|
- [ ] support backward with Vector-Jacobian Product like pytorch
|
|
118
|
-
- [ ] basic neural network
|
|
122
|
+
- [ ] basic neural network modules
|
|
119
123
|
- [ ] optimizers and loss functions
|
|
124
|
+
- [ ] dataset pipelines
|
|
125
|
+
- [ ] save and load state dict file
|
|
120
126
|
- [ ] full training test
|
|
121
127
|
- [ ] benchmark with pytorch on CPU
|
|
122
|
-
- [ ]
|
|
128
|
+
- [ ] full LLM training
|
|
123
129
|
- [ ] finer type annotations, comments and documentation
|
|
124
130
|
|
|
125
131
|
## Development
|
|
126
132
|
|
|
127
133
|
Recommend manage dependencies using [uv](https://github.com/astral-sh/uv).
|
|
134
|
+
We use [pre-commit](https://github.com/pre-commit/pre-commit) to manage hooks which help to lint and format our code.
|
|
128
135
|
|
|
129
136
|
```bash
|
|
130
137
|
uv sync
|
|
138
|
+
pre-commit install # install pre-commit git hooks for lint and format
|
|
131
139
|
```
|
|
132
140
|
|
|
133
141
|
Run tests:
|
|
@@ -4,10 +4,10 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "deep_atomic"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.1"
|
|
8
8
|
description = "A simple deep learning framework built upon numpy only"
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
11
|
license = { text = "MIT" }
|
|
12
12
|
authors = [
|
|
13
13
|
{ name = "Elliot Zhang", email = "elliot_zh@proton.me" }
|
|
@@ -28,6 +28,7 @@ dev = [
|
|
|
28
28
|
"pytest-cov>=4.0",
|
|
29
29
|
"black>=23.0",
|
|
30
30
|
"ruff>=0.1.0",
|
|
31
|
+
"pre-commit>=4.6.0"
|
|
31
32
|
]
|
|
32
33
|
|
|
33
34
|
[tool.black]
|
|
@@ -36,9 +37,14 @@ target-version = ['py38']
|
|
|
36
37
|
|
|
37
38
|
[tool.ruff]
|
|
38
39
|
line-length = 88
|
|
39
|
-
lint.select = ["
|
|
40
|
+
lint.select = ["I"] # currently only use isort
|
|
40
41
|
lint.fixable = ["I"]
|
|
41
42
|
|
|
43
|
+
[tool.ruff.lint.isort]
|
|
44
|
+
known-third-party = ["numpy"]
|
|
45
|
+
known-first-party = ["deep-atomic"]
|
|
46
|
+
force-sort-within-sections = true
|
|
47
|
+
|
|
42
48
|
[tool.pytest.ini_options]
|
|
43
49
|
testpaths = ["tests"]
|
|
44
50
|
python_files = "*_test.py"
|