{"id":19329751,"url":"https://github.com/outerbounds/metaflow-trainium","last_synced_at":"2025-04-12T18:24:40.104Z","repository":{"id":221220710,"uuid":"747394896","full_name":"outerbounds/metaflow-trainium","owner":"outerbounds","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-11T13:57:00.000Z","size":1260,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-26T12:46:37.646Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/outerbounds.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-01-23T20:56:21.000Z","updated_at":"2024-10-30T17:12:35.000Z","dependencies_parsed_at":"2024-02-06T20:32:44.781Z","dependency_job_id":"6e5b7da6-64bd-43bd-9e11-ef57fcee0d67","html_url":"https://github.com/outerbounds/metaflow-trainium","commit_stats":null,"previous_names":["outerbounds/metaflow-trainium"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outerbounds%2Fmetaflow-trainium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outerbounds%2Fmetaflow-trainium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outerbounds%2Fmetaflow-trainium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outerbounds%2Fmetaflow-trainium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/outerbounds","download_url":"https://codeload.github.com/outerbounds/metaflow-trainium/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248611394,"owners_count":21133103,"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":[],"created_at":"2024-11-10T02:29:45.398Z","updated_at":"2025-04-12T18:24:39.876Z","avatar_url":"https://github.com/outerbounds.png","language":"Python","funding_links":[],"categories":["Examples \u0026 Tutorials"],"sub_categories":[],"readme":"# Metaflow-Trainium Examples\n\u003c!-- \u003ca href=\"...\"\u003e --\u003e\n\u003cimg style=\"display: block; float: left; max-width: 20%; height: auto; margin: auto; float: none!important;\" src=\"static/cover.jpg\"/\u003e\n\u003c!-- \u003c/a\u003e --\u003e\n\nThis repository contains examples that demonstrate how to use [Metaflow](https://metaflow.org/) to define and run machine learning training jobs with [AWS Trainium](https://aws.amazon.com/machine-learning/trainium/). The training jobs are executed as batch jobs running on AWS EC2 trn1 instances in [AWS Batch](https://aws.amazon.com/batch/).\n\nTo run these examples, you first need to provision AWS resources for Metaflow and AWS Batch. Please refer to the [installation guide](./install_metaflow_and_batch.md) for instructions on how to deploy the required resources using CloudFormation and finalize your Metaflow setup.\n\n## Step 1: Deploy infrastructure\nhttps://github.com/outerbounds/metaflow-trainium/assets/40632488/850e474e-098c-44eb-81bb-d3a379eb1fab\n\n## Step 2: Configure Metaflow\nhttps://github.com/outerbounds/metaflow-trainium/assets/40632488/c89f8600-1038-4353-978a-2a347c3a2c49\n\n## Step 3: Run experiments\nOnce the required resources have been created and configured, please try to run the included [allreduce example](./allreduce-trn) as a basic test of the Metaflow/Trainium/Batch setup. When the allreduce example is successfully running, you can then proceed to the more realistic workflows such as [Llama2-7b pretraining](./llama2-7b-pretrain-trn).\n\nAWS Trainium is currently supported in us-east-1, us-east-2, and us-west-2. Please make sure that you are working in one of these supported regions.\n\n## Example registry\n\nWe have included the following examples, and are happy to take requests to expand the list. Note that some sub-directories for Trainium have counterpart implementations for running comparisons on GPUs. This is not intended to be a benchmarking repository, but running a comparison against GPUs you have access to is useful for understanding general performance characteristics relative to other hardware architectures.\n\n### [Llama2 pre-training](./llama2-7b-pretrain-trn/)\nPre-train Llama2 using ≥4 nodes with `trn.32xlarge` instances. \n\n### [Llama2 fine-tuning on Trainium](./llama2-7b-finetune-trn/)\nFine-tune Llama2 on a single `trn.32xlarge` instance using the [`optimum-neuron`](https://huggingface.co/docs/optimum-neuron/en/index) library from Huggingface. \n\nFor a minimal code change GPU implementation, see [here](./llama2-7b-finetune-gpu-single-node/). \nNote: We found A100 GPUs to have the most comparable characteristics, but it is far from an apples-to-apples comparison.\n\n### [BERT fine-tuning on Trainium](./bert-finetune-trn/)\nFine-tune BERT on a single `trn.2xlarge` instance using the `optimum-neuron` library from Huggingface. \n\nFor a minimal code change GPU implementation, see [here](./bert-finetune-gpu/). \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fouterbounds%2Fmetaflow-trainium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fouterbounds%2Fmetaflow-trainium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fouterbounds%2Fmetaflow-trainium/lists"}