AXLearn
AXLearn is a deep learning design framework, built on top of JAX and XLA, to support the development of large-scale models.
Hardware and Software Specifications
The functionality have been validated on AWS p5.48xlarge EKS cluster (8x H100 80G).
Containers
We provide a multi-architecture container that is regularly updated. Use these containers to avoid dependency and environment issues.
- Latest container: ghcr.io/nvidia/jax:axlearn
- Nightly dated container: ghcr.io/nvidia/jax:axlearn-YYYY-MM-DD
When you start an interactive session:
- Navigate to
/opt/axlearninside the container. - Place your persistent files in a mounted directory (e.g.
/opt/axlearn/workspace).
Launching a container
Use the following command to launch a container:
where WORKSPACE_PATH is the path to the directory where you would like to store any persistent files and container is the name of the AXLearn container. You can additionally add dataset and vocab paths with the -v flag.
Example 1: standard training for a Fuji model on EKS
AXLearn based models are called fuji. The fuji models come with several number of parameters: 1B, 3B, 7B and 70B. For each model there’s a V1, V2 and V3 version where:
V1exists forfuji-7Bandfuji-70B. It specifies a vocab size of32 * 1024, a max sequence length of2048, and a total of 1T tokens for the7Bversion and 1.4T for the70Bone;V2exists forfuji-7Bandfuji-70B. It specifies a vocab size of32 * 1024, a max sequence length of4096, and 2T tokens for both the7Band70Bmodel;V3is is used for1B,3B,7Band70B. The vocab size is128*1024, the max sequence length8192and it provides 15T tokens for all the four models. You can check the above on the AXLearn code. Each model can then work in a different mode:-flash: uses flash attention;-flash-single-host: uses flash attention and it’s tuned to work on a single host. To run one of these models, on an EKS instance, you can follow this deployment file, with the running command depicted in the c4_trainer description, whose skeleton looks like:
This will run the fuji-3B-v3-flash-single-host model, and all the input configurations (e.g. max number of steps, sequence length, parallelism) can be found here. The input dataset is the public tensorflow C4 dataset.
Example 2: custom configuration training for a Fuji model on EKS
For specifying a custom configuration definition, we are using a Python script. The script is made based the following AXLearn c4 trainer script. The core configuration part is the following:
After parsing the input parameters, config_fn = c4_trainer.named_trainer_configs()[config_name] retrieves the standard configuration for the model specified in config_name. The parallelism is define intra-node and inter-node. This function in AXLearn defines the construction of the mesh. Remember that for the intra-node mesh (ici_mesh), the parallelism nubmers product muber be as the same as the number of devices on a single node, while, for the inter-node mesh (dcn_mesh), the product must be equal to the number of nodes. The rest of the code specifies the gradient accumulation size, the global batch size, the max sequence length, and when to save checkpoints and summary files.
Then, we’re ready to launch the job with the following lines:
In particular, launch.setup() refers to this code in AXLearn, where the main call to jax and its distributed initialization happens.
Testing
Container validation runs pytest against all tests in /opt/axlearn/axlearn/common using the test_axlearn.sh script bundled in the JAX-Toolbox container. See the repository’s CI workflows for example job definitions.