{"id":19156155,"url":"https://github.com/kyegomez/mm1","last_synced_at":"2025-04-15T11:13:35.884Z","repository":{"id":228495534,"uuid":"774147760","full_name":"kyegomez/MM1","owner":"kyegomez","description":"PyTorch Implementation of the paper \"MM1: Methods, Analysis \u0026 Insights from Multimodal LLM Pre-training\"","archived":false,"fork":false,"pushed_at":"2025-04-12T12:53:01.000Z","size":2279,"stargazers_count":23,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-15T11:13:20.169Z","etag":null,"topics":["ai","artificial-intelligence","deep-learning","gpt4","machine-learning","ml","mm1","multi-modal","multi-modal-revolution","multi-modality"],"latest_commit_sha":null,"homepage":"https://discord.gg/7VckQVxvKk","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/kyegomez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["kyegomez"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2024-03-19T02:51:44.000Z","updated_at":"2024-11-03T14:07:27.000Z","dependencies_parsed_at":"2024-03-29T22:31:00.184Z","dependency_job_id":null,"html_url":"https://github.com/kyegomez/MM1","commit_stats":null,"previous_names":["kyegomez/mm1"],"tags_count":0,"template":false,"template_full_name":"kyegomez/Python-Package-Template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyegomez%2FMM1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyegomez%2FMM1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyegomez%2FMM1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyegomez%2FMM1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kyegomez","download_url":"https://codeload.github.com/kyegomez/MM1/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249058384,"owners_count":21205911,"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":["ai","artificial-intelligence","deep-learning","gpt4","machine-learning","ml","mm1","multi-modal","multi-modal-revolution","multi-modality"],"created_at":"2024-11-09T08:33:25.935Z","updated_at":"2025-04-15T11:13:35.861Z","avatar_url":"https://github.com/kyegomez.png","language":"Python","funding_links":["https://github.com/sponsors/kyegomez"],"categories":[],"sub_categories":[],"readme":"[![Multi-Modality](agorabanner.png)](https://discord.gg/qUtxnK2NMf)\n\n# MM1 \nPyTorch Implementation of the paper \"MM1: Methods, Analysis \u0026 Insights from Multimodal LLM Pre-training\".\n\n`img -\u003e encoder -\u003e connector -\u003e llm -\u003e tokens` \n\n## install\n`pip3 install mm1-torch`\n\n## usage\n```python\nimport torch\nfrom mm1_torch.main import MM1\n\n# Tensors\nx = torch.randint(0, 100, (1, 512))  # Create a random tensor of shape (1, 512)\nimg = torch.randn(1, 3, 224, 224)  # Create a random image tensor of shape (1, 3, 224, 224)\n\n# Create a model\nmodel = MM1(\n    dim=512,  # Dimension of the input tensor\n    depth=12,  # Number of transformer layers\n    heads=8,  # Number of attention heads\n    dim_head=64,  # Dimension of each attention head\n    dropout=0.1,  # Dropout rate\n    num_experts=4,  # Number of experts in mixture-of-experts\n    num_experts_per_tok=2,  # Number of experts per token in mixture-of-experts\n    encoder_dim=512,  # Dimension of the encoder output\n    encoder_depth=12,  # Number of encoder transformer layers\n    encoder_heads=8,  # Number of encoder attention heads\n    use_moe=True,  # Whether to use mixture-of-experts\n    return_logits=True  # Whether to return logits or probabilities\n)\n\n# Forward\nout = model(x, img)  # Forward pass through the model\nprint(out.shape)  # Print the shape of the output tensor (torch.Size([2, 3, 512]))\nprint(out)  # Print the output tensor\n```\n\n### `CAbstractor`\n\n```python\nimport torch\nfrom mm1_torch.main import CAbstractor\n\n# Tensors\nx = torch.randn(1, 100, 512)\n\n# Create a model\nmodel = CAbstractor(\n    dim=512,\n    depth=12,\n    heads=8,\n)\n\n\n# Forward\nout = model(x)\nprint(out.shape)\n\n```\n\n\n# License\nMIT\n\n\n## Todo\n\n- [x] Implement the deformable attention\n- [ ] Create a training script for Huggingface datasets\n- [ ] Create unit tests for every module","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyegomez%2Fmm1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkyegomez%2Fmm1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyegomez%2Fmm1/lists"}