3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

コード1行で動画を作れる

HunyuanVideoWan2.1を比較する。
この画像を動かしてみる。
samurai.jpg

補助文は

"A girl bravely and beautifully swings a sword."
少女が勇敢に美しく剣を振る。

HunyuanVideo
Mar-14-2025 09-08-48.gif

Wan2.1
Mar-14-2025 09-04-45.gif

使い方

Wan2.1 I2V

インストール

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

実行

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

インストール

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
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

これだけ。

🐣


フリーランスエンジニアです。
お仕事のご相談こちらまで
rockyshikoku@gmail.com

Core MLを使ったアプリを作っています。
機械学習関連の情報を発信しています。

Twitter
Medium
GitHub

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?