{"id":13594283,"url":"https://github.com/harvardnlp/annotated-transformer","last_synced_at":"2025-05-14T08:07:35.037Z","repository":{"id":37444334,"uuid":"126207992","full_name":"harvardnlp/annotated-transformer","owner":"harvardnlp","description":"An annotated implementation of the Transformer paper.","archived":false,"fork":false,"pushed_at":"2024-04-07T09:58:46.000Z","size":18618,"stargazers_count":6151,"open_issues_count":32,"forks_count":1307,"subscribers_count":66,"default_branch":"master","last_synced_at":"2025-04-11T02:51:58.581Z","etag":null,"topics":["annotated","notebook","python"],"latest_commit_sha":null,"homepage":"http://nlp.seas.harvard.edu/annotated-transformer","language":"Jupyter Notebook","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/harvardnlp.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":"2018-03-21T16:23:15.000Z","updated_at":"2025-04-11T02:16:13.000Z","dependencies_parsed_at":"2024-11-20T07:06:40.128Z","dependency_job_id":"b4447133-81fd-4764-a796-040cb0556d69","html_url":"https://github.com/harvardnlp/annotated-transformer","commit_stats":{"total_commits":170,"total_committers":9,"mean_commits":18.88888888888889,"dds":0.6529411764705882,"last_synced_commit":"debc9fd747bb2123160a98046ad1c2d4da44a567"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harvardnlp%2Fannotated-transformer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harvardnlp%2Fannotated-transformer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harvardnlp%2Fannotated-transformer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harvardnlp%2Fannotated-transformer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harvardnlp","download_url":"https://codeload.github.com/harvardnlp/annotated-transformer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254101557,"owners_count":22014908,"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":["annotated","notebook","python"],"created_at":"2024-08-01T16:01:31.246Z","updated_at":"2025-05-14T08:07:30.028Z","avatar_url":"https://github.com/harvardnlp.png","language":"Jupyter Notebook","readme":"Code for The Annotated Transformer blog post:\n\nhttp://nlp.seas.harvard.edu/annotated-transformer/\n\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/harvardnlp/annotated-transformer/blob/master/AnnotatedTransformer.ipynb)\n\n![image](https://user-images.githubusercontent.com/35882/166251887-9da909a9-660b-45a9-ae72-0aae89fb38d4.png)\n\n\n\n\n# Package Dependencies\n\nUse `requirements.txt` to install library dependencies with pip:\n\n```\npip install -r requirements.txt\n```\n\n\n# Notebook Setup\n\nThe Annotated Transformer is created using [jupytext](https://github.com/mwouts/jupytext).\n\nRegular notebooks pose problems for source control - cell outputs end up in the repo history and diffs between commits are difficult to examine. Using jupytext, there is a python script (`.py` file) that is automatically kept in sync with the notebook file by the jupytext plugin.\n\nThe python script is committed contains all the cell content and can be used to generate the notebook file. The python script is a regular python source file, markdown sections are included using a standard comment convention, and outputs are not saved. The notebook itself is treated as a build artifact and is not commited to the git repository.\n\nPrior to using this repo, make sure jupytext is installed by following the [installation instructions here](https://github.com/mwouts/jupytext/blob/main/docs/install.md).\n\nTo produce the `.ipynb` notebook file using the markdown source, run (under the hood, the `notebook` build target simply runs `jupytext --to ipynb the_annotated_transformer.py`):\n\n```\nmake notebook\n```\n\nTo produce the html version of the notebook, run:\n\n```\nmake html\n```\n\n`make html` is just a shortcut for for generating the notebook with `jupytext --to ipynb the_annotated_transformer.py` followed by using the jupyter nbconvert command to produce html using `jupyter nbconvert --to html the_annotated_transformer.ipynb`                             \n \n\n# Formatting and Linting\n\nTo keep the code formatting clean, the annotated transformer git repo has a git action to check that the code conforms to [PEP8 coding standards](https://www.python.org/dev/peps/pep-0008/).\n\nTo make this easier, there are two `Makefile` build targets to run automatic code formatting with black and flake8.\n\nBe sure to [install black](https://github.com/psf/black#installation) and [flake8](https://flake8.pycqa.org/en/latest/).\n\nYou can then run:\n\n```\nmake black\n```\n\n(or alternatively manually call black `black --line-length 79 the_annotated_transformer.py`) to format code automatically using black and:\n\n```\nmake flake\n```\n\n(or manually call flake8 `flake8 --show-source the_annotated_transformer.py) to check for PEP8 violations.\n\nIt's recommended to run these two commands and fix any flake8 errors that arise, when submitting a PR, otherwise the github actions CI will report an error.\n","funding_links":[],"categories":["Jupyter Notebook","Implementations","python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharvardnlp%2Fannotated-transformer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharvardnlp%2Fannotated-transformer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharvardnlp%2Fannotated-transformer/lists"}