{"id":15600954,"url":"https://github.com/lucidrains/zorro-pytorch","last_synced_at":"2025-10-16T17:01:39.244Z","repository":{"id":78754832,"uuid":"593694752","full_name":"lucidrains/zorro-pytorch","owner":"lucidrains","description":"Implementation of Zorro, Masked Multimodal Transformer, in Pytorch","archived":false,"fork":false,"pushed_at":"2023-10-20T01:42:08.000Z","size":202,"stargazers_count":94,"open_issues_count":1,"forks_count":6,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-12-15T18:08:20.074Z","etag":null,"topics":["artificial-intelligence","attention-mechanisms","deep-learning","masking","multimodal","transformers"],"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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-26T16:27:01.000Z","updated_at":"2024-12-10T20:27:48.000Z","dependencies_parsed_at":"2024-10-22T20:10:06.601Z","dependency_job_id":null,"html_url":"https://github.com/lucidrains/zorro-pytorch","commit_stats":{"total_commits":12,"total_committers":2,"mean_commits":6.0,"dds":"0.16666666666666663","last_synced_commit":"fb1127c987ee837d376a4df94dc9cf55baae86c2"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fzorro-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fzorro-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fzorro-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2Fzorro-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucidrains","download_url":"https://codeload.github.com/lucidrains/zorro-pytorch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230423559,"owners_count":18223435,"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-mechanisms","deep-learning","masking","multimodal","transformers"],"created_at":"2024-10-03T02:10:15.482Z","updated_at":"2025-10-16T17:01:39.127Z","avatar_url":"https://github.com/lucidrains.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"./zorro.png\" width=\"450px\"\u003e\u003c/img\u003e\n\n## Zorro - Pytorch\n\nImplementation of \u003ca href=\"https://arxiv.org/abs/2301.09595\"\u003eZorro\u003c/a\u003e, Masked Multimodal Transformer, in Pytorch. This is a Deepmind work that claims a special masking strategy within a transformer help them achieve SOTA on a few multimodal benchmarks.\n\n## Appreciation\n\n- \u003ca href=\"https://stability.ai/\"\u003eStability.ai\u003c/a\u003e for the generous sponsorship to work and open source cutting edge artificial intelligence research\n\n## Install\n\n```bash\n$ pip install zorro-pytorch\n```\n\n## Usage\n\n```python\nimport torch\nfrom zorro_pytorch import Zorro, TokenTypes as T\n\nmodel = Zorro(\n    dim = 512,                        # model dimensions\n    depth = 6,                        # depth\n    dim_head = 64,                    # attention dimension heads\n    heads = 8,                        # attention heads\n    ff_mult = 4,                      # feedforward multiple\n    num_fusion_tokens = 16,           # number of fusion tokens\n    audio_patch_size = 16,            # audio patch size, can also be Tuple[int, int]\n    video_patch_size = 16,            # video patch size, can also be Tuple[int, int]\n    video_temporal_patch_size = 2,    # video temporal patch size\n    video_channels = 3,               # video channels\n    return_token_types = (\n        T.AUDIO,\n        T.AUDIO,\n        T.FUSION,\n        T.GLOBAL,\n        T.VIDEO,\n        T.VIDEO,\n        T.VIDEO,\n    ) # say you want to return 2 tokens for audio, 1 token for fusion, 3 for video - for whatever self-supervised learning, supervised learning, etc etc\n)\n\nvideo = torch.randn(2, 3, 8, 32, 32) # (batch, channels, time, height, width)\naudio = torch.randn(2, 1024 * 10)    # (batch, time)\n\nreturn_tokens = model(audio = audio, video = video) # (2, 6, 512) - all 6 tokes as indicated above is returned\n\n# say you only want 1 audio and 1 video token, for contrastive learning\n\naudio_token, video_token = model(audio = audio, video = video, return_token_indices = (0, 3)).unbind(dim = -2) # (2, 512), (2, 512)\n\n```\n\n## Citations\n\n```bibtex\n@inproceedings{Recasens2023ZorroTM,\n  title  = {Zorro: the masked multimodal transformer},\n  author = {Adri{\\`a} Recasens and Jason Lin and Jo{\\~a}o Carreira and Drew Jaegle and Luyu Wang and Jean-Baptiste Alayrac and Pauline Luc and Antoine Miech and Lucas Smaira and Ross Hemsley and Andrew Zisserman},\n  year   = {2023}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Fzorro-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucidrains%2Fzorro-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Fzorro-pytorch/lists"}