{"id":20312487,"url":"https://github.com/ahammadnafiz/fiztorch","last_synced_at":"2025-04-11T16:51:35.197Z","repository":{"id":262558046,"uuid":"861809855","full_name":"ahammadnafiz/FizTorch","owner":"ahammadnafiz","description":"Toy Implementation of PyTorch","archived":false,"fork":false,"pushed_at":"2025-02-25T01:55:30.000Z","size":19390,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T12:53:36.081Z","etag":null,"topics":["algorithms","deep-learning","deep-neural-networks","framework","implementation","neural-network","python","python-3","pytorch","pytorch-tutorial","tensorflow2","torch","tutorial"],"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/ahammadnafiz.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-09-23T14:48:28.000Z","updated_at":"2025-02-25T01:55:34.000Z","dependencies_parsed_at":"2024-11-13T04:26:37.618Z","dependency_job_id":"9bb8afcd-ff4f-4c1b-b623-ca0999f8ffb4","html_url":"https://github.com/ahammadnafiz/FizTorch","commit_stats":null,"previous_names":["ahammadnafiz/fiztorch"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahammadnafiz%2FFizTorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahammadnafiz%2FFizTorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahammadnafiz%2FFizTorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahammadnafiz%2FFizTorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahammadnafiz","download_url":"https://codeload.github.com/ahammadnafiz/FizTorch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248443038,"owners_count":21104326,"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":["algorithms","deep-learning","deep-neural-networks","framework","implementation","neural-network","python","python-3","pytorch","pytorch-tutorial","tensorflow2","torch","tutorial"],"created_at":"2024-11-14T18:06:19.910Z","updated_at":"2025-04-11T16:51:35.188Z","avatar_url":"https://github.com/ahammadnafiz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cdiv align=\"center\"\u003e\n\n![Logo](assets/fiztorch.png)\n\n🔥 A Minimal Deep Learning Framework 🔥\n\n[![Python Version](https://img.shields.io/badge/python-3.12-blue.svg)](https://www.python.org/downloads/release/python-3120/)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)\n[![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg)](https://travis-ci.org/yourusername/FizTorch)\n[![Stars](https://img.shields.io/github/stars/ahammadnafiz/FizTorch?style=social)](https://github.com/ahammadnafiz/FizTorch/stargazers)\n\n📊 🔢 🧮 🤖 📈\n\n\u003c/div\u003e\n\n\nFizTorch is a lightweight deep learning framework designed for educational purposes and small-scale projects. It provides a simple and intuitive API for building and training neural networks, inspired by popular frameworks like PyTorch.\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Examples](#examples)\n- [Contributing](#contributing)\n- [License](#license)\n- [Roadmap](#roadmap)\n\n## Features\n\n- **Tensor Operations**: Basic tensor operations with support for automatic differentiation.\n- **Neural Network Layers**: Common neural network layers such as Linear and ReLU.\n- **Sequential Model**: Easy-to-use sequential model for stacking layers.\n- **Functional API**: Functional operations for common neural network functions.\n\n## Installation\n\nTo install FizTorch, follow these steps:\n\n1. **Clone the Repository**:\n   ```sh\n   git clone https://github.com/ahammadnafiz/FizTorch.git\n   cd FizTorch\n   ```\n\n2. **Set Up a Virtual Environment** (optional but recommended):\n   ```sh\n   python -m venv fiztorch-env\n   source fiztorch-env/bin/activate  # On Windows, use `fiztorch-env\\Scripts\\activate`\n   ```\n\n3. **Install Dependencies**:\n   ```sh\n   pip install -r requirements.txt\n   ```\n\n4. **Install FizTorch**:\n   ```sh\n   pip install -e .\n   ```\n\n## Usage\n\nHere is a simple example of how to use FizTorch to build and train a neural network:\n\n```python\nimport numpy as np\nfrom sklearn.datasets import load_breast_cancer\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.metrics import classification_report, confusion_matrix\n\nfrom fiztorch.tensor import Tensor\nfrom fiztorch.nn.layers import Linear, ReLU, Sigmoid\nfrom fiztorch.nn.sequential import Sequential\nimport fiztorch.nn.functional as F\nimport fiztorch.optim.optimizer as opt\n\ndef load_data():\n    X, y = load_breast_cancer(return_X_y=True)\n    X = StandardScaler().fit_transform(X)\n    return train_test_split(Tensor(X), Tensor(y), test_size=0.2, random_state=42)\n\ndef create_model():\n    return Sequential(Linear(30, 64), ReLU(), Linear(64, 32), ReLU(), Linear(32, 1), Sigmoid())\n\ndef train_epoch(model, optimizer, X_train, y_train, batch_size=32):\n    indices = np.random.permutation(len(X_train.data))\n    for i in range(0, len(X_train.data), batch_size):\n        batch = indices[i:i+batch_size]\n        optimizer.zero_grad()\n        loss = F.binary_cross_entropy(model(Tensor(X_train.data[batch])), Tensor(y_train.data[batch]))\n        loss.backward()\n        optimizer.step()\n\ndef evaluate(model, X, y):\n    preds = model(X).data \u003e 0.5\n    print(classification_report(y.data, preds))\n    print(confusion_matrix(y.data, preds))\n\ndef main():\n    X_train, X_test, y_train, y_test = load_data()\n    model, optimizer = create_model(), opt.Adam(model.parameters(), lr=0.001)\n    for _ in range(100): train_epoch(model, optimizer, X_train, y_train)\n    evaluate(model, X_test, y_test)\n\nif __name__ == \"__main__\":\n    main()\n\n```\n\n## Examples\n\n### MNIST HAND DIGIT TEST\nNeural network training on MNIST digits using  FizTorch library with Adam optimizer (configurable learning rate), batch support, real-time accuracy/loss tracking\n![Training Process](assets/training_progress.gif)\n\n### California Housing TEST\nNeural network training on California Housing Dataset using  FizTorch library\n![Training Process](assets/training_progress_regression.gif)\n\n\n### Linear Layer\n\n```python\nfrom fiztorch.tensor import Tensor\nfrom fiztorch.nn import Linear\n\n# Create a linear layer\nlayer = Linear(2, 3)\n\n# Create some input data\ninput = Tensor([[1.0, 2.0]])\n\n# Forward pass\noutput = layer(input)\n\n# Print the output\nprint(output)\n```\n\n### ReLU Activation\n\n```python\nfrom fiztorch.tensor import Tensor\nfrom fiztorch.nn import ReLU\n\n# Create a ReLU activation\nrelu = ReLU()\n\n# Create some input data\ninput = Tensor([-1.0, 0.0, 1.0])\n\n# Forward pass\noutput = relu(input)\n\n# Print the output\nprint(output)\n```\n\n### Sequential Model\n\n```python\nfrom fiztorch.tensor import Tensor\nfrom fiztorch.nn import Linear, ReLU, Sequential\n\n# Define a sequential model\nmodel = Sequential(\n    Linear(2, 3),\n    ReLU(),\n    Linear(3, 1)\n)\n\n# Create some input data\ninput = Tensor([[1.0, 2.0]])\n\n# Forward pass\noutput = model(input)\n\n# Print the output\nprint(output)\n```\n## TODO\n\n- [x] Implement basic tensor operations\n- [x] Add support for automatic differentiation\n- [x] Create fundamental neural network layers\n- [x] Build sequential model functionality\n- [x] Implement basic optimizers\n- [x] Add MNIST digit recognition example\n- [x] Add California housing regression example\n- [X] Add more activation functions (Leaky ReLU, ELU, SELU)\n- [ ] Implement convolutional layers\n- [ ] Add batch normalization\n- [ ] Support GPU acceleration\n- [ ] Create comprehensive documentation\n- [ ] Add unit tests\n- [x] Implement data loading utilities\n- [ ] Add model saving/loading functionality\n- [ ] Implement dropout layers\n- [ ] Add learning rate schedulers\n- [x] Create visualization utilities\n- [ ] Support multi-GPU training\n- [ ] Add model quantization\n- [ ] Add Load dataset functionality\n\n## Roadmap\n\n### Phase 1: Core Features\n\n- Enhance tensor operations with more advanced functionalities (e.g., broadcasting).\n- Add support for GPU acceleration (e.g., via CUDA or ROCm).\n- Improve the API for ease of use and consistency.\n\n### Phase 2: Neural Network Enhancements\n\n- Add additional layers such as Convolutional, Dropout, and BatchNorm.\n- Expand activation functions (e.g.,ELU).\n- Integrate pre-trained models for common tasks.\n\n### Phase 3: Training and Optimization\n\n- Implement additional optimizers\n- Add learning rate schedulers.\n- Enhance support for custom loss functions.\n\n### Phase 4: Dataset and Data Loading\n\n- Provide built-in dataset utilities (e.g., MNIST, CIFAR).\n- Create a flexible data loader with augmentation capabilities.\n\n### Phase 5: Visualization and Monitoring\n\n- Add utilities for loss/accuracy visualization.\n- Integrate real-time training monitoring (e.g., TensorBoard support).\n\n### Phase 6: Community Contributions\n\n- Establish guidelines for community-driven feature additions.\n- Host challenges to encourage usage and development.\n\n## Contributing\n\nContributions are welcome! Please follow these steps to contribute:\n\n1. Fork the repository.\n2. Create a new branch (`git checkout -b feature-branch`).\n3. Commit your changes (`git commit -am 'Add new feature'`).\n4. Push to the branch (`git push origin feature-branch`).\n5. Create a new Pull Request.\n\n## License\n\nFizTorch is licensed under the MIT License. See the [LICENSE](https://github.com/ahammadnafiz/FizTorch/blob/main/LICENSE) file for more information.\n\n## Contact\n\nFor any questions or feedback, please open an issue or contact the maintainers.\n\n---\n\n\u003cdiv align=\"center\"\u003e\nMade with ❤️ by \u003ca href=\"https://github.com/ahammadnafiz\"\u003eahammadnafiz\u003c/a\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahammadnafiz%2Ffiztorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahammadnafiz%2Ffiztorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahammadnafiz%2Ffiztorch/lists"}