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