Commit b1df7600 authored by gaclove's avatar gaclove
Browse files

fix(lora): update config

parent a1d35e4c
{ {
"infer_steps": 4, "infer_steps": 4,
"target_video_length": 81, "target_video_length": 81,
"target_height": 480, "target_height": 480,
"target_width": 832, "target_width": 832,
"self_attn_1_type": "flash_attn3", "self_attn_1_type": "flash_attn3",
"cross_attn_1_type": "flash_attn3", "cross_attn_1_type": "flash_attn3",
"cross_attn_2_type": "flash_attn3", "cross_attn_2_type": "flash_attn3",
"seed": 42, "seed": 42,
"sample_guide_scale": 5, "sample_guide_scale": 5,
"sample_shift": 5, "sample_shift": 5,
"enable_cfg": false, "enable_cfg": false,
"cpu_offload": false, "cpu_offload": false,
"denoising_step_list": [1000, 750, 500, 250], "denoising_step_list": [1000, 750, 500, 250],
"lora_path": [ "lora_configs": [
"Wan2.1-I2V-14B-480P/loras/Wan21_I2V_14B_lightx2v_cfg_step_distill_lora_rank64.safetensors" {
] "path": "Wan2.1-I2V-14B-480P/loras/Wan21_I2V_14B_lightx2v_cfg_step_distill_lora_rank64.safetensors",
"strength": 1.0
}
]
} }
{ {
"infer_steps": 4, "infer_steps": 4,
"target_video_length": 81, "target_video_length": 81,
"text_len": 512, "text_len": 512,
"target_height": 480, "target_height": 480,
"target_width": 832, "target_width": 832,
"self_attn_1_type": "flash_attn3", "self_attn_1_type": "flash_attn3",
"cross_attn_1_type": "flash_attn3", "cross_attn_1_type": "flash_attn3",
"cross_attn_2_type": "flash_attn3", "cross_attn_2_type": "flash_attn3",
"seed": 42, "seed": 42,
"sample_guide_scale": 6, "sample_guide_scale": 6,
"sample_shift": 5, "sample_shift": 5,
"enable_cfg": false, "enable_cfg": false,
"cpu_offload": false, "cpu_offload": false,
"denoising_step_list": [1000, 750, 500, 250], "denoising_step_list": [1000, 750, 500, 250],
"lora_path": [ "lora_configs": [
"Wan2.1-T2V-14B/loras/Wan21_T2V_14B_lightx2v_cfg_step_distill_lora_rank64.safetensors" {
] "path": "Wan2.1-T2V-14B/loras/Wan21_T2V_14B_lightx2v_cfg_step_distill_lora_rank64.safetensors",
"strength": 1.0
}
]
} }
...@@ -17,14 +17,17 @@ Specify LoRA path in configuration file: ...@@ -17,14 +17,17 @@ Specify LoRA path in configuration file:
```json ```json
{ {
"lora_path": [ "lora_configs": [
"/path/to/your/lora.safetensors" {
], "path": "/path/to/your/lora.safetensors",
"strength_model": 1.0 "strength": 1.0
}
]
} }
``` ```
**Configuration Parameter Description:** **Configuration Parameter Description:**
- `lora_path`: LoRA weight file path list, supports loading multiple LoRAs simultaneously - `lora_path`: LoRA weight file path list, supports loading multiple LoRAs simultaneously
- `strength_model`: LoRA strength coefficient (alpha), controls LoRA's influence on the original model - `strength_model`: LoRA strength coefficient (alpha), controls LoRA's influence on the original model
...@@ -137,6 +140,7 @@ python tools/extract/lora_extractor.py \ ...@@ -137,6 +140,7 @@ python tools/extract/lora_extractor.py \
### Advanced Usage Examples ### Advanced Usage Examples
**Extract High-Rank LoRA:** **Extract High-Rank LoRA:**
```bash ```bash
python tools/extract/lora_extractor.py \ python tools/extract/lora_extractor.py \
--source-model /path/to/base/model \ --source-model /path/to/base/model \
...@@ -147,6 +151,7 @@ python tools/extract/lora_extractor.py \ ...@@ -147,6 +151,7 @@ python tools/extract/lora_extractor.py \
``` ```
**Save Weight Differences Only:** **Save Weight Differences Only:**
```bash ```bash
python tools/extract/lora_extractor.py \ python tools/extract/lora_extractor.py \
--source-model /path/to/base/model \ --source-model /path/to/base/model \
...@@ -185,6 +190,7 @@ python tools/extract/lora_merger.py \ ...@@ -185,6 +190,7 @@ python tools/extract/lora_merger.py \
### Advanced Usage Examples ### Advanced Usage Examples
**Partial Strength Merging:** **Partial Strength Merging:**
```bash ```bash
python tools/extract/lora_merger.py \ python tools/extract/lora_merger.py \
--source-model /path/to/base/model \ --source-model /path/to/base/model \
...@@ -195,6 +201,7 @@ python tools/extract/lora_merger.py \ ...@@ -195,6 +201,7 @@ python tools/extract/lora_merger.py \
``` ```
**Multi-Format Support:** **Multi-Format Support:**
```bash ```bash
python tools/extract/lora_merger.py \ python tools/extract/lora_merger.py \
--source-model /path/to/base/model.pt \ --source-model /path/to/base/model.pt \
......
...@@ -38,8 +38,11 @@ Multiple configuration options are provided in the [configs/distill/](https://gi ...@@ -38,8 +38,11 @@ Multiple configuration options are provided in the [configs/distill/](https://gi
"infer_steps": 4, // Inference steps "infer_steps": 4, // Inference steps
"denoising_step_list": [999, 750, 500, 250], // Denoising timestep list "denoising_step_list": [999, 750, 500, 250], // Denoising timestep list
"enable_cfg": false, // Disable CFG for speed improvement "enable_cfg": false, // Disable CFG for speed improvement
"lora_path": [ // LoRA weights path (optional) "lora_configs": [ // LoRA weights path (optional)
"path/to/distill_lora.safetensors" {
"path": "path/to/distill_lora.safetensors",
"strength": 1.0
}
] ]
} }
``` ```
...@@ -50,21 +53,25 @@ Multiple configuration options are provided in the [configs/distill/](https://gi ...@@ -50,21 +53,25 @@ Multiple configuration options are provided in the [configs/distill/](https://gi
**Complete Model:** **Complete Model:**
Place the downloaded model (`distill_model.pt` or `distill_model.safetensors`) in the `distill_models/` folder under the Wan model root directory: Place the downloaded model (`distill_model.pt` or `distill_model.safetensors`) in the `distill_models/` folder under the Wan model root directory:
- For T2V: `Wan2.1-T2V-14B/distill_models/` - For T2V: `Wan2.1-T2V-14B/distill_models/`
- For I2V-480P: `Wan2.1-I2V-14B-480P/distill_models/` - For I2V-480P: `Wan2.1-I2V-14B-480P/distill_models/`
**LoRA:** **LoRA:**
1. Place the downloaded LoRA in any location 1. Place the downloaded LoRA in any location
2. Modify the `lora_path` parameter in the configuration file to the LoRA storage path 2. Modify the `lora_path` parameter in the configuration file to the LoRA storage path
### Inference Scripts ### Inference Scripts
**T2V Complete Model:** **T2V Complete Model:**
```bash ```bash
bash scripts/wan/run_wan_t2v_distill_4step_cfg.sh bash scripts/wan/run_wan_t2v_distill_4step_cfg.sh
``` ```
**I2V Complete Model:** **I2V Complete Model:**
```bash ```bash
bash scripts/wan/run_wan_i2v_distill_4step_cfg.sh bash scripts/wan/run_wan_i2v_distill_4step_cfg.sh
``` ```
...@@ -72,11 +79,13 @@ bash scripts/wan/run_wan_i2v_distill_4step_cfg.sh ...@@ -72,11 +79,13 @@ bash scripts/wan/run_wan_i2v_distill_4step_cfg.sh
### Step Distillation LoRA Inference Scripts ### Step Distillation LoRA Inference Scripts
**T2V LoRA:** **T2V LoRA:**
```bash ```bash
bash scripts/wan/run_wan_t2v_distill_4step_cfg_lora.sh bash scripts/wan/run_wan_t2v_distill_4step_cfg_lora.sh
``` ```
**I2V LoRA:** **I2V LoRA:**
```bash ```bash
bash scripts/wan/run_wan_i2v_distill_4step_cfg_lora.sh bash scripts/wan/run_wan_i2v_distill_4step_cfg_lora.sh
``` ```
......
...@@ -16,14 +16,17 @@ LoRA (Low-Rank Adaptation) 是一种高效的模型微调技术,通过低秩 ...@@ -16,14 +16,17 @@ LoRA (Low-Rank Adaptation) 是一种高效的模型微调技术,通过低秩
```json ```json
{ {
"lora_path": [ "lora_configs": [
"/path/to/your/lora.safetensors" {
], "path": "/path/to/your/lora.safetensors",
"strength_model": 1.0 "strength": 1.0
}
]
} }
``` ```
**配置参数说明:** **配置参数说明:**
- `lora_path`: LoRA 权重文件路径列表,支持多个 LoRA 同时加载 - `lora_path`: LoRA 权重文件路径列表,支持多个 LoRA 同时加载
- `strength_model`: LoRA 强度系数 (alpha),控制 LoRA 对原模型的影响程度 - `strength_model`: LoRA 强度系数 (alpha),控制 LoRA 对原模型的影响程度
...@@ -136,6 +139,7 @@ python tools/extract/lora_extractor.py \ ...@@ -136,6 +139,7 @@ python tools/extract/lora_extractor.py \
### 高级用法示例 ### 高级用法示例
**提取高秩 LoRA:** **提取高秩 LoRA:**
```bash ```bash
python tools/extract/lora_extractor.py \ python tools/extract/lora_extractor.py \
--source-model /path/to/base/model \ --source-model /path/to/base/model \
...@@ -146,6 +150,7 @@ python tools/extract/lora_extractor.py \ ...@@ -146,6 +150,7 @@ python tools/extract/lora_extractor.py \
``` ```
**仅保存权重差值:** **仅保存权重差值:**
```bash ```bash
python tools/extract/lora_extractor.py \ python tools/extract/lora_extractor.py \
--source-model /path/to/base/model \ --source-model /path/to/base/model \
...@@ -184,6 +189,7 @@ python tools/extract/lora_merger.py \ ...@@ -184,6 +189,7 @@ python tools/extract/lora_merger.py \
### 高级用法示例 ### 高级用法示例
**部分强度合并:** **部分强度合并:**
```bash ```bash
python tools/extract/lora_merger.py \ python tools/extract/lora_merger.py \
--source-model /path/to/base/model \ --source-model /path/to/base/model \
...@@ -194,6 +200,7 @@ python tools/extract/lora_merger.py \ ...@@ -194,6 +200,7 @@ python tools/extract/lora_merger.py \
``` ```
**多格式支持:** **多格式支持:**
```bash ```bash
python tools/extract/lora_merger.py \ python tools/extract/lora_merger.py \
--source-model /path/to/base/model.pt \ --source-model /path/to/base/model.pt \
......
...@@ -38,8 +38,11 @@ ...@@ -38,8 +38,11 @@
"infer_steps": 4, // 推理步数 "infer_steps": 4, // 推理步数
"denoising_step_list": [999, 750, 500, 250], // 去噪时间步列表 "denoising_step_list": [999, 750, 500, 250], // 去噪时间步列表
"enable_cfg": false, // 关闭CFG以提升速度 "enable_cfg": false, // 关闭CFG以提升速度
"lora_path": [ // LoRA权重路径(可选) "lora_configs": [ // LoRA权重路径(可选)
"path/to/distill_lora.safetensors" {
"path": "path/to/distill_lora.safetensors",
"strength": 1.0
}
] ]
} }
``` ```
...@@ -50,21 +53,25 @@ ...@@ -50,21 +53,25 @@
**完整模型:** **完整模型:**
将下载好的模型(`distill_model.pt` 或者 `distill_model.safetensors`)放到 Wan 模型根目录的 `distill_models/` 文件夹下即可 将下载好的模型(`distill_model.pt` 或者 `distill_model.safetensors`)放到 Wan 模型根目录的 `distill_models/` 文件夹下即可
- 对于 T2V:`Wan2.1-T2V-14B/distill_models/` - 对于 T2V:`Wan2.1-T2V-14B/distill_models/`
- 对于 I2V-480P:`Wan2.1-I2V-14B-480P/distill_models/` - 对于 I2V-480P:`Wan2.1-I2V-14B-480P/distill_models/`
**LoRA:** **LoRA:**
1. 将下载好的 LoRA 放到任意位置 1. 将下载好的 LoRA 放到任意位置
2. 修改配置文件中的 `lora_path` 参数为 LoRA 存放路径即可 2. 修改配置文件中的 `lora_path` 参数为 LoRA 存放路径即可
### 推理脚本 ### 推理脚本
**T2V 完整模型:** **T2V 完整模型:**
```bash ```bash
bash scripts/wan/run_wan_t2v_distill_4step_cfg.sh bash scripts/wan/run_wan_t2v_distill_4step_cfg.sh
``` ```
**I2V 完整模型:** **I2V 完整模型:**
```bash ```bash
bash scripts/wan/run_wan_i2v_distill_4step_cfg.sh bash scripts/wan/run_wan_i2v_distill_4step_cfg.sh
``` ```
...@@ -72,11 +79,13 @@ bash scripts/wan/run_wan_i2v_distill_4step_cfg.sh ...@@ -72,11 +79,13 @@ bash scripts/wan/run_wan_i2v_distill_4step_cfg.sh
### 步数蒸馏 LoRA 推理脚本 ### 步数蒸馏 LoRA 推理脚本
**T2V LoRA:** **T2V LoRA:**
```bash ```bash
bash scripts/wan/run_wan_t2v_distill_4step_cfg_lora.sh bash scripts/wan/run_wan_t2v_distill_4step_cfg_lora.sh
``` ```
**I2V LoRA:** **I2V LoRA:**
```bash ```bash
bash scripts/wan/run_wan_i2v_distill_4step_cfg_lora.sh bash scripts/wan/run_wan_i2v_distill_4step_cfg_lora.sh
``` ```
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment