{"id":22066369,"url":"https://github.com/jaketae/realformer","last_synced_at":"2025-10-28T00:34:16.853Z","repository":{"id":100151094,"uuid":"366396265","full_name":"jaketae/realformer","owner":"jaketae","description":"PyTorch implementation of RealFormer: Transformer Likes Residual Attention","archived":false,"fork":false,"pushed_at":"2021-05-17T10:59:41.000Z","size":8,"stargazers_count":11,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-30T11:05:37.631Z","etag":null,"topics":["natural-language-processing","pytorch","transformer","transformer-encoder"],"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/jaketae.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":"2021-05-11T13:44:02.000Z","updated_at":"2024-07-22T03:55:17.000Z","dependencies_parsed_at":"2023-04-07T20:46:39.547Z","dependency_job_id":null,"html_url":"https://github.com/jaketae/realformer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jaketae/realformer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaketae%2Frealformer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaketae%2Frealformer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaketae%2Frealformer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaketae%2Frealformer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaketae","download_url":"https://codeload.github.com/jaketae/realformer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaketae%2Frealformer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281366887,"owners_count":26488695,"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","status":"online","status_checked_at":"2025-10-27T02:00:05.855Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["natural-language-processing","pytorch","transformer","transformer-encoder"],"created_at":"2024-11-30T19:27:54.330Z","updated_at":"2025-10-28T00:34:16.811Z","avatar_url":"https://github.com/jaketae.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RealFormer\n\nPyTorch implementation of [RealFormer: Transformer Likes Residual Attention](https://arxiv.org/abs/2012.11747).\n\n## Quickstart\n\nClone this repository.\n\n```\ngit clone https://github.com/jaketae/realformer.git\n```\n\nNavigate to the cloned directory. You can start using the model via\n\n```python\n\u003e\u003e\u003e from realformer import RealFormerEncoder\n\u003e\u003e\u003e model = RealFormerEncoder()\n```\n\nBy default, the model comes with the following parameters:\n\n```python\nRealFormerEncoder(\n    d_model=512,\n    num_heads=8,\n    expansion_factor=2,\n    dropout=0.5,\n    max_len=512,\n    num_layers=6,\n)\n```\n\n## Summary\n\nResidual Attention Layer Transformer, shortened as RealFormer, is a transformer variant that incorporatess residual skip connections to allow previous attention scores to pass through the entire network. It outperforms canonical transformers on a variety of tasks and datasets, including masked language modeling (MLM), [GLUE](https://gluebenchmark.com), and [SQuAD](https://rajpurkar.github.io/SQuAD-explorer/).\n\n## Implementation Notes\n\n-   Just like `torch.nn.TransformerEncoder`, the `RealFormerEncoder` does not include any embedding layers. It is recommended that you implemenet positional encoding schemes (e.g. sinusodial tables, learnable embeddings) as needed.\n-   The authors mention that RealFormer layers can be used as drop-in replacements for any transformer model, whether they be autoencoding (encoders) or auto-regressive (decoders). We closely follow the flow of the paper and include only an encoder version of the implementation for now.\n\n## Resources\n\n-   [Original Paper](https://arxiv.org/abs/2012.11747)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaketae%2Frealformer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaketae%2Frealformer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaketae%2Frealformer/lists"}