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.
@@ -0,0 +1,7 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.15.21
4
+ hooks:
5
+ - id: ruff-check
6
+ args: [--fix, --exit-non-zero-on-fix]
7
+ - id: ruff-format
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deep_atomic
3
- Version: 0.2.0
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.8
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 & e # element-wise and
84
- c = d | e # element-wise or
85
- c = d ^ e # element-wise xor
86
- c = da.logical_not(d) # element-wise not
87
- c = d.all(axis=-1) # reduction of and operation
88
- c = d.any(axis=-1) # reduction of or operation
89
- c = da.where(d, a, b) # return elements chosen from a or b depending on condition
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 classes
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
- - [ ] attention layers and full LLM training
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 & e # element-wise and
64
- c = d | e # element-wise or
65
- c = d ^ e # element-wise xor
66
- c = da.logical_not(d) # element-wise not
67
- c = d.all(axis=-1) # reduction of and operation
68
- c = d.any(axis=-1) # reduction of or operation
69
- c = da.where(d, a, b) # return elements chosen from a or b depending on condition
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 classes
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
- - [ ] attention layers and full LLM training
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.0"
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.8"
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 = ["E", "F", "W", "I"]
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"
@@ -1,7 +1,7 @@
1
1
  """deep-atomic - A simple deep learning framework built upon numpy only"""
2
2
 
3
- __version__ = "0.2.0"
3
+ __version__ = "0.2.1"
4
4
  __author__ = "elliot_zh@proton.me"
5
5
 
6
- from .tensor import *
7
6
  from .op import *
7
+ from .tensor import *