[![Stargazers][stars-shield]][stars-url]
[![Forks][forks-shield]][forks-url]
[![Issues][issues-shield]][issues-url]
![GitHub Actions Workflow Status][ci-shield]
<br />
<div align="center">
<a href="https://github.com/MarioSieg/magnetron">
<img src="media/magnetron-logo.svg" alt="Logo" width="200" height="200">
</a>
<h3 align="center">magnetron</h3>
<p align="center">
Super minimalistic machine-learning framework.
<br />
<a href="https://github.com/MarioSieg/magnetron/tree/master/docs"><strong>Explore the docs ยป</strong></a>
<br />
<br />
<a href="https://github.com/MarioSieg/magnetron/blob/master/examples/gpt2/gpt2.py">View GPT-2 Example</a>
|
<a href="https://github.com/MarioSieg/magnetron/issues/new?labels=bug&template=bug-report---.md">Report Bug</a>
|
<a href="https://github.com/MarioSieg/magnetron/issues/new?labels=enhancement&template=feature-request---.md">Request Feature</a>
</p>
</div>
## ๐ About
Magnetron is a minimalistic, PyTorch-inspired machine-learning framework designed for IoT and other resource-limited environments.<br>
The tiny C core - wrapped in a modern Python API - gives you dynamic graphs, automatic differentiation and network building blocks without the bloat.<br>
A CUDA backend is also WIP.<br>
### Key features
* **PyTorch-close** Python API
- Seamless switch for PyTorch users with familiar syntax and behavior
* **Automatic differentiation** on dynamic computation graphs
- Supports flexible model construction and training workflows
* High-level **neural-net building blocks**
- Includes `nn.Module`, `Linear`, `Sequential`, and more out of the box
* **Highly optimized CPU kernels**
- Runtime CPU detection, multithreading, and SIMD acceleration (SSE, AVX2, AVX512, NEON)
* Multiple **datatypes**: **float32**, **float16**, **int32**, and **boolean**
- Flexibility for both training and quantized inference
* Custom **compressed tensor file formats**
- Fast serialization & model loading
* Clear **validation** and **error messages**
- Easier debugging and better developer experience
* No external **C or Python dependencies** (except **CFFI** for the Python wrapper)
- Lightweight and portable - great for embedded or restricted environments
## ๐ฆ Installation
Make sure you are inside a **Python virtual environment** before installing.
**With pip**
```bash
pip install magnetron
```
**With uv**
```bash
uv pip install magnetron
```
> โ ๏ธ Currently, prebuilt wheels are available for **macOS (Apple Silicon)** and **Linux x86-64**.
> On other platforms, the package must be built from source.
## ๐งช Examples
### GPT-2 inference
### Training a simple feedforward network
## ๐ค Contributing
Contributions are welcome!
Please open issues for ideas, or submit pull requests for new **features**.
PRs that only fix typos or minor formatting will not be accepted.
## ๐ License
(c) 2025 Mario Sieg. mario.sieg.64@gmail.com<br>
Distributed under the Apache 2 License.
See `LICENSE` for more information.
## ๐งฉ Similar Projects
* [GGML](https://github.com/ggerganov/ggml)
* [TINYGRAD](https://github.com/tinygrad/tinygrad)
* [MICROGRAD](https://github.com/karpathy/micrograd)
[contributors-shield]: https://img.shields.io/github/contributors/MarioSieg/magnetron.svg?style=for-the-badge
[contributors-url]: https://github.com/MarioSieg/magnetron/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/MarioSieg/magnetron.svg?style=for-the-badge
[forks-url]: https://github.com/MarioSieg/magnetron/network/members
[stars-shield]: https://img.shields.io/github/stars/MarioSieg/magnetron.svg?style=for-the-badge
[stars-url]: https://github.com/MarioSieg/magnetron/stargazers
[issues-shield]: https://img.shields.io/github/issues/MarioSieg/magnetron.svg?style=for-the-badge
[issues-url]: https://github.com/MarioSieg/magnetron/issues
[license-shield]: https://img.shields.io/github/license/MarioSieg/magnetron.svg?style=for-the-badge
[license-url]: https://github.com/MarioSieg/magnetron/blob/master/LICENSE.txt
[ci-shield]: https://img.shields.io/github/actions/workflow/status/MarioSieg/magnetron/cmake-python-multi-platform.yml?style=for-the-badge
Raw data
{
"_id": null,
"home_page": null,
"name": "magnetron",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "machine-learning, deep-learning, neural-networks, gpu, simd",
"author": null,
"author_email": "Mario Sieg <mario.sieg.64@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/a9/37/0580c2201b5c6068cde13ecf3162004bbd37a9fcc75e7cb035527e446302/magnetron-0.1.2.tar.gz",
"platform": null,
"description": "[![Stargazers][stars-shield]][stars-url]\n[![Forks][forks-shield]][forks-url]\n[![Issues][issues-shield]][issues-url]\n![GitHub Actions Workflow Status][ci-shield]\n\n<br />\n<div align=\"center\">\n <a href=\"https://github.com/MarioSieg/magnetron\">\n <img src=\"media/magnetron-logo.svg\" alt=\"Logo\" width=\"200\" height=\"200\">\n </a>\n\n<h3 align=\"center\">magnetron</h3>\n <p align=\"center\">\n Super minimalistic machine-learning framework.\n <br />\n <a href=\"https://github.com/MarioSieg/magnetron/tree/master/docs\"><strong>Explore the docs \u00bb</strong></a>\n <br />\n <br />\n <a href=\"https://github.com/MarioSieg/magnetron/blob/master/examples/gpt2/gpt2.py\">View GPT-2 Example</a>\n |\n <a href=\"https://github.com/MarioSieg/magnetron/issues/new?labels=bug&template=bug-report---.md\">Report Bug</a>\n |\n <a href=\"https://github.com/MarioSieg/magnetron/issues/new?labels=enhancement&template=feature-request---.md\">Request Feature</a>\n </p>\n</div>\n\n## \ud83d\udcd6 About\n\nMagnetron is a minimalistic, PyTorch-inspired machine-learning framework designed for IoT and other resource-limited environments.<br>\nThe tiny C core - wrapped in a modern Python API - gives you dynamic graphs, automatic differentiation and network building blocks without the bloat.<br>\nA CUDA backend is also WIP.<br>\n\n### Key features\n* **PyTorch-close** Python API \n - Seamless switch for PyTorch users with familiar syntax and behavior \n* **Automatic differentiation** on dynamic computation graphs \n - Supports flexible model construction and training workflows \n* High-level **neural-net building blocks** \n - Includes `nn.Module`, `Linear`, `Sequential`, and more out of the box\n* **Highly optimized CPU kernels**\n - Runtime CPU detection, multithreading, and SIMD acceleration (SSE, AVX2, AVX512, NEON)\n* Multiple **datatypes**: **float32**, **float16**, **int32**, and **boolean** \n - Flexibility for both training and quantized inference \n* Custom **compressed tensor file formats** \n - Fast serialization & model loading\n* Clear **validation** and **error messages** \n - Easier debugging and better developer experience\n* No external **C or Python dependencies** (except **CFFI** for the Python wrapper) \n - Lightweight and portable - great for embedded or restricted environments\n\n\n## \ud83d\udce6 Installation\n\nMake sure you are inside a **Python virtual environment** before installing.\n\n**With pip**\n```bash\npip install magnetron\n```\n\n**With uv**\n```bash\nuv pip install magnetron\n```\n> \u26a0\ufe0f Currently, prebuilt wheels are available for **macOS (Apple Silicon)** and **Linux x86-64**. \n> On other platforms, the package must be built from source.\n\n## \ud83e\uddea Examples\n\n### GPT-2 inference\n\n### Training a simple feedforward network\n\n## \ud83e\udd1d Contributing\nContributions are welcome! \nPlease open issues for ideas, or submit pull requests for new **features**. \nPRs that only fix typos or minor formatting will not be accepted.\n\n## \ud83d\udcdc License\n(c) 2025 Mario Sieg. mario.sieg.64@gmail.com<br>\nDistributed under the Apache 2 License.\nSee `LICENSE` for more information.\n\n## \ud83e\udde9 Similar Projects\n\n* [GGML](https://github.com/ggerganov/ggml)\n* [TINYGRAD](https://github.com/tinygrad/tinygrad)\n* [MICROGRAD](https://github.com/karpathy/micrograd)\n\n[contributors-shield]: https://img.shields.io/github/contributors/MarioSieg/magnetron.svg?style=for-the-badge\n[contributors-url]: https://github.com/MarioSieg/magnetron/graphs/contributors\n[forks-shield]: https://img.shields.io/github/forks/MarioSieg/magnetron.svg?style=for-the-badge\n[forks-url]: https://github.com/MarioSieg/magnetron/network/members\n[stars-shield]: https://img.shields.io/github/stars/MarioSieg/magnetron.svg?style=for-the-badge\n[stars-url]: https://github.com/MarioSieg/magnetron/stargazers\n[issues-shield]: https://img.shields.io/github/issues/MarioSieg/magnetron.svg?style=for-the-badge\n[issues-url]: https://github.com/MarioSieg/magnetron/issues\n[license-shield]: https://img.shields.io/github/license/MarioSieg/magnetron.svg?style=for-the-badge\n[license-url]: https://github.com/MarioSieg/magnetron/blob/master/LICENSE.txt\n[ci-shield]: https://img.shields.io/github/actions/workflow/status/MarioSieg/magnetron/cmake-python-multi-platform.yml?style=for-the-badge\n",
"bugtrack_url": null,
"license": "Copyright 2025 Mario Sieg Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ",
"summary": "High-performance, lightweight deep-learning library with a PyTorch like API and GPU support.",
"version": "0.1.2",
"project_urls": null,
"split_keywords": [
"machine-learning",
" deep-learning",
" neural-networks",
" gpu",
" simd"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1523b87768bae8ca59d6a7dfd446b46052b04d6d740b703de079086e458e7c76",
"md5": "bd55ba36f8ffe8f798bbab453c65769f",
"sha256": "1412b28d101489771ce010c8295cbf4c2edf3a2f6b0bf3d49ae614d280d4cebf"
},
"downloads": -1,
"filename": "magnetron-0.1.2-cp311-cp311-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "bd55ba36f8ffe8f798bbab453c65769f",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.10",
"size": 487869,
"upload_time": "2025-09-01T14:26:37",
"upload_time_iso_8601": "2025-09-01T14:26:37.582999Z",
"url": "https://files.pythonhosted.org/packages/15/23/b87768bae8ca59d6a7dfd446b46052b04d6d740b703de079086e458e7c76/magnetron-0.1.2-cp311-cp311-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "412660c63774bb6f6b6f99f7b3c83ca14f419b5fb02c793807720e1fbbaca5af",
"md5": "ba005d087a9f5431d683ebad9137ff4f",
"sha256": "01d1e6ed790eba0f4a1640b2838108e409a3835339e559a59e7122f3506d1e42"
},
"downloads": -1,
"filename": "magnetron-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "ba005d087a9f5431d683ebad9137ff4f",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.10",
"size": 834817,
"upload_time": "2025-09-01T14:26:39",
"upload_time_iso_8601": "2025-09-01T14:26:39.116184Z",
"url": "https://files.pythonhosted.org/packages/41/26/60c63774bb6f6b6f99f7b3c83ca14f419b5fb02c793807720e1fbbaca5af/magnetron-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d542b2352dde63a8d2f0dc6b89af418d67f5eaa8dd98188d6093c7794bf9cb03",
"md5": "7889bded9d286ef0b5011589a3f727dd",
"sha256": "d99d9f3b33aea14fa9d862d045eca7fcb9b271864d171315aa01acbbf8ad9c2b"
},
"downloads": -1,
"filename": "magnetron-0.1.2-cp312-cp312-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "7889bded9d286ef0b5011589a3f727dd",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.10",
"size": 487877,
"upload_time": "2025-09-01T14:26:40",
"upload_time_iso_8601": "2025-09-01T14:26:40.577270Z",
"url": "https://files.pythonhosted.org/packages/d5/42/b2352dde63a8d2f0dc6b89af418d67f5eaa8dd98188d6093c7794bf9cb03/magnetron-0.1.2-cp312-cp312-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "26ba6950ee0972eb05c65ce6d46186ca8dc618f0190a63843985c1a548f6255b",
"md5": "fedd510fd9ba6b28dc2ba6a3c543feae",
"sha256": "aeddaaaf3a1268b4bd59b800c6d00ac38d125a7ce3cc0af6aa1bf38d21e59c5e"
},
"downloads": -1,
"filename": "magnetron-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "fedd510fd9ba6b28dc2ba6a3c543feae",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.10",
"size": 834831,
"upload_time": "2025-09-01T14:26:42",
"upload_time_iso_8601": "2025-09-01T14:26:42.070580Z",
"url": "https://files.pythonhosted.org/packages/26/ba/6950ee0972eb05c65ce6d46186ca8dc618f0190a63843985c1a548f6255b/magnetron-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a9c835b4de6b3c61fd645b20ca33feb9ce4e0f4fe65f4610bd67b1db9d6aa9f5",
"md5": "de626d2f0f6ef414d70b4c399b863e1e",
"sha256": "ce185c78e723dd4f0cbe712451a0c1298813a10f55fb7a428727ada94b72ba63"
},
"downloads": -1,
"filename": "magnetron-0.1.2-cp313-cp313-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "de626d2f0f6ef414d70b4c399b863e1e",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": ">=3.10",
"size": 487873,
"upload_time": "2025-09-01T14:26:43",
"upload_time_iso_8601": "2025-09-01T14:26:43.133663Z",
"url": "https://files.pythonhosted.org/packages/a9/c8/35b4de6b3c61fd645b20ca33feb9ce4e0f4fe65f4610bd67b1db9d6aa9f5/magnetron-0.1.2-cp313-cp313-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d0a1b628f3c33e627b0bcc3efe5d8dca39ac9bc4c5de9632d72bdf32a1dc2fb1",
"md5": "3841591773dfe422f4b18e2fb0f23e21",
"sha256": "8fad29c21371e2883fa156de9d770b0d7a82193c3d155423d030a4e86a318819"
},
"downloads": -1,
"filename": "magnetron-0.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "3841591773dfe422f4b18e2fb0f23e21",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": ">=3.10",
"size": 834819,
"upload_time": "2025-09-01T14:26:44",
"upload_time_iso_8601": "2025-09-01T14:26:44.776535Z",
"url": "https://files.pythonhosted.org/packages/d0/a1/b628f3c33e627b0bcc3efe5d8dca39ac9bc4c5de9632d72bdf32a1dc2fb1/magnetron-0.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a9370580c2201b5c6068cde13ecf3162004bbd37a9fcc75e7cb035527e446302",
"md5": "c9688afb42238f6dcab87f26ce3c9a9a",
"sha256": "2defd9772631d8f0134479cfa4d46b0ad999703c9dfc6d621126164d316b9feb"
},
"downloads": -1,
"filename": "magnetron-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "c9688afb42238f6dcab87f26ce3c9a9a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 6379411,
"upload_time": "2025-09-01T14:26:46",
"upload_time_iso_8601": "2025-09-01T14:26:46.580422Z",
"url": "https://files.pythonhosted.org/packages/a9/37/0580c2201b5c6068cde13ecf3162004bbd37a9fcc75e7cb035527e446302/magnetron-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-01 14:26:46",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "magnetron"
}