.ipynb_checkpoints/README-checkpoint.md DELETED
@@ -1,154 +0,0 @@
1
- # Prince Star (Kim Hyesung) HunyuanVideo LoRA
2
-
3
- This repository contains the necessary setup and scripts to generate videos using the HunyuanVideo model with a LoRA (Low-Rank Adaptation) fine-tuned for Kim Hyesung. Below are the instructions to install dependencies, download models, and run the demo.
4
-
5
- ---
6
-
7
- ## Installation
8
-
9
- ### Step 1: Install System Dependencies
10
- Run the following command to install required system packages:
11
- ```bash
12
- sudo apt-get update && sudo apt-get install git-lfs ffmpeg cbm
13
- ```
14
-
15
- ### Step 2: Clone the Repository
16
- Clone the repository and navigate to the project directory:
17
- ```bash
18
- git clone https://huggingface.co/svjack/Prince_Star_HunyuanVideo_lora
19
- cd Prince_Star_HunyuanVideo_lora
20
- ```
21
-
22
- ### Step 3: Install Python Dependencies
23
- Install the required Python packages:
24
- ```bash
25
- conda create -n py310 python=3.10
26
- conda activate py310
27
- pip install ipykernel
28
- python -m ipykernel install --user --name py310 --display-name "py310"
29
-
30
- pip install -r requirements.txt
31
- pip install ascii-magic matplotlib tensorboard huggingface_hub
32
- pip install moviepy==1.0.3
33
- pip install sageattention==1.0.6
34
-
35
- pip install torch==2.5.0 torchvision
36
- ```
37
-
38
- ---
39
-
40
- ## Download Models
41
-
42
- ### Step 1: Download HunyuanVideo Model
43
- Download the HunyuanVideo model and place it in the `ckpts` directory:
44
- ```bash
45
- huggingface-cli download tencent/HunyuanVideo --local-dir ./ckpts
46
- ```
47
-
48
- ### Step 2: Download LLaVA Model
49
- Download the LLaVA model and preprocess it:
50
- ```bash
51
- cd ckpts
52
- huggingface-cli download xtuner/llava-llama-3-8b-v1_1-transformers --local-dir ./llava-llama-3-8b-v1_1-transformers
53
- wget https://raw.githubusercontent.com/Tencent/HunyuanVideo/refs/heads/main/hyvideo/utils/preprocess_text_encoder_tokenizer_utils.py
54
- python preprocess_text_encoder_tokenizer_utils.py --input_dir llava-llama-3-8b-v1_1-transformers --output_dir text_encoder
55
- ```
56
-
57
- ### Step 3: Download CLIP Model
58
- Download the CLIP model for the text encoder:
59
- ```bash
60
- huggingface-cli download openai/clip-vit-large-patch14 --local-dir ./text_encoder_2
61
- ```
62
-
63
- ---
64
-
65
- ## Demo
66
-
67
- ### Generate Video 1: Kim Hyesung Sun
68
- Run the following command to generate a video of Prince Kim Hyesung:
69
- ```bash
70
- python hv_generate_video.py \
71
- --fp8 \
72
- --video_size 544 960 \
73
- --video_length 60 \
74
- --infer_steps 30 \
75
- --prompt "fantastic artwork of Kim Hyesung. warm sunset in a rural village. the interior of a futuristic spaceship in the background." \
76
- --save_path . \
77
- --output_type both \
78
- --dit ckpts/hunyuan-video-t2v-720p/transformers/mp_rank_00_model_states.pt \
79
- --attn_mode sdpa \
80
- --vae ckpts/hunyuan-video-t2v-720p/vae/pytorch_model.pt \
81
- --vae_chunk_size 32 \
82
- --vae_spatial_tile_sample_min_size 128 \
83
- --text_encoder1 ckpts/text_encoder \
84
- --text_encoder2 ckpts/text_encoder_2 \
85
- --seed 1234 \
86
- --lora_multiplier 1.0 \
87
- --lora_weight Star_im_lora_dir/Star_single_im_lora-000040.safetensors
88
- ```
89
-
90
-
91
- <video controls autoplay src="https://huggingface.co/svjack/Prince_Star_HunyuanVideo_lora/resolve/main/20250204-104122_1234.mp4"></video>
92
-
93
-
94
- ### Generate Video 2: Kim Hyesung Sea
95
- Run the following command to generate a video of Prince Kim Hyesung:
96
- ```bash
97
- python hv_generate_video.py \
98
- --fp8 \
99
- --video_size 544 960 \
100
- --video_length 60 \
101
- --infer_steps 30 \
102
- --prompt "surrealist painting of Kim Hyesung. underwater glow, deep sea. a peaceful zen garden with koi pond in the background." \
103
- --save_path . \
104
- --output_type both \
105
- --dit ckpts/hunyuan-video-t2v-720p/transformers/mp_rank_00_model_states.pt \
106
- --attn_mode sdpa \
107
- --vae ckpts/hunyuan-video-t2v-720p/vae/pytorch_model.pt \
108
- --vae_chunk_size 32 \
109
- --vae_spatial_tile_sample_min_size 128 \
110
- --text_encoder1 ckpts/text_encoder \
111
- --text_encoder2 ckpts/text_encoder_2 \
112
- --seed 1234 \
113
- --lora_multiplier 1.0 \
114
- --lora_weight Star_im_lora_dir/Star_single_im_lora-000040.safetensors
115
- ```
116
-
117
-
118
- <video controls autoplay src="https://huggingface.co/svjack/Prince_Star_HunyuanVideo_lora/resolve/main/20250204-111149_1234.mp4"></video>
119
-
120
- ### Generate Video 1: Kim Hyesung Class
121
- Run the following command to generate a video of Prince Kim Hyesung:
122
- ```bash
123
- python hv_generate_video.py \
124
- --fp8 \
125
- --video_size 544 960 \
126
- --video_length 60 \
127
- --infer_steps 30 \
128
- --prompt "Kim Hyesung, a young person with straight, dark hair, wearing a white school uniform. They are seated in a classroom with other students, all dressed in white uniforms. The background includes a wooden door and blurred figures of other students, suggesting a school setting. The lighting is soft, and the image has a slightly grainy texture, adding to the realistic and candid feel." \
129
- --save_path . \
130
- --output_type both \
131
- --dit ckpts/hunyuan-video-t2v-720p/transformers/mp_rank_00_model_states.pt \
132
- --attn_mode sdpa \
133
- --vae ckpts/hunyuan-video-t2v-720p/vae/pytorch_model.pt \
134
- --vae_chunk_size 32 \
135
- --vae_spatial_tile_sample_min_size 128 \
136
- --text_encoder1 ckpts/text_encoder \
137
- --text_encoder2 ckpts/text_encoder_2 \
138
- --seed 1234 \
139
- --lora_multiplier 1.0 \
140
- --lora_weight Star_im_lora_dir/Star_single_im_lora-000040.safetensors
141
- ```
142
-
143
-
144
- <video controls autoplay src="https://huggingface.co/svjack/Prince_Star_HunyuanVideo_lora/resolve/main/20250204-114357_1234.mp4"></video>
145
-
146
-
147
- ---
148
-
149
- ## Notes
150
- - Ensure you have sufficient GPU resources for video generation.
151
- - Adjust the `--video_size`, `--video_length`, and `--infer_steps` parameters as needed for different output qualities and lengths.
152
- - The `--prompt` parameter can be modified to generate videos with different scenes or actions.
153
-
154
- ---