venlacpu 0.2.2__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.
Files changed (110) hide show
  1. venlacpu-0.2.2/.github/workflows/android.yml +210 -0
  2. venlacpu-0.2.2/.github/workflows/python-package.yml +203 -0
  3. venlacpu-0.2.2/.github/workflows/release.yml +468 -0
  4. venlacpu-0.2.2/.gitignore +99 -0
  5. venlacpu-0.2.2/CMakeLists.txt +908 -0
  6. venlacpu-0.2.2/MANIFEST.in +3 -0
  7. venlacpu-0.2.2/PKG-INFO +171 -0
  8. venlacpu-0.2.2/README.md +149 -0
  9. venlacpu-0.2.2/add_parameter_api.py +845 -0
  10. venlacpu-0.2.2/debug_autograd.cpp +136 -0
  11. venlacpu-0.2.2/examples/hello.cpp +19 -0
  12. venlacpu-0.2.2/fix_autograd_transpose.sh +664 -0
  13. venlacpu-0.2.2/fix_wheel_packaging.py +141 -0
  14. venlacpu-0.2.2/include/venla/autograd/autograd.hpp +36 -0
  15. venlacpu-0.2.2/include/venla/autograd/ops.hpp +110 -0
  16. venlacpu-0.2.2/include/venla/core/device.hpp +28 -0
  17. venlacpu-0.2.2/include/venla/core/dtype.hpp +41 -0
  18. venlacpu-0.2.2/include/venla/core/shape.hpp +48 -0
  19. venlacpu-0.2.2/include/venla/core/storage.hpp +35 -0
  20. venlacpu-0.2.2/include/venla/core/stride.hpp +35 -0
  21. venlacpu-0.2.2/include/venla/core/version.hpp +13 -0
  22. venlacpu-0.2.2/include/venla/math/operations.hpp +53 -0
  23. venlacpu-0.2.2/include/venla/nn/activation.hpp +58 -0
  24. venlacpu-0.2.2/include/venla/nn/cross_entropy_loss.hpp +80 -0
  25. venlacpu-0.2.2/include/venla/nn/embedding.hpp +103 -0
  26. venlacpu-0.2.2/include/venla/nn/feed_forward.hpp +103 -0
  27. venlacpu-0.2.2/include/venla/nn/kv_cache.hpp +108 -0
  28. venlacpu-0.2.2/include/venla/nn/language_model.hpp +174 -0
  29. venlacpu-0.2.2/include/venla/nn/layer_norm.hpp +97 -0
  30. venlacpu-0.2.2/include/venla/nn/linear.hpp +98 -0
  31. venlacpu-0.2.2/include/venla/nn/mse_loss.hpp +62 -0
  32. venlacpu-0.2.2/include/venla/nn/multi_head_attention.hpp +158 -0
  33. venlacpu-0.2.2/include/venla/nn/positional_encoding.hpp +86 -0
  34. venlacpu-0.2.2/include/venla/nn/sequential.hpp +137 -0
  35. venlacpu-0.2.2/include/venla/nn/transformer_decoder.hpp +133 -0
  36. venlacpu-0.2.2/include/venla/nn/transformer_decoder_layer.hpp +176 -0
  37. venlacpu-0.2.2/include/venla/nn/transformer_encoder.hpp +140 -0
  38. venlacpu-0.2.2/include/venla/nn/transformer_encoder_layer.hpp +122 -0
  39. venlacpu-0.2.2/include/venla/optim/optimizer.hpp +187 -0
  40. venlacpu-0.2.2/include/venla/tensor/manipulation.hpp +127 -0
  41. venlacpu-0.2.2/include/venla/tensor/tensor.hpp +150 -0
  42. venlacpu-0.2.2/include/venla/tokenizer/tokenizer.hpp +210 -0
  43. venlacpu-0.2.2/include/venla/tokenizer/vocabulary.hpp +144 -0
  44. venlacpu-0.2.2/include/venla/training/causal_lm.hpp +69 -0
  45. venlacpu-0.2.2/include/venla/training/trainer.hpp +108 -0
  46. venlacpu-0.2.2/pyproject.toml +57 -0
  47. venlacpu-0.2.2/python/bindings.cpp +871 -0
  48. venlacpu-0.2.2/python/venlacpu/__init__.py +32 -0
  49. venlacpu-0.2.2/python/venlacpu/version.py +4 -0
  50. venlacpu-0.2.2/src/autograd.cpp +1358 -0
  51. venlacpu-0.2.2/src/core/device.cpp +29 -0
  52. venlacpu-0.2.2/src/core/dtype.cpp +87 -0
  53. venlacpu-0.2.2/src/core/shape.cpp +134 -0
  54. venlacpu-0.2.2/src/core/storage.cpp +33 -0
  55. venlacpu-0.2.2/src/core/stride.cpp +92 -0
  56. venlacpu-0.2.2/src/core/version.cpp +9 -0
  57. venlacpu-0.2.2/src/math/operations.cpp +1298 -0
  58. venlacpu-0.2.2/src/nn/activation.cpp +383 -0
  59. venlacpu-0.2.2/src/nn/cross_entropy_loss.cpp +753 -0
  60. venlacpu-0.2.2/src/nn/embedding.cpp +538 -0
  61. venlacpu-0.2.2/src/nn/feed_forward.cpp +1079 -0
  62. venlacpu-0.2.2/src/nn/kv_cache.cpp +593 -0
  63. venlacpu-0.2.2/src/nn/language_model.cpp +411 -0
  64. venlacpu-0.2.2/src/nn/layer_norm.cpp +695 -0
  65. venlacpu-0.2.2/src/nn/linear.cpp +801 -0
  66. venlacpu-0.2.2/src/nn/mse_loss.cpp +415 -0
  67. venlacpu-0.2.2/src/nn/multi_head_attention.cpp +2523 -0
  68. venlacpu-0.2.2/src/nn/positional_encoding.cpp +306 -0
  69. venlacpu-0.2.2/src/nn/sequential.cpp +287 -0
  70. venlacpu-0.2.2/src/nn/transformer_decoder.cpp +300 -0
  71. venlacpu-0.2.2/src/nn/transformer_decoder_layer.cpp +522 -0
  72. venlacpu-0.2.2/src/nn/transformer_encoder.cpp +350 -0
  73. venlacpu-0.2.2/src/nn/transformer_encoder_layer.cpp +316 -0
  74. venlacpu-0.2.2/src/optim/optimizer.cpp +476 -0
  75. venlacpu-0.2.2/src/tensor/manipulation.cpp +933 -0
  76. venlacpu-0.2.2/src/tensor/tensor.cpp +393 -0
  77. venlacpu-0.2.2/src/tokenizer/tokenizer.cpp +1172 -0
  78. venlacpu-0.2.2/src/tokenizer/vocabulary.cpp +513 -0
  79. venlacpu-0.2.2/src/training/causal_lm.cpp +462 -0
  80. venlacpu-0.2.2/src/training/trainer.cpp +688 -0
  81. venlacpu-0.2.2/tests/autograd/test_autograd.cpp +2448 -0
  82. venlacpu-0.2.2/tests/autograd/test_transpose_autograd.cpp +212 -0
  83. venlacpu-0.2.2/tests/core/test_core.cpp +48 -0
  84. venlacpu-0.2.2/tests/math/test_math.cpp +695 -0
  85. venlacpu-0.2.2/tests/nn/test_activation.cpp +422 -0
  86. venlacpu-0.2.2/tests/nn/test_cached_multi_head_attention.cpp +613 -0
  87. venlacpu-0.2.2/tests/nn/test_cross_entropy_loss.cpp +845 -0
  88. venlacpu-0.2.2/tests/nn/test_embedding.cpp +466 -0
  89. venlacpu-0.2.2/tests/nn/test_feed_forward.cpp +681 -0
  90. venlacpu-0.2.2/tests/nn/test_kv_cache.cpp +797 -0
  91. venlacpu-0.2.2/tests/nn/test_language_model.cpp +402 -0
  92. venlacpu-0.2.2/tests/nn/test_language_model_parameters.cpp +348 -0
  93. venlacpu-0.2.2/tests/nn/test_language_model_training.cpp +586 -0
  94. venlacpu-0.2.2/tests/nn/test_layer_norm.cpp +704 -0
  95. venlacpu-0.2.2/tests/nn/test_linear.cpp +487 -0
  96. venlacpu-0.2.2/tests/nn/test_mse_loss.cpp +309 -0
  97. venlacpu-0.2.2/tests/nn/test_multi_head_attention.cpp +501 -0
  98. venlacpu-0.2.2/tests/nn/test_positional_encoding.cpp +538 -0
  99. venlacpu-0.2.2/tests/nn/test_sequential.cpp +653 -0
  100. venlacpu-0.2.2/tests/nn/test_transformer_decoder.cpp +852 -0
  101. venlacpu-0.2.2/tests/nn/test_transformer_decoder_layer.cpp +728 -0
  102. venlacpu-0.2.2/tests/nn/test_transformer_decoder_layer_cached.cpp +484 -0
  103. venlacpu-0.2.2/tests/nn/test_transformer_encoder.cpp +852 -0
  104. venlacpu-0.2.2/tests/nn/test_transformer_encoder_layer.cpp +673 -0
  105. venlacpu-0.2.2/tests/optim/test_optimizer.cpp +271 -0
  106. venlacpu-0.2.2/tests/python/test_binding.py +93 -0
  107. venlacpu-0.2.2/tests/tensor/test_manipulation.cpp +427 -0
  108. venlacpu-0.2.2/tests/tensor/test_tensor.cpp +107 -0
  109. venlacpu-0.2.2/tests/tokenizer/test_tokenizer.cpp +256 -0
  110. venlacpu-0.2.2/tests/training/test_training_system.cpp +401 -0
