modelscope / modelscope/DiffSynth-Studio

FLUX.2-dev训练显存配置

Open
#1,089 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13.1k
Forks
1.3k
Avg merge
13h 12m
Merged PRs (30d)
45

Description

请问Flux.2-dev训练1024*1024分辨率图像大概需要多少显存,我使用diffsynth-2.0分支示例脚本在80G单卡A800会OOM。
补充:不使用fp8_models之前,max_pixels设为较小值104857(从1048576改为104857)能够运行,添加fp8_models参数,反而会OOM

另外parse_model_configs函数在使用model_paths指定模型时,fp8_models和offload_models使用相同方式指定会无法生效,可能需要改成以下形式:

def parse_model_configs(self, model_paths, model_id_with_origin_paths, fp8_models=None, offload_models=None, device="cpu"):
        model_configs = []
        if model_paths is not None:
            model_paths = json.loads(model_paths)
            fp8_models = [] if fp8_models is None else json.loads(fp8_models)
            offload_models = [] if offload_models is None else json.loads(offload_models)
            for path in model_paths:
                vram_config = self.parse_vram_config(
                    fp8=path in fp8_models,
                    offload=path in offload_models,
                    device=device
                )
                model_configs.append(ModelConfig(path=path, **vram_config))
        if model_id_with_origin_paths is not None:
            model_id_with_origin_paths = model_id_with_origin_paths.split(",")
            fp8_models = [] if fp8_models is None else fp8_models.split(",")
            offload_models = [] if offload_models is None else offload_models.split(",")
            for model_id_with_origin_path in model_id_with_origin_paths:
                model_id, origin_file_pattern = model_id_with_origin_path.split(":")
                vram_config = self.parse_vram_config(
                    fp8=model_id_with_origin_path in fp8_models,
                    offload=model_id_with_origin_path in offload_models,
                    device=device
                )
                model_configs.append(ModelConfig(model_id=model_id, origin_file_pattern=origin_file_pattern, **vram_config))
        return model_configs

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at parse_model_configs and the DiffSynth-2.0 example script, comparing model_paths handling with model_id_with_origin_paths for fp8_models and offload_models. Reproduce the 1024×1024 FLUX.2-dev configuration on an 80G A800, then verify that the model options take effect without an unexpected OOM and document the required VRAM.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.