创建

登录 ReadmeX

或

了解我们如何处理你的信息: 隐私政策

ReadmeX

陪你读懂 AI 动态

今天,想先了解什么?

选一份动态总结,或直接聊聊你的问题。

社区和关注动态总结只属于你自己。

资讯

AWS 博客:用 torchtitan 在 Trainium 上训练 Qwen3

AI 总结

AWS 机器学习博客发布教程,介绍如何在单台 trn2.48xlarge Trainium 实例上使用 torchtitan 训练 Qwen3,并称 TorchNeuron 将 Trainium 注册为原生 PyTorch 设备,使 torchtitan 可通过标准 PyTorch 接口调用。文章给出三种配置,均使用相同的 torchrun 启动方式和配置结构:以 Hugging Face Transformers v5 作为建模后端,通过 AutoModelForCausalLM 运行 Hub 模型并直接读写已发布的 safetensors;修改 config.model_spec 切换到 torchtitan 原生 Qwen3 实现;以及使用 torchtitan-neuron 配方中的 NKI 混合专家(MoE)内核,并通过 torchtitan 的 override 注册表挂载自定义内核。AWS 称这些配置既可从随机初始化开始预训练,也可微调已发布的权重,并固定了 torch 2.14.0、torch_neuronx 2.14.3、transformers 5.16.0 与 torchtitan-neuron release-2.33 等版本。

深度见解

该文章称三种配置下 Trainium 都可作为受支持的 torchtitan 设备,为 PyTorch 用户提供了一条厂商描述的路径,在不脱离标准 PyTorch 接口的情况下于 Trainium 上预训练或微调 Qwen3。

Using torchtitan on AWS Trainium means using it the way you always have. TorchNeuron registers Trainium as a native PyTorch device, which lets torchtitan use it through standard PyTorch interfaces. You can use these configurations to pre-train from random initialization or fine-tune published weights. You can also customize the model implementation and kernels for your workload. In this post, you train Qwen3 three ways on a single trn2.48xlarge.

The first method uses Transformers v5 as a modeling backend in torchtitan. It runs Hub models through AutoModelForCausalLM and reads and writes published safetensors directly. The second method switches to torchtitan’s native Qwen3 by changing config.model_spec. The third adds Neuron Kernel Interface (NKI) mixture-of-experts (MoE) kernels from the torchtitan-neuron recipes and then uses torchtitan’s override registry to attach your own kernel. All three configurations use the same torchrun launch pattern and config structure.

Prerequisites

To follow this walkthrough, use a single trn2.48xlarge with either the AWS Deep Learning AMI for Neuron or a Neuron PyTorch training container. Both environments provide the Neuron driver, runtime, and compiler required to train on Trainium.

#AWS#Trainium#trn2.48xlarge#Qwen3#torchtitan#torchtitan-neuron#PyTorch#TorchNeuron#Hugging Face Transformers#Neuron Kernel Interface (NKI)#Qwen3-4B-Instruct-2507

原文约 10 分钟读完阅读原文
群聊

还没有评论,来说说你的看法。