{"id":22128381,"url":"https://github.com/michaelradu/tinytensor","last_synced_at":"2025-03-24T08:42:17.108Z","repository":{"id":239884127,"uuid":"800883322","full_name":"michaelradu/tinytensor","owner":"michaelradu","description":"⚡TinyTensor is a lightweight open-source deep learning library built from scratch in Python, inspired by Joel Grus' approach.","archived":false,"fork":false,"pushed_at":"2024-05-15T07:33:34.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T14:15:44.162Z","etag":null,"topics":["ai","deep-learning","deep-learning-algorithms","deep-neural-networks","deep-reinforcement-learning","deeplearning","deeplearning-ai","machine-learning","machine-learning-algorithms","machine-learning-library","machinelearning-python","neural-network","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelradu.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":"2024-05-15T07:20:57.000Z","updated_at":"2024-08-13T14:21:38.000Z","dependencies_parsed_at":"2024-05-15T23:04:01.462Z","dependency_job_id":null,"html_url":"https://github.com/michaelradu/tinytensor","commit_stats":null,"previous_names":["michaelradu/tinytensor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelradu%2Ftinytensor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelradu%2Ftinytensor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelradu%2Ftinytensor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelradu%2Ftinytensor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelradu","download_url":"https://codeload.github.com/michaelradu/tinytensor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245239965,"owners_count":20583097,"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":["ai","deep-learning","deep-learning-algorithms","deep-neural-networks","deep-reinforcement-learning","deeplearning","deeplearning-ai","machine-learning","machine-learning-algorithms","machine-learning-library","machinelearning-python","neural-network","python","python3"],"created_at":"2024-12-01T17:42:04.686Z","updated_at":"2025-03-24T08:42:17.087Z","avatar_url":"https://github.com/michaelradu.png","language":"Python","readme":"# TinyTensor: Deep Learning Library in Python\n# What is TinyTensor?\n\nTinyTensor is an open-source deep learning library built from scratch in Python, inspired by Joel Grus' approach. This project includes 2 examples for creating a Non-Linear Neural Network and training it in order to predict the common XOR and FizzBuzz problems.\n\n## Getting Started\nTo use this deep learning library locally, you have 2 methods available:\n\n1. Install locally\n2. Use the Docker Image\n\n### Method 1: Install Locally\n\n#### 1. Clone the Repository:\n```bash\ngit clone https://github.com/michaelradu/tinytensor.git\n```\n\n#### 2. Import the Library files:\n```python\n# Example of basic imports for training a Neural Network\nfrom tinytensor.train import train\nfrom tinytensor.nn import NeuralNet\nfrom tinytensor.layers import Linear, Tanh\nfrom tinytensor.optim import SGD\n```\n\n#### Optional. Export your model:\n```python\nimport pickle\n\nwith open('./models/trained_pipeline-0.1.0.pk1', 'wb') as f:\n    pickle.dump(net, f)\n```\n\n#### 3. Build Awesome Things!\n\n### Method 2: Use the Docker Image\n\n#### 1. Clone the Repository:\n```bash\ngit clone https://github.com/michaelradu/tinytensor.git\n```\n\n#### 2. Build Docker Image:\n```bash\ncd tinytensor\ndocker build -t tinytensor-app .\n```\n\n#### 3. Run Docker Container:\n```bash\ndocker run tinytensor-app\n```\n\n##### 2. Import the Library files:\n```python\n# Example of basic imports for training a Neural Network\nfrom tinytensor.train import train\nfrom tinytensor.nn import NeuralNet\nfrom tinytensor.layers import Linear, Tanh\nfrom tinytensor.optim import SGD\n```\n\n#### Optional. Export your model:\n```python\nimport pickle\n\nwith open('./models/trained_pipeline-0.1.0.pk1', 'wb') as f:\n    pickle.dump(net, f)\n```\n\n#### 3. Build Awesome Things!\n\n# Dependencies\n\n- Numpy\n- Docker (Optional)\n\n# Project Structure\n\n- **tinytensor:** This directory contains the deep learning library files.\n    - **tinytensor/\\_init_.py:** Default init file for python libraries.\n    - **tinytensor/data.py:** Tools for iterating over data in batches.\n    - **tinytensor/layers.py:** Layers for training Neural Networks.\n    - **tinytensor/loss.py:** File containing available loss functions.\n    - **tinytensor/nn.py:** Neural Network base class for instantiating objects. In essence, a collection of layers.\n    - **tinytensor/optim.py:** Optimization functions available for the training process.\n    - **tinytensor/tensor.py:** Cheat tensor class implementation.\n    - **tinytensor/train.py:** Default Training function for fitting models.\n- **models:** This directory contains exported pre-trained models, optional to the actual library.\n- **examples:** Directory showcasing example neural networks built with tinytensor.\n    - **fizzbuzz.py:** Example tinytensor Neural Network trained on the popular fizzbuzz problem with a default number of 5000 epochs.\n    - **xor.py:** Example non-linear tinytensor Neural Network trained on predicting valid xor values. \n    - **xor-export.py:** `xor.py` example with pickle model export included for use within other apps.\n\n\n# Model Fitting Process\n\nFitting or training a model is a straightforward process. To achieve this:\n\n1. Import or create a new dataset.\n2. Edit your file to incorporate the new dataset.\n3. Implement any model pipeline according to your requirements.\n4. (Optional) Export your model with pickle.\n5. Run your python file to train the model. \n6. Update the version, and a new model, named trained_pipeline-0.1.1.pkl, will be saved in the models directory.\n\nFor more code-wise information see the provided examples and play around with them.\n\n# Contributions Welcome\n\nContributions to this project are highly encouraged! If you have ideas for improvements, bug fixes, or new features, feel free to open an issue or submit a pull request. Let's collaborate to make this library even better and learn new concepts together!\n\n# License\n\nThis code is licensed under the GNU General Public License, version 3 (GPL-3.0). See the LICENSE file for more details.\n\n# Acknowledgments\n\nSpecial thanks to [Joel Grus](https://github.com/joelgrus) and the open-source community for their amazing contributions to Machine Learning and for their copious amounts of educational content, making projects like this possible.\n\nFeel free to explore, experiment, modify, rewrite, and integrate this library into your applications. Happy coding!\n\n# Current Features\n1. Tensors\n    ---\n    - Cheat Numpy Implementation \n2. Loss Functions\n    ---\n    - MSE (Mean Squared Error), although the current implementation is more similar to Total Squared Erorr.\n3. Layers\n    ---\n    - Linear\n    - Tanh Activation\n4. Neural Nets\n    ---\n    - Convolutional\n5. Optimizers\n    ---\n    - SGD (Stochastic Gradient Descent)\n6. Data\n    ---\n    - Batch Iterators\n7. Training\n    ---\n    - Helper Training Function\n8. Provided Examples\n    ---\n    - XOR Example\n    - XOR + Model Export Example\n    - FizzBuzz Example\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelradu%2Ftinytensor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelradu%2Ftinytensor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelradu%2Ftinytensor/lists"}