amv-forge 2.0.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.
Files changed (80) hide show
  1. amv_forge-2.0.0/PKG-INFO +260 -0
  2. amv_forge-2.0.0/README.md +226 -0
  3. amv_forge-2.0.0/pyproject.toml +72 -0
  4. amv_forge-2.0.0/setup.cfg +4 -0
  5. amv_forge-2.0.0/src/amv_forge.egg-info/PKG-INFO +260 -0
  6. amv_forge-2.0.0/src/amv_forge.egg-info/SOURCES.txt +78 -0
  7. amv_forge-2.0.0/src/amv_forge.egg-info/dependency_links.txt +1 -0
  8. amv_forge-2.0.0/src/amv_forge.egg-info/requires.txt +5 -0
  9. amv_forge-2.0.0/src/amv_forge.egg-info/top_level.txt +1 -0
  10. amv_forge-2.0.0/src/forge/__init__.py +229 -0
  11. amv_forge-2.0.0/src/forge/__init__.pyi +20 -0
  12. amv_forge-2.0.0/src/forge/autograd.py +306 -0
  13. amv_forge-2.0.0/src/forge/bridge.py +266 -0
  14. amv_forge-2.0.0/src/forge/data.py +130 -0
  15. amv_forge-2.0.0/src/forge/device.py +127 -0
  16. amv_forge-2.0.0/src/forge/distributions.py +221 -0
  17. amv_forge-2.0.0/src/forge/errors.py +83 -0
  18. amv_forge-2.0.0/src/forge/fft.py +138 -0
  19. amv_forge-2.0.0/src/forge/functional.py +937 -0
  20. amv_forge-2.0.0/src/forge/generated/__init__.py +3 -0
  21. amv_forge-2.0.0/src/forge/generated/op_schema.py +13 -0
  22. amv_forge-2.0.0/src/forge/graph.py +206 -0
  23. amv_forge-2.0.0/src/forge/linalg.py +128 -0
  24. amv_forge-2.0.0/src/forge/models/__init__.py +25 -0
  25. amv_forge-2.0.0/src/forge/models/llama.py +249 -0
  26. amv_forge-2.0.0/src/forge/models/nanogpt.py +182 -0
  27. amv_forge-2.0.0/src/forge/nn.py +1757 -0
  28. amv_forge-2.0.0/src/forge/nn.pyi +34 -0
  29. amv_forge-2.0.0/src/forge/ops.py +4271 -0
  30. amv_forge-2.0.0/src/forge/optim.py +911 -0
  31. amv_forge-2.0.0/src/forge/optim.pyi +15 -0
  32. amv_forge-2.0.0/src/forge/pipeline.py +159 -0
  33. amv_forge-2.0.0/src/forge/py.typed +1 -0
  34. amv_forge-2.0.0/src/forge/rl/__init__.py +19 -0
  35. amv_forge-2.0.0/src/forge/rl/cartpole.py +151 -0
  36. amv_forge-2.0.0/src/forge/serialization.py +101 -0
  37. amv_forge-2.0.0/src/forge/special.py +258 -0
  38. amv_forge-2.0.0/src/forge/tensor.py +1768 -0
  39. amv_forge-2.0.0/src/forge/tensor.pyi +66 -0
  40. amv_forge-2.0.0/tests/test_activation_functions.py +30 -0
  41. amv_forge-2.0.0/tests/test_adversarial_fuzzer.py +1172 -0
  42. amv_forge-2.0.0/tests/test_arithmetic_ops.py +44 -0
  43. amv_forge-2.0.0/tests/test_autograd.py +42 -0
  44. amv_forge-2.0.0/tests/test_benchmark.py +75 -0
  45. amv_forge-2.0.0/tests/test_broadcasting.py +39 -0
  46. amv_forge-2.0.0/tests/test_compatibility.py +62 -0
  47. amv_forge-2.0.0/tests/test_core.py +118 -0
  48. amv_forge-2.0.0/tests/test_cpu_ops.py +196 -0
  49. amv_forge-2.0.0/tests/test_dataloader.py +29 -0
  50. amv_forge-2.0.0/tests/test_edge_cases.py +41 -0
  51. amv_forge-2.0.0/tests/test_error_handling.py +31 -0
  52. amv_forge-2.0.0/tests/test_exceptions.py +71 -0
  53. amv_forge-2.0.0/tests/test_extreme.py +58 -0
  54. amv_forge-2.0.0/tests/test_finite_difference.py +165 -0
  55. amv_forge-2.0.0/tests/test_generated_schema.py +22 -0
  56. amv_forge-2.0.0/tests/test_gpu_optimizers.py +116 -0
  57. amv_forge-2.0.0/tests/test_gpu_sgd_contract.py +68 -0
  58. amv_forge-2.0.0/tests/test_graph_monster.py +53 -0
  59. amv_forge-2.0.0/tests/test_hub_models_and_rl.py +194 -0
  60. amv_forge-2.0.0/tests/test_inplace_version_lock.py +259 -0
  61. amv_forge-2.0.0/tests/test_loss_functions.py +32 -0
  62. amv_forge-2.0.0/tests/test_machine_gun.py +64 -0
  63. amv_forge-2.0.0/tests/test_massive_cpu.py +89 -0
  64. amv_forge-2.0.0/tests/test_math_ops.py +30 -0
  65. amv_forge-2.0.0/tests/test_matrix_ops.py +34 -0
  66. amv_forge-2.0.0/tests/test_module_to_contract.py +105 -0
  67. amv_forge-2.0.0/tests/test_nn_module.py +34 -0
  68. amv_forge-2.0.0/tests/test_ops_slice.py +99 -0
  69. amv_forge-2.0.0/tests/test_optimizer_versioning_contract.py +75 -0
  70. amv_forge-2.0.0/tests/test_optimizers.py +126 -0
  71. amv_forge-2.0.0/tests/test_reduction_ops.py +32 -0
  72. amv_forge-2.0.0/tests/test_release2_llm_modules.py +148 -0
  73. amv_forge-2.0.0/tests/test_security.py +127 -0
  74. amv_forge-2.0.0/tests/test_shape_ops.py +31 -0
  75. amv_forge-2.0.0/tests/test_stress.py +62 -0
  76. amv_forge-2.0.0/tests/test_tensor_creation.py +54 -0
  77. amv_forge-2.0.0/tests/test_unbroadcast.py +62 -0
  78. amv_forge-2.0.0/tests/test_v3_features.py +567 -0
  79. amv_forge-2.0.0/tests/test_v3_validation.py +148 -0
  80. amv_forge-2.0.0/tests/test_vram_crusher.py +47 -0