@@ -0,0 +1,210 @@
1
+ name: VENLACPU Android ARM64
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ push:
7
+ branches:
8
+ - main
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+
15
+ # ============================================================
16
+ # VENLACPU ANDROID ARM64
17
+ #
18
+ # Target:
19
+ # CPython 3.13
20
+ # Android ARM64
21
+ # arm64_v8a
22
+ #
23
+ # This workflow is intentionally independent from the desktop
24
+ # release workflow.
25
+ # ============================================================
26
+
27
+ build-android:
28
+
29
+ name: Android ARM64 / CPython 3.13
30
+
31
+ runs-on: ubuntu-latest
32
+
33
+ env:
34
+ CIBW_PLATFORM: android
35
+
36
+ CIBW_BUILD: cp313-android_arm64_v8a
37
+
38
+ CIBW_ARCHS_ANDROID: arm64_v8a
39
+
40
+ # Android API level.
41
+ # API 27 gives us a modern baseline while remaining broadly
42
+ # compatible with current Android devices.
43
+ ANDROID_API_LEVEL: "27"
44
+
45
+ CIBW_BUILD_VERBOSITY: "1"
46
+
47
+ CMAKE_ARGS: >-
48
+ -DVENLA_BUILD_TESTS=OFF
49
+ -DVENLA_BUILD_EXAMPLES=OFF
50
+ -DVENLA_BUILD_PYTHON_BINDINGS=ON
51
+
52
+ steps:
53
+
54
+ # ==========================================================
55
+ # CHECKOUT
56
+ # ==========================================================
57
+
58
+ - name: Checkout repository
59
+ uses: actions/checkout@v4
60
+
61
+ # ==========================================================
62
+ # PYTHON
63
+ # ==========================================================
64
+
65
+ - name: Set up Python 3.13
66
+ uses: actions/setup-python@v5
67
+ with:
68
+ python-version: "3.13"
69
+
70
+ # ==========================================================
71
+ # BUILD TOOLS
72
+ # ==========================================================
73
+
74
+ - name: Install build tools
75
+ run: |
76
+ python -m pip install --upgrade pip
77
+ python -m pip install --upgrade cibuildwheel build twine
78
+
79
+ # ==========================================================
80
+ # BUILD ANDROID WHEEL
81
+ # ==========================================================
82
+
83
+ - name: Build Android ARM64 wheel
84
+ run: |
85
+ echo "============================================================"
86
+ echo "VENLACPU ANDROID ARM64 BUILD"
87
+ echo "============================================================"
88
+
89
+ echo "Python:"
90
+ python --version
91
+
92
+ echo
93
+ echo "cibuildwheel:"
94
+ python -m cibuildwheel --help >/dev/null
95
+ echo "cibuildwheel: available"
96
+
97
+ echo
98
+ echo "Target:"
99
+ echo " CPython 3.13"
100
+ echo " Android"
101
+ echo " ARM64"
102
+ echo " API level: ${ANDROID_API_LEVEL}"
103
+
104
+ echo
105
+ echo "============================================================"
106
+ echo "BUILD"
107
+ echo "============================================================"
108
+
109
+ python -m cibuildwheel \
110
+ --platform android \
111
+ --archs arm64_v8a \
112
+ --output-dir wheelhouse
113
+
114
+ # ==========================================================
115
+ # SHOW RESULT
116
+ # ==========================================================
117
+
118
+ - name: Show Android wheel
119
+ shell: bash
120
+ run: |
121
+ echo "============================================================"
122
+ echo "VENLACPU ANDROID WHEEL"
123
+ echo "============================================================"
124
+
125
+ ls -lah wheelhouse/
126
+
127
+ COUNT=$(find wheelhouse -maxdepth 1 -name "*.whl" | wc -l)
128
+
129
+ echo
130
+ echo "Wheel count: $COUNT"
131
+
132
+ if [ "$COUNT" -ne 1 ]; then
133
+ echo "ERROR: Expected exactly one Android ARM64 wheel."
134
+ exit 1
135
+ fi
136
+
137
+ # ==========================================================
138
+ # VERIFY WHEEL METADATA
139
+ # ==========================================================
140
+
141
+ - name: Verify wheel metadata
142
+ run: |
143
+ python -m twine check wheelhouse/*
144
+
145
+ # ==========================================================
146
+ # VERIFY ANDROID TAG
147
+ # ==========================================================
148
+
149
+ - name: Verify Android ARM64 wheel tag
150
+ shell: bash
151
+ run: |
152
+ echo "============================================================"
153
+ echo "ANDROID WHEEL TAG CHECK"
154
+ echo "============================================================"
155
+
156
+ WHEEL=$(find wheelhouse -maxdepth 1 -name "*.whl" -type f | head -1)
157
+
158
+ echo "Wheel:"
159
+ basename "$WHEEL"
160
+
161
+ case "$(basename "$WHEEL")" in
162
+ *android_*_arm64_v8a.whl)
163
+ echo
164
+ echo "OK: Android ARM64 wheel tag detected."
165
+ ;;
166
+ *)
167
+ echo
168
+ echo "ERROR: Wheel does not have an Android ARM64 tag."
169
+ exit 1
170
+ ;;
171
+ esac
172
+
173
+ # ==========================================================
174
+ # UPLOAD ARTIFACT
175
+ #
176
+ # We intentionally do NOT publish to PyPI yet.
177
+ # First we prove that the Android wheel builds correctly.
178
+ # ==========================================================
179
+
180
+ - name: Upload Android wheel
181
+ uses: actions/upload-artifact@v4
182
+ with:
183
+ name: venlacpu-android-arm64
184
+ path: wheelhouse/*.whl
185
+ if-no-files-found: error
186
+
187
+ # ==========================================================
188
+ # SUMMARY
189
+ # ==========================================================
190
+
191
+ - name: Build summary
192
+ shell: bash
193
+ run: |
194
+ echo "============================================================"
195
+ echo "VENLACPU ANDROID BUILD COMPLETE"
196
+ echo "============================================================"
197
+
198
+ echo
199
+ echo "Target:"
200
+ echo " Android ARM64"
201
+ echo " CPython 3.13"
202
+ echo " API level: ${ANDROID_API_LEVEL}"
203
+
204
+ echo
205
+ echo "Wheel:"
206
+ find wheelhouse -maxdepth 1 -name "*.whl" -printf " %f\n"
207
+
208
+ echo
209
+ echo "STATUS: PASSED"
210
+ echo "============================================================"
@@ -0,0 +1,203 @@
1
+ name: VENLACPU Python Package CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - master
8
+
9
+ pull_request:
10
+
11
+ workflow_dispatch:
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ jobs:
17
+
18
+ # ============================================================
19
+ # PYTHON WHEELS
20
+ #
21
+ # This workflow is only responsible for Python package wheels.
22
+ # C++ test matrix is intentionally removed from this workflow.
23
+ # The native C++ extension is compiled as part of the wheel build.
24
+ # ============================================================
25
+
26
+ python-wheels:
27
+
28
+ name: Python Wheels / ${{ matrix.os }}
29
+
30
+ runs-on: ${{ matrix.os }}
31
+
32
+ strategy:
33
+ fail-fast: false
34
+
35
+ matrix:
36
+ os:
37
+ - ubuntu-latest
38
+ - windows-latest
39
+ - macos-14
40
+
41
+ steps:
42
+
43
+ - name: Checkout repository
44
+ uses: actions/checkout@v4
45
+
46
+ - name: Set up Python
47
+ uses: actions/setup-python@v5
48
+ with:
49
+ python-version: "3.12"
50
+
51
+ - name: Install wheel builder
52
+ run: |
53
+ python -m pip install --upgrade pip
54
+ python -m pip install cibuildwheel
55
+
56
+ - name: Build wheels
57
+ env:
58
+ CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-*"
59
+ CIBW_SKIP: "*-musllinux_*"
60
+
61
+ CIBW_TEST_REQUIRES: "pytest"
62
+
63
+ CIBW_TEST_COMMAND: >
64
+ python -c
65
+ "import venlacpu;
66
+ print('VENLACPU', venlacpu.__version__);
67
+ print('Native binding import OK')"
68
+
69
+ CMAKE_ARGS: >-
70
+ -DVENLA_BUILD_TESTS=OFF
71
+ -DVENLA_BUILD_EXAMPLES=OFF
72
+ -DVENLA_BUILD_PYTHON_BINDINGS=ON
73
+
74
+ run: |
75
+ python -m cibuildwheel --output-dir wheelhouse
76
+
77
+ - name: Check wheels
78
+ run: |
79
+ python -m pip install twine
80
+ python -m twine check wheelhouse/*
81
+
82
+ - name: Verify wheel files
83
+ shell: bash
84
+ run: |
85
+ echo "============================================================"
86
+ echo "VENLACPU PYTHON WHEELS"
87
+ echo "============================================================"
88
+
89
+ ls -lah wheelhouse/
90
+
91
+ COUNT=$(find wheelhouse -maxdepth 1 -name "*.whl" | wc -l)
92
+
93
+ echo
94
+ echo "Wheel count: $COUNT"
95
+
96
+ if [ "$COUNT" -eq 0 ]; then
97
+ echo "ERROR: No wheels were created."
98
+ exit 1
99
+ fi
100
+
101
+ echo
102
+ echo "PYTHON WHEELS: OK"
103
+
104
+ - name: Upload wheels
105
+ uses: actions/upload-artifact@v4
106
+ with:
107
+ name: venlacpu-wheels-${{ matrix.os }}
108
+ path: wheelhouse/*.whl
109
+ if-no-files-found: error
110
+
111
+
112
+ # ============================================================
113
+ # SOURCE PACKAGE
114
+ # ============================================================
115
+
116
+ source-package:
117
+
118
+ name: Source Package
119
+
120
+ runs-on: ubuntu-latest
121
+
122
+ steps:
123
+
124
+ - name: Checkout repository
125
+ uses: actions/checkout@v4
126
+
127
+ - name: Set up Python
128
+ uses: actions/setup-python@v5
129
+ with:
130
+ python-version: "3.12"
131
+
132
+ - name: Install packaging tools
133
+ run: |
134
+ python -m pip install --upgrade pip
135
+ python -m pip install build twine
136
+
137
+ - name: Build source distribution
138
+ run: |
139
+ python -m build --sdist
140
+
141
+ - name: Check source distribution
142
+ run: |
143
+ python -m twine check dist/*
144
+
145
+ - name: Verify source distribution
146
+ shell: bash
147
+ run: |
148
+ echo "============================================================"
149
+ echo "VENLACPU SOURCE PACKAGE"
150
+ echo "============================================================"
151
+
152
+ ls -lah dist/
153
+
154
+ COUNT=$(find dist -maxdepth 1 -name "*.tar.gz" | wc -l)
155
+
156
+ echo
157
+ echo "Source distribution count: $COUNT"
158
+
159
+ if [ "$COUNT" -eq 0 ]; then
160
+ echo "ERROR: Source distribution was not created."
161
+ exit 1
162
+ fi
163
+
164
+ echo
165
+ echo "SOURCE PACKAGE: OK"
166
+
167
+ - name: Upload source distribution
168
+ uses: actions/upload-artifact@v4
169
+ with:
170
+ name: venlacpu-source
171
+ path: dist/*.tar.gz
172
+ if-no-files-found: error
173
+
174
+
175
+ # ============================================================
176
+ # PACKAGE SUMMARY
177
+ # ============================================================
178
+
179
+ package-summary:
180
+
181
+ name: Package Summary
182
+
183
+ needs:
184
+ - python-wheels
185
+ - source-package
186
+
187
+ runs-on: ubuntu-latest
188
+
189
+ steps:
190
+
191
+ - name: Success
192
+ run: |
193
+ echo "============================================================"
194
+ echo "VENLACPU PYTHON PACKAGE PIPELINE PASSED"
195
+ echo "============================================================"
196
+
197
+ echo
198
+ echo "Python wheels built successfully."
199
+ echo "Source distribution built successfully."
200
+ echo "Wheel metadata passed twine validation."
201
+ echo
202
+ echo "C++ test matrix is not part of this workflow."
203
+ echo "PyPI publishing is handled by release.yml."