semvec/pypi-packages huggingface dataset:
gradipy 0.1.0
A Lightweight Neural Network Library only using NumPy with Pytorch-like API
License: MIT
Requires Python: >=3.8


# gradipy: A Lightweight Neural Network Library
![Tests](https://github.com/eljanmahammadli/gradipy/actions/workflows/ci.yml/badge.svg)

gradipy is an evolving project, and it will potentially provide PyTorch-like API for building and training neural networks, there are some features that are actively developed on and plan to support in future releases.

## Desired features to add:
- PyTorch like API for most important blocks for training NNs 
- Convolutional layers for image processing
- Recurrent layers for sequence data
- Potentially GPU acceleration

Please note that the library is currently in its early stages, and these features are expected in future updates.



## Sample Usage

Here's a basic example of using gradipy to create and train a simple neural network for MNIST (please refer to the [example usage](https://github.com/eljanmahammadli/gradipy/blob/main/examples/mnist.py)): 

```python
import gradipy.nn as nn
from gradipy import datasets
from gradipy.nn import optim

X_train, y_train, X_val, y_val, X_test, y_test = datasets.MNIST()

# define some utility function here...

class DenseNeuralNetwork:
    def __init__(self, input_dim, hidden_dim, output_dim):
        self.W1 = nn.init_kaiming_normal(input_dim, hidden_dim, nonlinearity="relu")
        self.W2 = nn.init_kaiming_normal(hidden_dim, output_dim, nonlinearity="relu")

    def forward(self, X):
        logits = X.matmul(self.W1).relu().matmul(self.W2)
        return logits

model = DenseNeuralNetwork(input_dim, hidden_dim, output_dim)
criterion = nn.CrossEntropyLoss()
optimizer = optim.Adam([model.W1, model.W2], lr=lr)

for epoch in range(epochs + 1):
    optimizer.zero_grad()
    xb, yb = get_batch()
    logits = model.forward(xb)
    loss = criterion(logits, yb)
    loss.backward()
    optimizer.step()

    # log the results on each epoch...
```

In this example, we define a simple feedforward neural network, compile it, and train it on random data. gradipy will provide building blocks like `Linear` layers, `activation` functions, `loss` functions, and `optimizers` for creating and training neural networks.

## Feature Roadmap

Here's a list of features we plan to implement in gradipy, along with their current status:

### To-Do

- [ ] Backward passes for: `mul` (problem with broadcasting), `tanh`
- [ ] Add more operations and their gradients
- [ ] Batchnorm
- [ ] Convolutional layers for image processing
- [ ] PyTorch's `nn.Module`
- [ ] More Loss functions (`nn.MSELoss` and `nn.NLLLoss`)
- [ ] Recurrent layers for sequence data
- [ ] GPU acceleration (no idea how to do that)

### Done

- [x] Basic Tensor wrapper around NumPy `ndarray`
- [x] Forward and backward passes implemented for: `add`, `matmul`, `softmax`, `relu`, `sub`, `log`, `exp`, `log softmax`, `cross entropy` 
- [x] Autograd just like PyTorch's `backward` method using topological sort
- [x] nn.CrossEntropyLoss function 
- [x] Train MNIST with `gradipy`
- [x] Kaiming, Xavier init (normal + uniform)
- [x] Implemented Adam and added momentum to SGD
country_list 1.1.0
List of all countries with names and ISO 3166-1 codes in all languages
License: MIT
Requires Python: >=3.8,<4.0

============
Country List
============

.. image:: https://github.com/bulv1ne/country_list/actions/workflows/python-app.yml/badge.svg
        :target: https://github.com/bulv1ne/country_list/actions/workflows/python-app.yml

.. image:: https://img.shields.io/pypi/v/country_list.svg
        :target: https://pypi.python.org/pypi/country_list

.. image:: https://pyup.io/repos/github/bulv1ne/country_list/shield.svg
        :target: https://pyup.io/repos/github/bulv1ne/country_list/
        :alt: Updates

.. image:: https://coveralls.io/repos/github/bulv1ne/country_list/badge.svg?branch=master
        :target: https://coveralls.io/github/bulv1ne/country_list?branch=master

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
        :target: https://github.com/psf/black

.. image:: https://sonarcloud.io/api/project_badges/measure?project=bulv1ne_country_list&metric=alert_status
        :target: https://sonarcloud.io/summary/new_code?id=bulv1ne_country_list
        :alt: Quality Gate Status


Features
--------

- List of all countries with names and ISO 3166-1 codes in all languages and all data formats.


Installation
------------

Install country_list by running:

.. code-block:: sh

    pip install country_list

Usage
-----

Get all available languages:

.. code-block:: python

    from country_list import available_languages

    for language in available_languages():
        print(language)

Get country names in english and swedish:

.. code-block:: python

    >>> from country_list import countries_for_language
    >>> # countries_for_language returns a list of tuples now, might be changed to an OrderedDict
    >>> countries = dict(countries_for_language('en'))
    >>> print(countries['GB'])
    'United Kingdom'
    >>> print(countries['SE'])
    'Sweden'
    >>> countries = dict(countries_for_language('sv'))
    >>> print(countries['GB'])
    'Storbritannien'
    >>> print(countries['SE'])
    'Sverige'

Get country codes from country name:

.. code-block:: python

    >>> from country_list import countries_for_language
    >>> # countries_for_language returns a list of tuples now, might be changed to an OrderedDict
    >>> country_names = {name: code for code, name in countries_for_language('en')}
    >>> print(country_names['United Kingdom'])
    'GB'
    >>> print(country_names['Sweden'])
    'SE'
    >>> country_names = {name: code for code, name in countries_for_language('sv')}
    >>> print(country_names['Storbritannien'])
    'GB'
    >>> print(country_names['Sverige'])
    'SE'

Credits
-------

This package contains the data files from `umpirsky/country-list`_.

This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.

.. _`umpirsky/country-list`: https://github.com/umpirsky/country-list
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage

License
-------

The project is licensed under the MIT license.