{"id":15675770,"url":"https://github.com/tanmoyio/gradman","last_synced_at":"2025-05-07T00:25:52.213Z","repository":{"id":104207323,"uuid":"274489821","full_name":"tanmoyio/GradMan","owner":"tanmoyio","description":"Baby deep learning library🐣","archived":false,"fork":false,"pushed_at":"2022-01-22T16:41:30.000Z","size":149,"stargazers_count":14,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T04:26:42.483Z","etag":null,"topics":["autograd","deep-learning","deep-neural-networks"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tanmoyio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-23T19:18:35.000Z","updated_at":"2024-08-22T13:16:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"a005d33c-fff3-4136-9ec9-aa988d88ce24","html_url":"https://github.com/tanmoyio/GradMan","commit_stats":{"total_commits":91,"total_committers":1,"mean_commits":91.0,"dds":0.0,"last_synced_commit":"12a1be845462d188243116acbb28769c64b7d75e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanmoyio%2FGradMan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanmoyio%2FGradMan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanmoyio%2FGradMan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanmoyio%2FGradMan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tanmoyio","download_url":"https://codeload.github.com/tanmoyio/GradMan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252789809,"owners_count":21804498,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autograd","deep-learning","deep-neural-networks"],"created_at":"2024-10-03T16:00:42.379Z","updated_at":"2025-05-07T00:25:52.202Z","avatar_url":"https://github.com/tanmoyio.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GradMan [![CI](https://github.com/tanmoyio/GradMan/actions/workflows/lint.yml/badge.svg)](https://github.com/tanmoyio/GradMan/actions/workflows/lint.yml)[![Tensor-Test](https://github.com/tanmoyio/GradMan/actions/workflows/tensor-test.yml/badge.svg)](https://github.com/tanmoyio/GradMan/actions/workflows/tensor-test.yml)\n\n\u003cimg src=\"https://imgur.com/qdTcXdY.png\" height=200\u003e\n\nBaby deep learning library. This library doesn't do much in terms of solving complex models. Check [gradman resources](https://github.com/tanmoyio/GradMan/tree/master/resources). We are in the way of replacing the mathematical computations with c++ backend also cuda for GPU support. Mail me if you want to join GradMan's acccelarated computing group. \n\n### Install\n```\npip install gradman\n```\n### Gradman Tensor Operations 🥚\n\nJust like `numpy.ndarray` operations `gradman` tensor supports mathematical operations. \n\n```python3\nfrom gradman import Tensor\n\na = Tensor([[2.0, 0.3, 0.5]], requires_grad=True)\na = Tensor([[9.0], [0.1], [0.8]], requires_grad=True)\nprint(a @ b)\n```\n\n### BabyGrad Engine 🐣\n```python3\nfrom gradman import Tensor\n\na = Tensor([1.0, 0.5, 0.8], requires_grad=True)\nb = a.sum()\nb.backward()\nprint(a.grad)\n```\n```\n$ \u003cTensor ([1. 1. 1.], requires_grad=False)\u003e\n```\n\n### Use `gradman.nn.Module` to create complex neural network 🐥\n```python3\nimport gradman.nn as nn\nfrom gradman import Tensor\n\nclass BabyModel(nn.Module):\n    def __init__(self):\n        super(BabyModel, self).__init__()\n        self.l1 = nn.Linear(6,3)\n        self.l2 = nn.Linear(3,1)\n\n    def forward(self, i):\n        return self.l2(self.l1(i))\n        \nmodel = BabyModel()\nout = model(Tensor([1, 2, 3, 4, 5, 6]))\nprint(out)\n```\nIt makes everything easy. Still there is always option of creating your own nn operations from scratch, and the `BabyGrad` engine will handle the backprop.\n\n### Training loop 🐙\nSimpler than `torch`\n\n```python3\nfrom gradman.optim import GDE\n\nmodel = BabyModel()\noptim = GDE(lr=0.001)\n\nfor _ in range(EPOCH):\n    '''Dataloading, batching module will be added in future versions'''\n    '''also the `criterion` is a dummy loss func. We will add those in future versions. But you can always create loss functions from basic tensor operations.'''\n    \n    y = model(inputs)\n    loss = criterion(y, labels)\n    y.backward()\n    optim.step(model.parameters())\n```\n`gradman` doesn't do `model.zero_grad()`. Why? Whenever the contents of a `Tensor` object being changed it will invalidate the gradients by itself and initialize fresh zero gradients.\n\n\n### Build from source 🐛\n```\ngit clone https://github.com/tanmoyio/GradMan \ncd GradMan\npip install poetry\npoetry build\ncat pyproject.toml | grep \"version\"\ncd dist/\npip install gradman-\u003cversion\u003e-none-any.whl\n```\n\n### Contribute 🍯\n\nBefore contributing, you must know the purpose of this library. I haven't made this library to create SOTA models with it but to preserve the core mathematical foundation of deep learning. \n\n#### Spaces where you can contribute. \n1. Zero level - Writing Tensor operations (Backward needed)\n2. Creating High level API/Layers for Deep Neural Network (No need to do backward)\n3. Writing unit tests\n4. Creating examples of the library, models and sharing.\n\nRun these two lines of command to pass the unit tests. \n\n```\nmake lint\npython -m pytest --import-mode=append tests -v\n```\n\nCurrent version of gradman uses basic tensor operation wrapped arround standard numpy. But I am also working on a gpu and RISCV version of `gradman`. Mail me if you are interested of being part of core developer of `gradman`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanmoyio%2Fgradman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftanmoyio%2Fgradman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanmoyio%2Fgradman/lists"}