@@ -0,0 +1,260 @@
1
+ Metadata-Version: 2.4
2
+ Name: amv-forge
3
+ Version: 2.0.0
4
+ Summary: High-performance WebGPU-accelerated tensor computation engine with reverse-mode autograd for browser and edge deep learning.
5
+ Author-email: AMEVA Foundation <contact@uno-km.com>
6
+ Maintainer: AMEVA Engineering Team
7
+ License: MIT
8
+ Project-URL: Homepage, https://uno-km.github.io/amv-forge/
9
+ Project-URL: Documentation, https://uno-km.github.io/amv-forge/
10
+ Project-URL: Repository, https://github.com/uno-km/amv-forge
11
+ Project-URL: Issues, https://github.com/uno-km/amv-forge/issues
12
+ Project-URL: Changelog, https://github.com/uno-km/amv-forge/blob/main/RELEASE_NOTES.md
13
+ Keywords: deep-learning,tensor,autograd,webgpu,pytorch,transformers,pyodide,wasm,machine-learning
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
25
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
26
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
27
+ Classifier: Operating System :: OS Independent
28
+ Requires-Python: >=3.9
29
+ Description-Content-Type: text/markdown
30
+ Requires-Dist: numpy>=1.20.0
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest>=7.0; extra == "dev"
33
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
34
+
35
+ # amv-forge (`amv-forge`)
36
+
37
+ [![PyPI Version](https://img.shields.io/badge/pypi-v1.0.1-blue.svg)](https://pypi.org/project/amv-forge/)
38
+ [![Python Version](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue)](https://pypi.org/project/amv-forge/)
39
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://github.com/uno-km/amv-forge/blob/main/LICENSE)
40
+ [![Test Suite](https://img.shields.io/badge/tests-279%2F279%20passed%20(100%25)-brightgreen.svg)](https://github.com/uno-km/amv-forge)
41
+ [![WebGPU Acceleration](https://img.shields.io/badge/acceleration-WebGPU%20WGSL%20%2B%20CPU-orange.svg)](https://uno-km.github.io/amv-forge/)
42
+
43
+ **High-Performance Client-Side Tensor Computation Engine & Reverse-Mode Autograd Framework Powered by WebGPU.**
44
+
45
+ Developed and maintained by the **AMEVA Foundation** (?„ë©”ë°??¬ë‹¨), amv-forge is an industrial-grade, zero-server-cost deep learning library engineered to execute high-throughput tensor operations, automated differentiation, and end-to-end neural model training natively within client runtimes (WebGPU, WASM/Pyodide, and native Python environments).
46
+
47
+ ---
48
+
49
+ ## Architectural Pillars
50
+
51
+ ```
52
+ +-----------------------------------------------------------------------------------+
53
+ | amv-forge User Space |
54
+ | forge.nn | forge.optim | forge.linalg | forge.fft | forge.distributions |
55
+ +-----------------------------------------------------------------------------------+
56
+ | Reverse-Mode Autograd DAG Engine |
57
+ | Vector-Jacobian Products (VJP) * In-Place Mutation Version Locks |
58
+ +-----------------------------------------------------------------------------------+
59
+ | Hardware Abstraction Layer |
60
+ | CPU Backend (Vectorized C/NumPy) <---> WebGPU Backend (Async WGSL Kernels) |
61
+ | Staging Buffer Recycling Pool <---> Zero-Leak Allocation Token Ring |
62
+ +-----------------------------------------------------------------------------------+
63
+ ```
64
+
65
+ 1. **Deterministic Autograd & Topological Execution**
66
+ Strict reverse-mode automatic differentiation graph with cycle detection, multi-output tuple bindings, in-place version invalidation, and scalar-tensor memory optimization.
67
+ 2. **WebGPU Hardware Acceleration**
68
+ Direct-to-silicon WGSL compute shaders featuring 8-dimensional non-contiguous stride dispatching, 2D workgroup partitioning ($65,535 \times 65,535$), and explicit buffer lifecycle tracking.
69
+ 3. **PyTorch 1:1 API Parity**
70
+ Seamless drop-in compatibility across neural layers (`nn.Module`, `nn.MultiheadAttention`, `nn.Conv2d`), mathematical primitives (`linalg`, `fft`, `special`), and probabilistic graphical models (`distributions`).
71
+ 4. **Zero-Server Infrastructure (Edge & Browser)**
72
+ Execute full model fine-tuning and inference directly inside the browser using Pyodide and WebGPU with zero cloud compute cost and total data privacy.
73
+
74
+ ---
75
+
76
+ ## Installation
77
+
78
+ Install the official package from PyPI:
79
+
80
+ ```bash
81
+ pip install amv-forge
82
+ ```
83
+
84
+ Or install from source with development dependencies:
85
+
86
+ ```bash
87
+ git clone https://github.com/uno-km/amv-forge.git
88
+ cd amv-forge/packages/forge-py
89
+ pip install -e .
90
+ ```
91
+
92
+ ---
93
+
94
+ ## Quick Start
95
+
96
+ ### 1. Basic Tensor & Automated Differentiation
97
+
98
+ ```python
99
+ import forge as fg
100
+
101
+ # Initialize tensors with gradient tracking
102
+ x = fg.tensor([[1.0, 2.0], [3.0, 4.0]], requires_grad=True)
103
+ w = fg.tensor([[0.5, -0.5], [1.0, 2.0]], requires_grad=True)
104
+ b = fg.tensor([0.1, -0.1], requires_grad=True)
105
+
106
+ # Forward pass: Linear projection + GELU activation
107
+ y = fg.matmul(x, w) + b
108
+ loss = fg.sum(fg.nn.functional.gelu(y))
109
+
110
+ # Compute Vector-Jacobian Products (Autograd backward)
111
+ loss.backward()
112
+
113
+ print("Loss Value :", loss.numpy())
114
+ print("Gradient dL/dw :\n", w.grad.numpy())
115
+ ```
116
+
117
+ ---
118
+
119
+ ### 2. Character-Level Transformer (NanoGPT)
120
+
121
+ Train a complete causal autoregressive transformer directly on your local device:
122
+
123
+ ```python
124
+ import forge as fg
125
+ import forge.nn as nn
126
+ from forge.models.nanogpt import GPT, GPTConfig
127
+
128
+ # Define model configuration
129
+ config = GPTConfig(
130
+ block_size=32,
131
+ vocab_size=64,
132
+ n_layer=4,
133
+ n_head=4,
134
+ n_embd=64,
135
+ bias=False
136
+ )
137
+ model = GPT(config)
138
+ optimizer = fg.optim.AdamW(model.parameters(), lr=1e-3, weight_decay=1e-2)
139
+ criterion = nn.CrossEntropyLoss()
140
+
141
+ # Training step (Batch Size: 8, Sequence Length: 32)
142
+ input_tokens = fg.tensor([[1, 5, 12, 3]], dtype="int32")
143
+ target_tokens = fg.tensor([[5, 12, 3, 18]], dtype="int32")
144
+
145
+ optimizer.zero_grad()
146
+ logits = model(input_tokens)
147
+ loss = criterion(logits, target_tokens)
148
+ loss.backward()
149
+ optimizer.step()
150
+ ```
151
+
152
+ ---
153
+
154
+ ### 3. Speech-to-Text & Acoustic Signal Processing (`forge.fft` + `forge.nn`)
155
+
156
+ Compute real Fourier Mel-spectrograms from raw acoustic waveforms:
157
+
158
+ ```python
159
+ import forge as fg
160
+ import forge.nn as nn
161
+
162
+ # 16kHz PCM audio waveform (Batch: 4, Samples: 8000)
163
+ raw_audio = fg.tensor(audio_data, dtype="float32")
164
+
165
+ # Fast Fourier Transform (Complex Spectrum)
166
+ fft_complex = fg.fft.rfft(raw_audio, n=1024, dim=-1)
167
+
168
+ # Power Spectrogram Energy
169
+ power_spec = (fft_complex.real.pow(2.0) + fft_complex.imag.pow(2.0) + 1e-6).log()
170
+
171
+ # 1D Convolutional Audio Feature Extractor
172
+ conv = nn.Conv1d(in_channels=513, out_channels=64, kernel_size=3, padding=1)
173
+ audio_features = conv(power_spec)
174
+ ```
175
+
176
+ ---
177
+
178
+ ## Comprehensive Module Directory
179
+
180
+ | Module | Core Functionality | Key Operators / Classes |
181
+ | :--- | :--- | :--- |
182
+ | **`forge`** | Core Tensor Engine & Factories | `tensor`, `zeros`, `ones`, `randn`, `matmul`, `einsum`, `reshape`, `permute`, `where` |
183
+ | **`forge.nn`** | Deep Learning Layers & Containers | `Linear`, `Conv1d`, `Conv2d`, `MultiheadAttention`, `LayerNorm`, `RMSNorm`, `BatchNorm2d`, `Embedding`, `CrossEntropyLoss`, `MSELoss` |
184
+ | **`forge.optim`** | Optimizers & Rate Schedulers | `SGD`, `Adam`, `AdamW`, `RMSprop`, `CosineAnnealingLR`, `StepLR` |
185
+ | **`forge.linalg`** | Linear Algebra Decomposition | `norm`, `svd`, `qr`, `cholesky`, `inv`, `pinv`, `det`, `matrix_rank`, `solve`, `eigh` |
186
+ | **`forge.fft`** | Discrete Fourier Transforms | `rfft`, `irfft`, `fft`, `ifft`, `fft2`, `ifft2`, `rfft2`, `irfft2`, `fftfreq`, `fftshift` |
187
+ | **`forge.special`** | Transcendental & Error Functions | `erf`, `erfc`, `erfinv`, `gammaln`, `digamma`, `expm1`, `log1p`, `expit`, `logit`, `sinc`, `i0`, `xlogy` |
188
+ | **`forge.distributions`**| Probability Distributions & KL | `Normal(rsample)`, `Uniform`, `Bernoulli`, `Categorical`, `kl_divergence` |
189
+ | **`forge.models`** | Pre-architected Reference Models | `GPT`, `GPTConfig`, `LLaMA` |
190
+
191
+ ---
192
+
193
+ ## In-Browser Zero-Install Execution (WebGPU + Pyodide)
194
+
195
+ amv-forge packages a single bundled JavaScript distribution (`forge-py-bundle.js`) that mounts into browser-native Pyodide runtimes:
196
+
197
+ ```html
198
+ <script src="https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.js"></script>
199
+ <script src="https://uno-km.github.io/amv-forge/dist/forge-py-bundle.js"></script>
200
+ <script>
201
+ async function runClientDeepLearning() {
202
+ let pyodide = await loadPyodide();
203
+ await window.loadAmevaForgeBundle(pyodide);
204
+
205
+ await pyodide.runPythonAsync(`
206
+ import forge as fg
207
+ x = fg.randn((1024, 1024), device="gpu")
208
+ y = fg.matmul(x, x)
209
+ print("Computed 1024x1024 on WebGPU Hardware:", y.shape)
210
+ `);
211
+ }
212
+ runClientDeepLearning();
213
+ </script>
214
+ ```
215
+
216
+ ---
217
+
218
+ ## ?Œ The AMEVA Foundation (?„ë©”ë°??¬ë‹¨)
219
+
220
+ **amv-forge** is an open-source deep learning initiative created and governed by the **AMEVA Foundation** (?„ë©”ë°??¬ë‹¨).
221
+
222
+ ### ?ޝ Our Mission & Zero-Server Paradigm
223
+ The AMEVA Foundation is dedicated to the **democratisation of client-side artificial intelligence and edge computing**. We envision a decentralized web where deep learning training, fine-tuning, and neural inference occur directly on user devices (browsers, laptops, tablets, and smartphones)?”eliminating massive cloud server costs, safeguarding user data sovereignty with zero network leakage, and providing zero-latency neural intelligence everywhere.
224
+
225
+ ### ?ŒŸ Core Foundation Initiatives
226
+ - ?Œ **amv-forge Tensor Engine**: High-performance WebGPU tensor computation & reverse-mode autograd engine.
227
+ - ?Ž™ï¸?**On-Device Whisper STT**: Real-time acoustic FFT signal processing & speech recognition running locally in browser.
228
+ - ?¤– **Decentralized LLM Transformers**: Zero-install character and subword transformer models with zero cloud dependency.
229
+ - ?”’ **Privacy-First AI Sovereignty**: Sovereign on-device machine learning where private data never leaves client silicon.
230
+
231
+ * **Foundation Portal**: [https://uno-km.github.io/amv-forge/](https://uno-km.github.io/amv-forge/)
232
+ * **Official Repository**: [https://github.com/uno-km/amv-forge](https://github.com/uno-km/amv-forge)
233
+ * **Community & Governance**: [https://github.com/uno-km/amv-forge/issues](https://github.com/uno-km/amv-forge/issues)
234
+ * **Sponsorship & Research Partnerships**: [https://github.com/uno-km](https://github.com/uno-km)
235
+
236
+ ---
237
+
238
+ ## Quality Assurance & Verification
239
+
240
+ Every release of amv-forge undergoes rigorous multi-tier verification:
241
+ * **292 Unit & Stress Tests**: 100% automated pass rate across CPU, GPU fallback, mathematical accuracy, and memory quota managers.
242
+ * **Finite-Difference Gradcheck**: Numerical gradient validation against analytical Vector-Jacobian backward formulations.
243
+ * **Memory Lifecycle Audit**: Zero-leak allocation token reclamation and buffer recycling verification across 10,000+ continuous execution cycles.
244
+
245
+ ---
246
+
247
+ ## License & Citation
248
+
249
+ amv-forge is licensed under the [MIT License](https://github.com/uno-km/amv-forge/blob/main/LICENSE).
250
+
251
+ ```bibtex
252
+ @software{ameva_forge_2026,
253
+ author = {AMEVA Foundation},
254
+ title = {amv-forge: High-Performance WebGPU-Accelerated Tensor Computation Engine},
255
+ year = {2026},
256
+ publisher = {GitHub},
257
+ url = {https://github.com/uno-km/amv-forge}
258
+ }
259
+ ```
260
+
@@ -0,0 +1,226 @@
1
+ # amv-forge (`amv-forge`)
2
+
3
+ [![PyPI Version](https://img.shields.io/badge/pypi-v1.0.1-blue.svg)](https://pypi.org/project/amv-forge/)
4
+ [![Python Version](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue)](https://pypi.org/project/amv-forge/)
5
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://github.com/uno-km/amv-forge/blob/main/LICENSE)
6
+ [![Test Suite](https://img.shields.io/badge/tests-279%2F279%20passed%20(100%25)-brightgreen.svg)](https://github.com/uno-km/amv-forge)
7
+ [![WebGPU Acceleration](https://img.shields.io/badge/acceleration-WebGPU%20WGSL%20%2B%20CPU-orange.svg)](https://uno-km.github.io/amv-forge/)
8
+
9
+ **High-Performance Client-Side Tensor Computation Engine & Reverse-Mode Autograd Framework Powered by WebGPU.**
10
+
11
+ Developed and maintained by the **AMEVA Foundation** (?„ë©”ë°??¬ë‹¨), amv-forge is an industrial-grade, zero-server-cost deep learning library engineered to execute high-throughput tensor operations, automated differentiation, and end-to-end neural model training natively within client runtimes (WebGPU, WASM/Pyodide, and native Python environments).
12
+
13
+ ---
14
+
15
+ ## Architectural Pillars
16
+
17
+ ```
18
+ +-----------------------------------------------------------------------------------+
19
+ | amv-forge User Space |
20
+ | forge.nn | forge.optim | forge.linalg | forge.fft | forge.distributions |
21
+ +-----------------------------------------------------------------------------------+
22
+ | Reverse-Mode Autograd DAG Engine |
23
+ | Vector-Jacobian Products (VJP) * In-Place Mutation Version Locks |
24
+ +-----------------------------------------------------------------------------------+
25
+ | Hardware Abstraction Layer |
26
+ | CPU Backend (Vectorized C/NumPy) <---> WebGPU Backend (Async WGSL Kernels) |
27
+ | Staging Buffer Recycling Pool <---> Zero-Leak Allocation Token Ring |
28
+ +-----------------------------------------------------------------------------------+
29
+ ```
30
+
31
+ 1. **Deterministic Autograd & Topological Execution**
32
+ Strict reverse-mode automatic differentiation graph with cycle detection, multi-output tuple bindings, in-place version invalidation, and scalar-tensor memory optimization.
33
+ 2. **WebGPU Hardware Acceleration**
34
+ Direct-to-silicon WGSL compute shaders featuring 8-dimensional non-contiguous stride dispatching, 2D workgroup partitioning ($65,535 \times 65,535$), and explicit buffer lifecycle tracking.
35
+ 3. **PyTorch 1:1 API Parity**
36
+ Seamless drop-in compatibility across neural layers (`nn.Module`, `nn.MultiheadAttention`, `nn.Conv2d`), mathematical primitives (`linalg`, `fft`, `special`), and probabilistic graphical models (`distributions`).
37
+ 4. **Zero-Server Infrastructure (Edge & Browser)**
38
+ Execute full model fine-tuning and inference directly inside the browser using Pyodide and WebGPU with zero cloud compute cost and total data privacy.
39
+
40
+ ---
41
+
42
+ ## Installation
43
+
44
+ Install the official package from PyPI:
45
+
46
+ ```bash
47
+ pip install amv-forge
48
+ ```
49
+
50
+ Or install from source with development dependencies:
51
+
52
+ ```bash
53
+ git clone https://github.com/uno-km/amv-forge.git
54
+ cd amv-forge/packages/forge-py
55
+ pip install -e .
56
+ ```
57
+
58
+ ---
59
+
60
+ ## Quick Start
61
+
62
+ ### 1. Basic Tensor & Automated Differentiation
63
+
64
+ ```python
65
+ import forge as fg
66
+
67
+ # Initialize tensors with gradient tracking
68
+ x = fg.tensor([[1.0, 2.0], [3.0, 4.0]], requires_grad=True)
69
+ w = fg.tensor([[0.5, -0.5], [1.0, 2.0]], requires_grad=True)
70
+ b = fg.tensor([0.1, -0.1], requires_grad=True)
71
+
72
+ # Forward pass: Linear projection + GELU activation
73
+ y = fg.matmul(x, w) + b
74
+ loss = fg.sum(fg.nn.functional.gelu(y))
75
+
76
+ # Compute Vector-Jacobian Products (Autograd backward)
77
+ loss.backward()
78
+
79
+ print("Loss Value :", loss.numpy())
80
+ print("Gradient dL/dw :\n", w.grad.numpy())
81
+ ```
82
+
83
+ ---
84
+
85
+ ### 2. Character-Level Transformer (NanoGPT)
86
+
87
+ Train a complete causal autoregressive transformer directly on your local device:
88
+
89
+ ```python
90
+ import forge as fg
91
+ import forge.nn as nn
92
+ from forge.models.nanogpt import GPT, GPTConfig
93
+
94
+ # Define model configuration
95
+ config = GPTConfig(
96
+ block_size=32,
97
+ vocab_size=64,
98
+ n_layer=4,
99
+ n_head=4,
100
+ n_embd=64,
101
+ bias=False
102
+ )
103
+ model = GPT(config)
104
+ optimizer = fg.optim.AdamW(model.parameters(), lr=1e-3, weight_decay=1e-2)
105
+ criterion = nn.CrossEntropyLoss()
106
+
107
+ # Training step (Batch Size: 8, Sequence Length: 32)
108
+ input_tokens = fg.tensor([[1, 5, 12, 3]], dtype="int32")
109
+ target_tokens = fg.tensor([[5, 12, 3, 18]], dtype="int32")
110
+
111
+ optimizer.zero_grad()
112
+ logits = model(input_tokens)
113
+ loss = criterion(logits, target_tokens)
114
+ loss.backward()
115
+ optimizer.step()
116
+ ```
117
+
118
+ ---
119
+
120
+ ### 3. Speech-to-Text & Acoustic Signal Processing (`forge.fft` + `forge.nn`)
121
+
122
+ Compute real Fourier Mel-spectrograms from raw acoustic waveforms:
123
+
124
+ ```python
125
+ import forge as fg
126
+ import forge.nn as nn
127
+
128
+ # 16kHz PCM audio waveform (Batch: 4, Samples: 8000)
129
+ raw_audio = fg.tensor(audio_data, dtype="float32")
130
+
131
+ # Fast Fourier Transform (Complex Spectrum)
132
+ fft_complex = fg.fft.rfft(raw_audio, n=1024, dim=-1)
133
+
134
+ # Power Spectrogram Energy
135
+ power_spec = (fft_complex.real.pow(2.0) + fft_complex.imag.pow(2.0) + 1e-6).log()
136
+
137
+ # 1D Convolutional Audio Feature Extractor
138
+ conv = nn.Conv1d(in_channels=513, out_channels=64, kernel_size=3, padding=1)
139
+ audio_features = conv(power_spec)
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Comprehensive Module Directory
145
+
146
+ | Module | Core Functionality | Key Operators / Classes |
147
+ | :--- | :--- | :--- |
148
+ | **`forge`** | Core Tensor Engine & Factories | `tensor`, `zeros`, `ones`, `randn`, `matmul`, `einsum`, `reshape`, `permute`, `where` |
149
+ | **`forge.nn`** | Deep Learning Layers & Containers | `Linear`, `Conv1d`, `Conv2d`, `MultiheadAttention`, `LayerNorm`, `RMSNorm`, `BatchNorm2d`, `Embedding`, `CrossEntropyLoss`, `MSELoss` |
150
+ | **`forge.optim`** | Optimizers & Rate Schedulers | `SGD`, `Adam`, `AdamW`, `RMSprop`, `CosineAnnealingLR`, `StepLR` |
151
+ | **`forge.linalg`** | Linear Algebra Decomposition | `norm`, `svd`, `qr`, `cholesky`, `inv`, `pinv`, `det`, `matrix_rank`, `solve`, `eigh` |
152
+ | **`forge.fft`** | Discrete Fourier Transforms | `rfft`, `irfft`, `fft`, `ifft`, `fft2`, `ifft2`, `rfft2`, `irfft2`, `fftfreq`, `fftshift` |
153
+ | **`forge.special`** | Transcendental & Error Functions | `erf`, `erfc`, `erfinv`, `gammaln`, `digamma`, `expm1`, `log1p`, `expit`, `logit`, `sinc`, `i0`, `xlogy` |
154
+ | **`forge.distributions`**| Probability Distributions & KL | `Normal(rsample)`, `Uniform`, `Bernoulli`, `Categorical`, `kl_divergence` |
155
+ | **`forge.models`** | Pre-architected Reference Models | `GPT`, `GPTConfig`, `LLaMA` |
156
+
157
+ ---
158
+
159
+ ## In-Browser Zero-Install Execution (WebGPU + Pyodide)
160
+
161
+ amv-forge packages a single bundled JavaScript distribution (`forge-py-bundle.js`) that mounts into browser-native Pyodide runtimes:
162
+
163
+ ```html
164
+ <script src="https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.js"></script>
165
+ <script src="https://uno-km.github.io/amv-forge/dist/forge-py-bundle.js"></script>
166
+ <script>
167
+ async function runClientDeepLearning() {
168
+ let pyodide = await loadPyodide();
169
+ await window.loadAmevaForgeBundle(pyodide);
170
+
171
+ await pyodide.runPythonAsync(`
172
+ import forge as fg
173
+ x = fg.randn((1024, 1024), device="gpu")
174
+ y = fg.matmul(x, x)
175
+ print("Computed 1024x1024 on WebGPU Hardware:", y.shape)
176
+ `);
177
+ }
178
+ runClientDeepLearning();
179
+ </script>
180
+ ```
181
+
182
+ ---
183
+
184
+ ## ?Œ The AMEVA Foundation (?„ë©”ë°??¬ë‹¨)
185
+
186
+ **amv-forge** is an open-source deep learning initiative created and governed by the **AMEVA Foundation** (?„ë©”ë°??¬ë‹¨).
187
+
188
+ ### ?ޝ Our Mission & Zero-Server Paradigm
189
+ The AMEVA Foundation is dedicated to the **democratisation of client-side artificial intelligence and edge computing**. We envision a decentralized web where deep learning training, fine-tuning, and neural inference occur directly on user devices (browsers, laptops, tablets, and smartphones)?”eliminating massive cloud server costs, safeguarding user data sovereignty with zero network leakage, and providing zero-latency neural intelligence everywhere.
190
+
191
+ ### ?ŒŸ Core Foundation Initiatives
192
+ - ?Œ **amv-forge Tensor Engine**: High-performance WebGPU tensor computation & reverse-mode autograd engine.
193
+ - ?Ž™ï¸?**On-Device Whisper STT**: Real-time acoustic FFT signal processing & speech recognition running locally in browser.
194
+ - ?¤– **Decentralized LLM Transformers**: Zero-install character and subword transformer models with zero cloud dependency.
195
+ - ?”’ **Privacy-First AI Sovereignty**: Sovereign on-device machine learning where private data never leaves client silicon.
196
+
197
+ * **Foundation Portal**: [https://uno-km.github.io/amv-forge/](https://uno-km.github.io/amv-forge/)
198
+ * **Official Repository**: [https://github.com/uno-km/amv-forge](https://github.com/uno-km/amv-forge)
199
+ * **Community & Governance**: [https://github.com/uno-km/amv-forge/issues](https://github.com/uno-km/amv-forge/issues)
200
+ * **Sponsorship & Research Partnerships**: [https://github.com/uno-km](https://github.com/uno-km)
201
+
202
+ ---
203
+
204
+ ## Quality Assurance & Verification
205
+
206
+ Every release of amv-forge undergoes rigorous multi-tier verification:
207
+ * **292 Unit & Stress Tests**: 100% automated pass rate across CPU, GPU fallback, mathematical accuracy, and memory quota managers.
208
+ * **Finite-Difference Gradcheck**: Numerical gradient validation against analytical Vector-Jacobian backward formulations.
209
+ * **Memory Lifecycle Audit**: Zero-leak allocation token reclamation and buffer recycling verification across 10,000+ continuous execution cycles.
210
+
211
+ ---
212
+
213
+ ## License & Citation
214
+
215
+ amv-forge is licensed under the [MIT License](https://github.com/uno-km/amv-forge/blob/main/LICENSE).
216
+
217
+ ```bibtex
218
+ @software{ameva_forge_2026,
219
+ author = {AMEVA Foundation},
220
+ title = {amv-forge: High-Performance WebGPU-Accelerated Tensor Computation Engine},
221
+ year = {2026},
222
+ publisher = {GitHub},
223
+ url = {https://github.com/uno-km/amv-forge}
224
+ }
225
+ ```
226
+
@@ -0,0 +1,72 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "amv-forge"
7
+ version = "2.0.0"
8
+ description = "High-performance WebGPU-accelerated tensor computation engine with reverse-mode autograd for browser and edge deep learning."
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ requires-python = ">=3.9"
12
+ authors = [
13
+ {name = "AMEVA Foundation", email = "contact@uno-km.com"}
14
+ ]
15
+ maintainers = [
16
+ {name = "AMEVA Engineering Team"}
17
+ ]
18
+ keywords = [
19
+ "deep-learning",
20
+ "tensor",
21
+ "autograd",
22
+ "webgpu",
23
+ "pytorch",
24
+ "transformers",
25
+ "pyodide",
26
+ "wasm",
27
+ "machine-learning"
28
+ ]
29
+ classifiers = [
30
+ "Development Status :: 4 - Beta",
31
+ "Intended Audience :: Developers",
32
+ "Intended Audience :: Science/Research",
33
+ "License :: OSI Approved :: MIT License",
34
+ "Programming Language :: Python :: 3",
35
+ "Programming Language :: Python :: 3.9",
36
+ "Programming Language :: Python :: 3.10",
37
+ "Programming Language :: Python :: 3.11",
38
+ "Programming Language :: Python :: 3.12",
39
+ "Programming Language :: Python :: 3.13",
40
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
41
+ "Topic :: Scientific/Engineering :: Mathematics",
42
+ "Topic :: Software Development :: Libraries :: Python Modules",
43
+ "Operating System :: OS Independent",
44
+ ]
45
+ dependencies = [
46
+ "numpy>=1.20.0",
47
+ ]
48
+
49
+ [project.optional-dependencies]
50
+ dev = [
51
+ "pytest>=7.0",
52
+ "pytest-cov>=4.0",
53
+ ]
54
+
55
+ [project.urls]
56
+ Homepage = "https://uno-km.github.io/amv-forge/"
57
+ Documentation = "https://uno-km.github.io/amv-forge/"
58
+ Repository = "https://github.com/uno-km/amv-forge"
59
+ Issues = "https://github.com/uno-km/amv-forge/issues"
60
+ Changelog = "https://github.com/uno-km/amv-forge/blob/main/RELEASE_NOTES.md"
61
+
62
+ [tool.setuptools.packages.find]
63
+ where = ["src"]
64
+
65
+ [tool.setuptools.package-data]
66
+ forge = ["py.typed"]
67
+
68
+ [tool.pytest.ini_options]
69
+ testpaths = ["tests"]
70
+ python_files = ["test_*.py"]
71
+ pythonpath = ["src"]
72
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+