{"id":18344374,"url":"https://github.com/veb-101/attention-and-transformers","last_synced_at":"2026-03-01T18:32:10.605Z","repository":{"id":63434933,"uuid":"535070713","full_name":"veb-101/Attention-and-Transformers","owner":"veb-101","description":"Transformers goes brrr... Attention and  Transformers from scratch in TensorFlow.  Currently contains Vision transformers, MobileViT-v1, MobileViT-v2, MobileViT-v3","archived":false,"fork":false,"pushed_at":"2025-04-02T11:56:21.000Z","size":256,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T12:36:47.472Z","etag":null,"topics":["attention-mechanism","mobile","mobilevit","mobilevitv1","mobilevitv2","mobilevitv3","tensorflow","tensorflow2","transformer","vision-transformer"],"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/veb-101.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":"2022-09-10T17:31:49.000Z","updated_at":"2025-04-02T11:56:25.000Z","dependencies_parsed_at":"2025-04-02T12:39:55.084Z","dependency_job_id":null,"html_url":"https://github.com/veb-101/Attention-and-Transformers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veb-101%2FAttention-and-Transformers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veb-101%2FAttention-and-Transformers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veb-101%2FAttention-and-Transformers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veb-101%2FAttention-and-Transformers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/veb-101","download_url":"https://codeload.github.com/veb-101/Attention-and-Transformers/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247450716,"owners_count":20940938,"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":["attention-mechanism","mobile","mobilevit","mobilevitv1","mobilevitv2","mobilevitv3","tensorflow","tensorflow2","transformer","vision-transformer"],"created_at":"2024-11-05T21:05:49.015Z","updated_at":"2026-03-01T18:32:10.542Z","avatar_url":"https://github.com/veb-101.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Attention mechanisms and Transformers\n\n### Updates: I'm moving the codebase to a [new repository](https://github.com/veb-101/keras-vision) and rewriting it using the latest Keras 3.x version for multi-backend support. It will also include the pretrained model weights in Keras format.\n\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/Attention-and-Transformers)](https://www.python.org/) [![TensorFlow](https://img.shields.io/badge/Tensorflow-2.10%20%7C%202.11-orange?logo=tensorflow)](https://github.com/tensorflow/tensorflow/releases/) [![PyPI version](https://badge.fury.io/py/Attention-and-Transformers.svg)](https://badge.fury.io/py/Attention-and-Transformers) [![TensorFlow](https://img.shields.io/badge/TensorFlow-%23FF6F00.svg?style=for-the-badge\u0026logo=TensorFlow\u0026logoColor=white)](https://www.tensorflow.org/)\n\n* This goal of this repository is to host basic architecture and model traning code associated with the different attention mechanisms and transformer architecture.\n* At the moment, I more interested in learning and recreating these new architectures from scratch than full-fledged training. For now, I'll just be training these models on small datasets.\n\n\n#### Installation\n\n* Using pip to install from [pypi](https://pypi.org/project/Attention-and-Transformers/)\n\n```bash\npip install Attention-and-Transformers\n```\n\n* Using pip to install latest version from github\n\n```bash\npip install git+https://github.com/veb-101/Attention-and-Transformers.git\n```\n\n* Local clone and install\n\n```bash\ngit clone https://github.com/veb-101/Attention-and-Transformers.git atf\ncd atf\npython setup.py install\n```\n\n**Example Use**\n\n```bash\npython load_test.py\n```\n\n**Attention Mechanisms**\n\n\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth style=\"text-align:center\"\u003e\n\u003cstrong\u003e# No.\u003c/strong\u003e\n\u003c/th\u003e\n\u003cth style=\"text-align:center\"\u003e\n\u003cstrong\u003eMechanism\u003c/strong\u003e\n\u003c/th\u003e\n\u003cth style=\"text-align:center\"\u003e\n\u003cstrong\u003ePaper\u003c/strong\u003e\n\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\n\u003ctr\u003e\n\u003ctd style=\"text-align:center\"\u003e1\u003c/td\u003e\n\u003ctd style=\"text-align:center\"\u003e\n\u003ca href=\"https://github.com/veb-101/Attention-and-Transformers/blob/main/Attention_and_Transformers/ViT/multihead_self_attention.py\"\u003eMulti-head Self Attention\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd style=\"text-align:center\"\u003e\n\u003ca href=\"https://arxiv.org/abs/1706.03762\"\u003eAttention is all you need\u003c/a\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd style=\"text-align:center\"\u003e2\u003c/td\u003e\n\u003ctd style=\"text-align:center\"\u003e\n\u003ca href=\"https://github.com/veb-101/Attention-and-Transformers/blob/main/Attention_and_Transformers/MobileViT_v1/multihead_self_attention_2D.py\"\u003eMulti-head Self Attention 2D\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd style=\"text-align:center\"\u003e\n\u003ca href=\"https://arxiv.org/abs/2110.02178\"\u003eMobileViT V1\u003c/a\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd style=\"text-align:center\"\u003e2\u003c/td\u003e\n\u003ctd style=\"text-align:center\"\u003e\n\u003ca href=\"https://github.com/veb-101/Attention-and-Transformers/blob/main/Attention_and_Transformers/MobileViT_v2/linear_attention.py\"\u003eSeparable Self Attention\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd style=\"text-align:center\"\u003e\n\u003ca href=\"https://arxiv.org/abs/2206.02680\"\u003eMobileViT V2\u003c/a\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n**Transformer Models**\n\n\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth style=\"text-align:center\"\u003e\n\u003cstrong\u003e# No.\u003c/strong\u003e\n\u003c/th\u003e\n\u003cth style=\"text-align:center\"\u003e\n\u003cstrong\u003eModels\u003c/strong\u003e\n\u003c/th\u003e\n\u003cth style=\"text-align:center\"\u003e\n\u003cstrong\u003ePaper\u003c/strong\u003e\n\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd style=\"text-align:center\"\u003e1\u003c/td\u003e\n\u003ctd style=\"text-align:center\"\u003e\n\u003ca href=\"https://github.com/veb-101/Attention-and-Transformers/blob/main/Attention_and_Transformers/ViT/vision_transformer.py\"\u003eVision Transformer\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd style=\"text-align:center\"\u003e\n\u003ca href=\"https://arxiv.org/abs/2010.11929\"\u003eAn Image is Worth 16x16 Words:\u003c/a\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd style=\"text-align:center\"\u003e2\u003c/td\u003e\n\u003ctd style=\"text-align:center\"\u003e\n\u003ca href=\"https://github.com/veb-101/Attention-and-Transformers/blob/main/Attention_and_Transformers/MobileViT_v1/mobile_vit_v1.py\"\u003eMobileViT-V1\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd style=\"text-align:center\"\u003e\n\u003ca href=\"https://arxiv.org/abs/2110.02178\"\u003eMobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer\u003c/a\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd style=\"text-align:center\"\u003e3\u003c/td\u003e\n\u003ctd style=\"text-align:center\"\u003e\u003ca href=\"https://github.com/veb-101/Attention-and-Transformers/blob/main/Attention_and_Transformers/MobileViT_v2/mobile_vit_v2.py\"\u003eMobileViT-V2\u003c/a\u003e\u003c/td\u003e\n\u003ctd style=\"text-align:center\"\u003e\n\u003ca href=\"https://arxiv.org/abs/2206.02680\"\u003eSeparable Self-attention for Mobile Vision Transformers\u003c/a\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd style=\"text-align:center\"\u003e2\u003c/td\u003e\n\u003ctd style=\"text-align:center\"\u003e\n\u003ca href=\"https://github.com/veb-101/Attention-and-Transformers/blob/main/Attention_and_Transformers/MobileViT_v3/mobile_vit_v3.py\"\u003eMobileViT-V3\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd style=\"text-align:center\"\u003e\n\u003ca href=\"https://arxiv.org/abs/2209.15159\"\u003eMobileViTv3: Mobile-Friendly Vision Transformer\u003c/a\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveb-101%2Fattention-and-transformers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fveb-101%2Fattention-and-transformers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveb-101%2Fattention-and-transformers/lists"}