Taking Trainium3 to the Track: Generating Videos with LTX-2.5
Hugging Face tested video generation on AWS Trainium3 hardware using Lightricks' LTX-2.5 model, achieving 10-second video output in 22–23 seconds on half the machine, matching a paid API benchmark.
Hugging Face secured access to an AWS Trainium3 machine (trn3.48xlarge, 64 NeuronCores) for a month through a partnership with AWS, primarily to test Hugging Face models. With five days remaining, the team experimented with video generation using Lightricks' LTX-2.5 model, which produces video and audio simultaneously. A 10-second clip with sound was generated in 22 to 23 seconds on half of the machine after models were loaded, demonstrating practical feasibility.
The project aimed to assess two goals: ease of generating videos with diffusers on Trainium3 and performance comparison against CUDA and LTX's API. While CUDA benchmarks were unavailable, LTX's API reportedly generates a 10-second 1080p clip in 23.7 seconds. The Trainium3 setup matched and slightly exceeded this, producing a 10-second 2048×1024 clip in 22–23 seconds once models were loaded, despite minimal optimization time.
Video generation was structured using a JSON-based film file, where each shot includes a prompt detailing style, subject, motion, camera, lighting, and sound. Shots are chained to maintain subject continuity across frames, with options to trim or add captions. The workflow mirrors animation techniques, such as pose-to-pose sequencing, where key shots anchor transitions between scenes. Three films were produced: a seal film, a fox film, and a goat film with trimmed shots and captions.
The model initially struggled to run on NeuronCores due to memory constraints, requiring tensor and sequence parallelism, and host-side optimizations. Key challenges included unexplained NaN outputs, slow keyframe processing, and latent upsampler limitations. Performance improved to 22–23 seconds per 10-second clip after fixes, with model loading taking about 3 minutes and the first clip generation taking 80 seconds. The diffusers pipelines handled generation, while a 160-line Python script managed shot sequencing, trimming, and assembly.