Sitemap

Animate images and turn them into videos with AI

MLBoy
3 min readMar 24, 2025

Create videos with an image and just one line of code

Compare HunyuanVideo and Wan2.1
. Try moving this image.

Let’s turn this image into a video.

The auxiliary sentence is

“A person bravely and
beautifully swings a sword.”

HunyuanVideo

created by hunyuanvideo

Wan2.1

created by wan2.1

How to use

Wan2.1 I2V

install

git clone https://github.com/Wan-Video/Wan2.1.git
cd Wan2.1
# Ensure torch >= 2.4.0
pip install -r requirements.txt
pip install "huggingface_hub[cli]"
huggingface-cli download Wan-AI/Wan2.1-I2V-14B-720P --local-dir ./Wan2.1-I2V-14B-720P

run

python generate.py --task i2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-I2V-14B-720P --image examples/samurai.jpg --prompt "A young girl bravely and beautifully swings a sword."

HunyuanVideo I2V

install

git clone https://github.com/tencent/HunyuanVideo-I2V
cd HunyuanVideo-I2V
# 1. Create conda environment
conda create -n HunyuanVideo-I2V python==3.11.9
# 2. Activate the environment
conda activate HunyuanVideo-I2V
# 3. Install PyTorch and other dependencies using conda
# For CUDA 12.4
conda install pytorch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 pytorch-cuda=12.4 -c pytorch -c nvidia
# 4. Install pip dependencies
python -m pip install -r requirements.txt
# 5. Install flash attention v2 for acceleration (requires CUDA 11.8 or above)
python -m pip install ninja
python -m pip install git+https://github.com/Dao-AILab/flash-attention.git@v2.6.3
python -m pip install "huggingface_hub[cli]"
# Switch to the directory named 'HunyuanVideo-I2V'
cd /workspace/HunyuanVideo-I2V
# Use the huggingface-cli tool to download HunyuanVideo-I2V model in HunyuanVideo-I2V/ckpts dir.
huggingface-cli download tencent/HunyuanVideo-I2V --local-dir ./ckpts
# The download time may vary from 10 minutes to 1 hour depending on network conditions.
cd /workspace/HunyuanVideo-I2V/ckpts
huggingface-cli download tencent/HunyuanVideo-I2V --local-dir ./ckpts
huggingface-cli download xtuner/llava-llama-3-8b-v1_1-transformers --local-dir ./text_encoder_i2v
huggingface-cli download openai/clip-vit-large-patch14 --local-dir ./text_encoder_2

Run.

cd /workspace/HunyuanVideo-I2V

python3 sample_image2video.py \
--prompt "A young girl bravely and beautifully swings a sword." \
--i2v-image-path samurai.jpg \
--model HYVideo-T/2 \
--i2v-mode \
--i2v-resolution 720p \
--infer-steps 50 \
--video-length 129 \
--flow-reverse \
--flow-shift 17.0 \
--seed 0 \
--embedded-cfg-scale 6.0 \
--use-cpu-offload \
--save-path ./results

That’s all.

However, it requires 80GB of GPU memory, which is quite expensive🥺

🐣🐣

I am a freelance engineer.
For business inquiries, please contact me at
rockyshikoku@gmail.com

I provide information related to AI.

[Twitter](https://twitter.com/JackdeS11)

[Medium](https://medium.com/@rockyshikoku)

[GitHub](https://github.com/john-rocky)

--

--

MLBoy
MLBoy

No responses yet