```  
If you are using the image-to-video pipeline, load it as follows:  
```python
pipe = CogVideoXImageToVideoPipeline.from_pretrained("THUDM/CogVideoX-5b-I2V").to("cuda")
```  
Then change the memory layout of the pipelines `transformer` component to `torch.channels_last`:  
```python
pipe.transformer.to(memory_format=torch.channels_last)
```  
Compile the components and run inference:  
```python
pipe.transformer = torch.compile(pipeline.transformer, mode="max-autotune", fullgraph=True)