Kiwigrad
Despite lacking the ability to fly through the skies like PyTorch and TensorFlow, the Kiwigrad is still a formidable bird that is teeming with untapped potential waiting to be uncovered. 😉
Kiwigrad? yes, it is another version of micrograd that was created just for fun and experimentation.
Install
To install the current release,
pip install kiwigrad
Functionalities
Kiwigrad is a modified version of the micrograd and the minigrad packages with additional features. The main features added to Kiwigrad are:
- Training is faster due to the C implementation of the Value object.
- Tracing functionalities like the original micrograd package were added. An example of this can be seen in the ops notebook.
- Methods for saving and loading the weights of a trained model.
- Support for RNN(1) feedforward neural networks.
Examples
- In the examples folder, you can find examples of models trained using the Kiwigrad library.
- A declaration example of an MLP net using Kiwigrad:
from kiwigrad import MLP, Layer
class PotNet(MLP):
def __init__(self):
layers = [
Layer(nin=2, nout=16, bias=True, activation="relu"),
Layer(nin=16, nout=16, bias=True, activation="relu"),
Layer(nin=16, nout=1, bias=True, activation="linear")
]
super().__init__(layers=layers)
model = PotNet()
from kiwigrad import Value, draw_dot
a = Value(-4.0)
b = Value(2.0)
c = a + b
d = a * b + b**3
c += c + Value(1.)
c += Value(1.) + c + (-a)
d += d * Value(2) + (b + a).relu()
d += Value(3.) * d + (b - a).relu()
e = c - d
f = e**2
g = f / Value(2.0)
g += Value(10.0) / f
print(f'{g.data:.4f}') # prints 24.7041, the outcome of this forward pass
g.backward()
print(f'{a.grad:.4f}') # prints 138.8338, i.e. the numerical value of dg/da
print(f'{b.grad:.4f}') # prints 645.5773, i.e. the numerical value of dg/db
draw_dot(g)
Running test
cd test
pytest .
Metadata
Release files for kiwigrad 0.28
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kiwigrad-0.28.tar.gz | 10.4 kB | Without provenance | Details for kiwigrad-0.28.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kiwigrad-0.28-cp39-cp39-macosx_10_9_universal2.whl | CPython 3.9 | CPython 3.9 | macOS 10.9+ universal2 (ARM64, x86-64) | Details for kiwigrad-0.28-cp39-cp39-macosx_10_9_universal2.whl |
Total release size: 27.9 kB
Release files / kiwigrad-0.28.tar.gz
| Download URL | kiwigrad-0.28.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe118ec44b0a7f2b3573f8807481a182b7b390a9cc51284e8404523ee60d0332
|
|
BLAKE2b-256 checksum How to use checksums |
70cc26f79c4d09886377fda0ff4a1fd845b8013b168b0c0b9f1eceeb639155c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|
Release files / kiwigrad-0.28-cp39-cp39-macosx_10_9_universal2.whl
| Download URL | kiwigrad-0.28-cp39-cp39-macosx_10_9_universal2.whl |
|---|---|
| Size | 17.5 kB |
| Tags | CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
73cca6c4fcc751bfa0ca7564159818ef62cea3951144be64a57d4a2bf77031fb
|
|
BLAKE2b-256 checksum How to use checksums |
5db4c6db648eeace5c080288102f92b765537d719a7ab5a4298457000506bc5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|
Security for kiwigrad 0.28
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.