cogforge-engine 1.0.3__tar.gz → 1.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.
- {cogforge_engine-1.0.3 → cogforge_engine-1.0.4}/PKG-INFO +1 -1
- {cogforge_engine-1.0.3 → cogforge_engine-1.0.4}/cogforge/app.py +3 -3
- {cogforge_engine-1.0.3 → cogforge_engine-1.0.4}/pyproject.toml +1 -1
- {cogforge_engine-1.0.3 → cogforge_engine-1.0.4}/.github/workflows/release.yml +0 -0
- {cogforge_engine-1.0.3 → cogforge_engine-1.0.4}/.gitignore +0 -0
- {cogforge_engine-1.0.3 → cogforge_engine-1.0.4}/LICENSE +0 -0
- {cogforge_engine-1.0.3 → cogforge_engine-1.0.4}/README.md +0 -0
- {cogforge_engine-1.0.3 → cogforge_engine-1.0.4}/cogforge/__init__.py +0 -0
- {cogforge_engine-1.0.3 → cogforge_engine-1.0.4}/cogforge/backend.py +0 -0
- {cogforge_engine-1.0.3 → cogforge_engine-1.0.4}/cogforge/models.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cogforge-engine
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.4
|
|
4
4
|
Summary: A custom autograd engine and Transformer block built from scratch.
|
|
5
5
|
Project-URL: Homepage, https://github.com/avikmjd2/cogforge
|
|
6
6
|
Author-email: Avik Majumder <avikmjd2@gmail.com>
|
|
@@ -387,10 +387,10 @@ class Tensor:
|
|
|
387
387
|
flat, idx, rows = p.reshape(N, -1), target_ids.reshape(N), backend.np.arange(N)
|
|
388
388
|
loss = cls(-backend.np.log(backend.np.clip(flat[rows, idx], 1e-15, 1.0)).sum() / N, children=(scores,))
|
|
389
389
|
def _backward():
|
|
390
|
-
# g = p.reshape(N, -1).copy()
|
|
391
390
|
g = p.reshape(N, -1)
|
|
392
|
-
g[rows, idx] -= 1.0
|
|
393
|
-
|
|
391
|
+
g[rows, idx] -= 1.0
|
|
392
|
+
coef = numpy.float32(float(loss.grad) / N)
|
|
393
|
+
_iadd_scaled(scores.grad, g.reshape(scores.shape), coef)
|
|
394
394
|
loss._backwards = _backward
|
|
395
395
|
return loss
|
|
396
396
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|