Thanks to our partnership with AWS, we were lucky enough to get access to a Trainium3 machine (trn3.48xlarge, 64 NeuronCores) for a month. We spent most of the month testing Hugging Face models on it, and getting more of them to work.

Sources indicate that with five days left, I allowed myself a little fun. When you have a Ferrari, every now and then you want to take it out on the track. So I asked myself: what if I tried to generate videos? (Related: How to generate text: using different decoding methods ...)

I picked LTX-2.5 from Lightricks, which generates video and sound together. By the end, once the models were loaded, a 10-second clip with sound took 22 to 23 s to generate, on half of the machine. Here is the result. (Related: Block Sparse Matrices for Smaller and Faster Language M...)

I had two goals. The first was to see how easy it is to generate videos with diffusers on Trainium3. Not the simple clips from the examples: I wanted to make short films from a script, closer to a real use case, like drafting a movie. The second was performance. I wanted to get close to what you get with CUDA, or with LTX's own API.

According to recent reports, for CUDA, I found no real figure to compare against. The only one is LTX's claim of 6.8 s for a 10-second 720p clip on four B200 GPUs, with no detail on how it was measured. So I set CUDA aside and compared with LTX's online API instead, which LTX claims makes a 10-second 1080p clip in 23.7 s. In the end, the setup matches it, and even beats it by about a second: 22 to 23 s for a 10-second clip at 2048×1024, once the models are loaded, on half of the machine. Not bad, considering how little time I had to optimize the pipelines.

The input is a film: a JSON list of shots, each with a name and a prompt, much like a storyboard. LTX-2.5 does better with long prompts, so each prompt is a paragraph on the style, the subject, the motion, the camera, the light and the sound. Here is the seal film's file, with the prompts shortened:.

Each shot has a name and a prompt, and can have a seed, to keep the take I picked among several. Shots are chained with two keys. This chaining is the point, since prompts alone do not keep a subject from one shot to the next:.

A shot can also be trimmed, or have a caption drawn over it.

Industry observers note that making a film from shots works like animation, which has two ways to go. Straight ahead, each shot continues the one before. Pose to pose, you make the key shot first, until you get one you like; then the shots before it end on its first frames (to), and the shots after it start from its last frames (from). When a film builds up to a payoff (the moment everything was leading to), the payoff is the key shot. I found this order by trial and error, and made the seal film pose to pose, starting from iceberg.

According to recent reports, the payoff is iceberg: the iceberg rolls over, and its wave drenches the seal. nap, the sleeping seal, ends on the first 9 frames of iceberg (to), so that the seal, the floe and the iceberg stay the same into the payoff. shake starts from the last 25 frames of iceberg (from): the dripping seal shakes off the water and flops down on the floe. The dream is made on its own, and a cut joins it to the rest.

According to recent reports, on the diffusers side, three pipelines share the models of LTX-2.5. LTX2Pipeline makes the shots from their prompt alone, and LTX2ConditionPipeline makes the shots that start or end on frames of another shot. These two follow the two-stage distilled recipe of the model card: 8 steps, then the third pipeline, LTX2LatentUpsamplePipeline, upscales the latents ×2 before 3 final steps.

The diffusers pipelines do all of the generation. The film part is about 160 lines of Python on top: read the film file, order the shots so each keyframe exists before the shot that needs it, and cut the frames to hand over; then trim, caption, even out the sound and assemble the film. The code is in dacorvo/video-generation. The films I kept are in the dacorvo/video-generation bucket, with their JSON files: the seal, the fox, and the goat, which trims two of its shots and draws a caption over its payoff.

Out of the box, the model does not run on the NeuronCores: the transformer does not fit on one, and diffusers has no initiative to split it. The first attempt that ran (the model card's pipeline, with the transformer split over 4 cores and a few patches) took about 5 min 20 s for a 10-second clip, and the NeuronCores were actually computing for only about 45 s of it. What's more, the target resolution was out of reach.

Getting there took three kinds of work: making the model run on the NeuronCores (requires tensor parallelism), splitting it over more of them (sequence parallelism), and making the host keep up with them.

According to recent reports, most of the fixes below are on the device, and that is where most of the effort went. The biggest end-to-end savings came from the host: the low-hanging fruit, since that is obviously where the waste was.

Three issues were never explained: the transformer compiled as one graph returned NaN at one size, the first shot that ends on keyframes was slow in each new process (even with every graph in the cache), and the latent upsampler fails to load next to the transformer, so it stays on the CPU.

Some of this is being fixed upstream. diffusers#15420 (open) fixes the LTX-2 pipelines, which would make the second workaround above unnecessary. diffusers#14725 (still open) brings tensor and context parallelism into one ParallelConfig, and a _tp_plan for LTX-2.5 is planned.

On the performance side, once the models are loaded, a 10-second 2048×1024 clip with sound takes 22 to 23 s. That rivals LTX's paid API, on half of the instance. A service would keep its processes up, as they take about 3 minutes to load the models, and 80 s for their first clip.

On the feature side, diffusers has what it takes to draft a movie. The shots come from prompts, and keep their subject from one shot to the next by starting or ending on frames of other shots. Takes differ by their seed, and the film file keeps the one I picked. Re-run with the same code and film file, and you get the same film back, byte for byte. A shot can also start from an image, such as a storyboard frame or a character sheet, which the condition pipeline takes the same way as frames (I did not try it in a film).

LTX calls LTX-2.5 a world model, with robotics as an emerging use. Robots, cars and drones learn from videos of what their cameras see, and a world model can make more of them, including events too rare or too risky to film. So I also tried it on real footage, with the same code: a shot can start from the first second of a real camera clip and invent what happens next. One frame was not enough, as the model cannot tell from it how fast things move.

Recent findings suggest that here is the head camera of a Fourier GR1-T2 humanoid robot (a clip from NVIDIA's GR1-100), looking down at a table. In the real 6-second clip, the robot's left hand picks an orange from a plate and drops it in a tray. The model only sees the first second of that clip (the hands raised, before anything moves) and invents the rest. What really happened, next to its invention:.

Same scene, same pick: the model invents the grab on its own, and keeps the table, the hands and the fruit consistent with the real footage. More interesting are the events that did not happen. From the same second, with only the prompt changed, a person leans over and grabs the orange too, and the human hand and the robot hand carry it to the tray together. Five takes, with the real footage first:.

Recent findings suggest that the person's gestures and timing differ in each take, and the robot's arm adapts to them. That is the appeal for training: not one continuation of a clip, but a distribution of them, each reproducible from its film file and seed.

The robotics folder of the bucket has the five takes with their JSON files, and a second example from the front camera of a car in a snowstorm (Boreas), where the alternate event is slush thrown on the lens by a passing truck. Asked to make the car accelerate instead, the model kept its speed: the prompt does not override what the first second of footage already implies.

In a recent development, these videos follow prompts, not the robot's or car's commands: a training setup would need generation conditioned on those actions. For that, a team fine-tunes the pre-trained checkpoint of LTX-2.5 on the frames and actions of its own robots.

The Ferrari made it around the track, on half of its cylinders.

→ Read original article