Unverified Commit f21da849 authored by Yang Yong (雍洋)'s avatar Yang Yong (雍洋) Committed by GitHub
Browse files
parent 3efc43f5
...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 ...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
# set environment variables # set environment variables
source ${lightx2v_path}/scripts/base/base.sh source ${lightx2v_path}/scripts/base/base.sh
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
export SENSITIVE_LAYER_DTYPE=None export SENSITIVE_LAYER_DTYPE=None
......
...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0 ...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0
# set environment variables # set environment variables
source ${lightx2v_path}/scripts/base/base.sh source ${lightx2v_path}/scripts/base/base.sh
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
export SENSITIVE_LAYER_DTYPE=None export SENSITIVE_LAYER_DTYPE=None
......
...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 ...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
# set environment variables # set environment variables
source ${lightx2v_path}/scripts/base/base.sh source ${lightx2v_path}/scripts/base/base.sh
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
export SENSITIVE_LAYER_DTYPE=None export SENSITIVE_LAYER_DTYPE=None
......
...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0 ...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0
# set environment variables # set environment variables
source ${lightx2v_path}/scripts/base/base.sh source ${lightx2v_path}/scripts/base/base.sh
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
export SENSITIVE_LAYER_DTYPE=None export SENSITIVE_LAYER_DTYPE=None
......
...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0 ...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0
# set environment variables # set environment variables
source ${lightx2v_path}/scripts/base/base.sh source ${lightx2v_path}/scripts/base/base.sh
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
export SENSITIVE_LAYER_DTYPE=None export SENSITIVE_LAYER_DTYPE=None
......
...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 ...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
# set environment variables # set environment variables
source ${lightx2v_path}/scripts/base/base.sh source ${lightx2v_path}/scripts/base/base.sh
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
export SENSITIVE_LAYER_DTYPE=None export SENSITIVE_LAYER_DTYPE=None
......
...@@ -9,7 +9,6 @@ export CUDA_VISIBLE_DEVICES=0 ...@@ -9,7 +9,6 @@ export CUDA_VISIBLE_DEVICES=0
# set environment variables # set environment variables
source ${lightx2v_path}/scripts/base/base.sh source ${lightx2v_path}/scripts/base/base.sh
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
export SENSITIVE_LAYER_DTYPE=None export SENSITIVE_LAYER_DTYPE=None
......
...@@ -9,7 +9,6 @@ export CUDA_VISIBLE_DEVICES=0 ...@@ -9,7 +9,6 @@ export CUDA_VISIBLE_DEVICES=0
# set environment variables # set environment variables
source ${lightx2v_path}/scripts/base/base.sh source ${lightx2v_path}/scripts/base/base.sh
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
export SENSITIVE_LAYER_DTYPE=None export SENSITIVE_LAYER_DTYPE=None
......
...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 ...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
# set environment variables # set environment variables
source ${lightx2v_path}/scripts/base/base.sh source ${lightx2v_path}/scripts/base/base.sh
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
export SENSITIVE_LAYER_DTYPE=None export SENSITIVE_LAYER_DTYPE=None
......
...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0 ...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0
# set environment variables # set environment variables
source ${lightx2v_path}/scripts/base/base.sh source ${lightx2v_path}/scripts/base/base.sh
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
export SENSITIVE_LAYER_DTYPE=None export SENSITIVE_LAYER_DTYPE=None
......
...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 ...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
# set environment variables # set environment variables
source ${lightx2v_path}/scripts/base/base.sh source ${lightx2v_path}/scripts/base/base.sh
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
export SENSITIVE_LAYER_DTYPE=None export SENSITIVE_LAYER_DTYPE=None
......
...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 ...@@ -8,7 +8,6 @@ export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
# set environment variables # set environment variables
source ${lightx2v_path}/scripts/base/base.sh source ${lightx2v_path}/scripts/base/base.sh
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
export SENSITIVE_LAYER_DTYPE=None export SENSITIVE_LAYER_DTYPE=None
......
...@@ -5,7 +5,6 @@ lightx2v_path= ...@@ -5,7 +5,6 @@ lightx2v_path=
model_path= model_path=
export CUDA_VISIBLE_DEVICES=0 export CUDA_VISIBLE_DEVICES=0
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
# set environment variables # set environment variables
source ${lightx2v_path}/scripts/base/base.sh source ${lightx2v_path}/scripts/base/base.sh
export DTYPE=FP16 export DTYPE=FP16
......
...@@ -800,7 +800,7 @@ def main(): ...@@ -800,7 +800,7 @@ def main():
parser.add_argument( parser.add_argument(
"-t", "-t",
"--model_type", "--model_type",
choices=["wan_dit", "hunyuan_dit", "wan_t5", "wan_clip", "wan_animate_dit", "qwen_image_dit"], choices=["wan_dit", "hunyuan_dit", "wan_t5", "wan_clip", "wan_animate_dit", "qwen_image_dit", "qwen25vl_llm"],
default="wan_dit", default="wan_dit",
help="Model type", help="Model type",
) )
...@@ -897,16 +897,17 @@ def main(): ...@@ -897,16 +897,17 @@ def main():
"key_idx": 2, "key_idx": 2,
"target_keys": [ "target_keys": [
"img_mod", "img_mod",
"img_attn_qkv", "img_attn_q",
"img_attn_k",
"img_attn_v",
"img_attn_proj", "img_attn_proj",
"img_mlp", "img_mlp",
"txt_mod", "txt_mod",
"txt_attn_qkv", "txt_attn_q",
"txt_attn_k",
"txt_attn_v",
"txt_attn_proj", "txt_attn_proj",
"txt_mlp", "txt_mlp",
"linear1",
"linear2",
"modulation",
], ],
"ignore_key": None, "ignore_key": None,
}, },
...@@ -914,7 +915,12 @@ def main(): ...@@ -914,7 +915,12 @@ def main():
"wan_clip": { "wan_clip": {
"key_idx": 3, "key_idx": 3,
"target_keys": ["attn", "mlp"], "target_keys": ["attn", "mlp"],
"ignore_key": "textual", "ignore_key": ["textual"],
},
"qwen25vl_llm": {
"key_idx": 3,
"target_keys": ["self_attn", "mlp"],
"ignore_key": ["visual"],
}, },
} }
......
...@@ -14,6 +14,7 @@ A powerful model weight conversion tool that supports format conversion, quantiz ...@@ -14,6 +14,7 @@ A powerful model weight conversion tool that supports format conversion, quantiz
## Supported Model Types ## Supported Model Types
- `hunyuan_dit`: hunyuan DiT 1.5 models
- `wan_dit`: Wan DiT series models (default) - `wan_dit`: Wan DiT series models (default)
- `wan_animate_dit`: Wan Animate DiT models - `wan_animate_dit`: Wan Animate DiT models
- `qwen_image_dit`: Qwen Image DiT models - `qwen_image_dit`: Qwen Image DiT models
...@@ -242,6 +243,38 @@ python converter.py \ ...@@ -242,6 +243,38 @@ python converter.py \
--quantized --quantized
``` ```
#### 1.5 Qwen25_vl llm Quantization
**INT8 Quantization**
```bash
python converter.py \
--source /path/to/hunyuanvideo-1.5/text_encoder/llm \
--output /path/to/output \
--output_ext .safetensors \
--output_name qwen25vl-llm-int8 \
--linear_dtype torch.int8 \
--non_linear_dtype torch.float16 \
--model_type qwen25vl_llm \
--quantized \
--single_file
```
**FP8 Quantization**
```bash
python converter.py \
--source /path/to/hunyuanvideo-1.5/text_encoder/llm \
--output /path/to/output \
--output_ext .safetensors \
--output_name qwen25vl-llm-fp8 \
--linear_dtype torch.float8_e4m3fn \
--non_linear_dtype torch.float16 \
--model_type qwen25vl_llm \
--quantized \
--single_file
```
### 2. LoRA Merging ### 2. LoRA Merging
#### 2.1 Merge Single LoRA #### 2.1 Merge Single LoRA
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
## 支持的模型类型 ## 支持的模型类型
- `hunyuan_dit`: hunyuan DiT 1.5模型
- `wan_dit`: Wan DiT 系列模型(默认) - `wan_dit`: Wan DiT 系列模型(默认)
- `wan_animate_dit`: Wan Animate DiT 模型 - `wan_animate_dit`: Wan Animate DiT 模型
- `qwen_image_dit`: Qwen Image DiT 模型 - `qwen_image_dit`: Qwen Image DiT 模型
...@@ -242,6 +243,36 @@ python converter.py \ ...@@ -242,6 +243,36 @@ python converter.py \
--quantized --quantized
``` ```
#### 1.5 Qwen25_vl 語言部分量化
**INT8 量化**
```bash
python converter.py \
--source /path/to/hunyuanvideo-1.5/text_encoder/llm \
--output /path/to/output \
--output_ext .safetensors \
--output_name qwen25vl-llm-int8 \
--linear_dtype torch.int8 \
--non_linear_dtype torch.float16 \
--model_type qwen25vl_llm \
--quantized \
--single_file
```
**FP8 量化**
```bash
python converter.py \
--source /path/to/hunyuanvideo-1.5/text_encoder/llm \
--output /path/to/output \
--output_ext .safetensors \
--output_name qwen25vl-llm-fp8 \
--linear_dtype torch.float8_e4m3fn \
--non_linear_dtype torch.float16 \
--model_type qwen25vl_llm \
--quantized \
--single_file
```
### 2. LoRA 融合 ### 2. LoRA 融合
#### 2.1 融合单个 LoRA #### 2.1 融合单个 LoRA
......
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