{"id":13738089,"url":"https://github.com/lucidrains/halonet-pytorch","last_synced_at":"2025-04-09T15:04:20.974Z","repository":{"id":44469349,"uuid":"351173570","full_name":"lucidrains/halonet-pytorch","owner":"lucidrains","description":"Implementation of the 😇 Attention layer from the paper, Scaling Local Self-Attention For Parameter Efficient Visual Backbones","archived":false,"fork":false,"pushed_at":"2021-03-24T23:51:16.000Z","size":75,"stargazers_count":198,"open_issues_count":4,"forks_count":21,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-09T15:03:16.879Z","etag":null,"topics":["artificial-intelligence","attention-mechanism","deep-learning","vision"],"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/lucidrains.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}},"created_at":"2021-03-24T17:50:25.000Z","updated_at":"2024-12-09T02:28:11.000Z","dependencies_parsed_at":"2022-07-16T16:17:01.595Z","dependency_job_id":null,"html_url":"https://github.com/lucidrains/halonet-pytorch","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fhalonet-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fhalonet-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fhalonet-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fhalonet-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucidrains","download_url":"https://codeload.github.com/lucidrains/halonet-pytorch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055276,"owners_count":21040156,"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":["artificial-intelligence","attention-mechanism","deep-learning","vision"],"created_at":"2024-08-03T03:02:10.881Z","updated_at":"2025-04-09T15:04:20.939Z","avatar_url":"https://github.com/lucidrains.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\u003cimg src=\"./halonet.png\" width=\"500px\"\u003e\u003c/img\u003e\n\n## HaloNet - Pytorch\n\nImplementation of the Attention layer from the paper, \u003ca href=\"https://arxiv.org/abs/2103.12731\"\u003eScaling Local Self-Attention For Parameter Efficient Visual Backbones\u003c/a\u003e. This repository will only house the attention layer and not much more.\n\n\n## Install\n\n```bash\n$ pip install halonet-pytorch\n```\n\n## Usage\n\n```python\nimport torch\nfrom halonet_pytorch import HaloAttention\n\nattn = HaloAttention(\n    dim = 512,         # dimension of feature map\n    block_size = 8,    # neighborhood block size (feature map must be divisible by this)\n    halo_size = 4,     # halo size (block receptive field)\n    dim_head = 64,     # dimension of each head\n    heads = 4          # number of attention heads\n).cuda()\n\nfmap = torch.randn(1, 512, 32, 32).cuda()\nattn(fmap) # (1, 512, 32, 32)\n```\n\n## Citations\n\n```bibtex\n@misc{vaswani2021scaling,\n    title   = {Scaling Local Self-Attention For Parameter Efficient Visual Backbones}, \n    author  = {Ashish Vaswani and Prajit Ramachandran and Aravind Srinivas and Niki Parmar and Blake Hechtman and Jonathon Shlens},\n    year    = {2021},\n    eprint  = {2103.12731},\n    archivePrefix = {arXiv},\n    primaryClass = {cs.CV}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Fhalonet-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucidrains%2Fhalonet-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Fhalonet-pytorch/lists"}