File size: 5,917 Bytes
032bc8d
 
20f4205
 
1d8c239
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20f4205
 
1d8c239
 
 
171400d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1d8c239
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
## HunyuanVideo t2v lora tuned by 
## https://huggingface.co/datasets/svjack/Genshin-Impact-XiangLing-animatediff-with-score-organized 
## In early step

## Installation

### Prerequisites

Before you begin, ensure you have the following installed:

- `git-lfs`
- `cbm`
- `ffmpeg`

You can install these prerequisites using the following command:

```bash
sudo apt-get update && sudo apt-get install git-lfs cbm ffmpeg
```

### Installation Steps

1. **Install `comfy-cli`:**

   ```bash
   pip install comfy-cli
   ```

2. **Initialize ComfyUI:**

   ```bash
   comfy --here install
   ```

3. **Clone and Install ComfyScript:**

   ```bash
   cd ComfyUI/custom_nodes
   git clone https://github.com/Chaoses-Ib/ComfyScript.git
   cd ComfyScript
   pip install -e ".[default,cli]"
   pip uninstall aiohttp
   pip install -U aiohttp
   ```

4. **Clone and Install ComfyUI-HunyuanVideoWrapper:**

   ```bash
   cd ../
   git clone https://github.com/svjack/ComfyUI-HunyuanVideoWrapper
   cd ComfyUI-HunyuanVideoWrapper
   pip install -r requirements.txt
   ```

5. **Load ComfyScript Runtime:**

   ```python
   from comfy_script.runtime import *
   load()
   from comfy_script.runtime.nodes import *
   ```

6. **Install Example Dependencies:**

   ```bash
   cd examples
   comfy node install-deps --workflow='hunyuanvideo lora Walking Animation Share.json'
   ```

7. **Update ComfyUI Dependencies:**

   ```bash
   cd ../../ComfyUI
   pip install --upgrade torch torchvision torchaudio -r requirements.txt
   ```

8. **Transpile Example Workflow:**

   ```bash
   python -m comfy_script.transpile hyvideo_t2v_example_01.json
   ```

9. **Download and Place Model Files:**

   Download the required model files from Hugging Face:

   ```bash
   huggingface-cli download Kijai/HunyuanVideo_comfy --local-dir ./HunyuanVideo_comfy
   ```

   Copy the downloaded files to the appropriate directories:

   ```bash
   cp -r HunyuanVideo_comfy/ .
   cp HunyuanVideo_comfy/hunyuan_video_720_cfgdistill_fp8_e4m3fn.safetensors ComfyUI/models/diffusion_models
   cp HunyuanVideo_comfy/hunyuan_video_vae_bf16.safetensors ComfyUI/models/vae
   ```

### Genshin Impact Character XiangLing LoRA Example (early tuned version)

10. **Download the Makima LoRA Model:**

   Download the Makima LoRA model from Huggingface:

   - [Xiangling Character LoRA](https://huggingface.co/svjack/Genshin_Impact_XiangLing_HunyuanVideo_lora_early)

   ```bash
   xiangling_test_epoch4.safetensors
   ```

   Copy the model to the `loras` directory:

   ```bash
   cp xiangling_test_epoch4.safetensors ComfyUI/models/loras
   ```

11. **Run the Workflow:**

   Create a Python script `run_t2v_xiangling_lora.py`:

   ```python
   #### character do something (seed 42)
   from comfy_script.runtime import *
   load()
   from comfy_script.runtime.nodes import *
   with Workflow():
       vae = HyVideoVAELoader(r'hunyuan_video_vae_bf16.safetensors', 'bf16', None)
       lora = HyVideoLoraSelect('xiangling_test_epoch4.safetensors', 2.0, None, None)
       model = HyVideoModelLoader(r'hunyuan_video_720_cfgdistill_fp8_e4m3fn.safetensors', 'bf16', 'fp8_e4m3fn', 'offload_device', 'sdpa', None, None, lora)
       hyvid_text_encoder = DownloadAndLoadHyVideoTextEncoder('Kijai/llava-llama-3-8b-text-encoder-tokenizer', 'openai/clip-vit-large-patch14', 'fp16', False, 2, 'disabled')
       hyvid_embeds = HyVideoTextEncode(hyvid_text_encoder, "solo,Xiangling, cook rice in a pot genshin impact ,1girl,highres,", 'bad quality video', 'video', None, None, None)
       samples = HyVideoSampler(model, hyvid_embeds, 478, 512, 85, 30, 6, 9, 42, 1, None, 1, None)
       images = HyVideoDecode(vae, samples, True, 64, 256, True)
       #_ = VHSVideoCombine(images, 24, 0, 'HunyuanVideo', 'video/h264-mp4', False, True, None, None, None)
       _ = VHSVideoCombine(images, 24, 0, 'HunyuanVideo', 'video/h264-mp4', False, True, None, None, None,
                           pix_fmt = 'yuv420p', crf=19, save_metadata = True, trim_to_audio = False)
   ```

   Run the script:

   ```bash
   python run_t2v_xiangling_lora.py
   ```

<br/>

- prompt = "solo,Xiangling, cook rice in a pot genshin impact ,1girl,highres,"




<video controls autoplay src="https://cdn-uploads.huggingface.co/production/uploads/634dffc49b777beec3bc6448/MCArleCusUQ4q7EspIeLa.mp4"></video>



<br/>

```python
#### cook rice
from comfy_script.runtime import *
load()
from comfy_script.runtime.nodes import *
with Workflow():
   vae = HyVideoVAELoader(r'hunyuan_video_vae_bf16.safetensors', 'bf16', None)
   lora = HyVideoLoraSelect('xiangling_test_epoch3.safetensors', 2.0, None, None)
   model = HyVideoModelLoader(r'hunyuan_video_720_cfgdistill_fp8_e4m3fn.safetensors', 'bf16', 'fp8_e4m3fn', 'offload_device', 'sdpa', None, None, lora)
   hyvid_text_encoder = DownloadAndLoadHyVideoTextEncoder('Kijai/llava-llama-3-8b-text-encoder-tokenizer', 'openai/clip-vit-large-patch14', 'fp16', False, 2, 'disabled')
   hyvid_embeds = HyVideoTextEncode(hyvid_text_encoder, "solo,Xiangling, cook rice in a pot, (genshin impact) ,1girl,highres, dynamic", 'bad quality video', 'video', None, None, None)
   samples = HyVideoSampler(model, hyvid_embeds, 478, 512, 49, 25, 8, 9, 42, 1, None, 1, None)
   images = HyVideoDecode(vae, samples, True, 64, 256, True)
   #_ = VHSVideoCombine(images, 24, 0, 'HunyuanVideo', 'video/h264-mp4', False, True, None, None, None)
   _ = VHSVideoCombine(images, 24, 0, 'HunyuanVideo', 'video/h264-mp4', False, True, None, None, None,
                       pix_fmt = 'yuv420p', crf=19, save_metadata = True, trim_to_audio = False)
```

   Run the script:

   ```bash
   python run_t2v_xiangling_lora.py
   ```

<br/>

- prompt = "solo,Xiangling, cook rice in a pot, (genshin impact) ,1girl,highres, dynamic"


<video controls autoplay src="https://cdn-uploads.huggingface.co/production/uploads/634dffc49b777beec3bc6448/A1QK5Y3jHCne5Sm0wR8gq.mp4"></video>


<br/>