Buckets:
| # xDiT | |
| [xDiT](https://github.com/xdit-project/xDiT)は、Diffusion Transformers (DiTs) の大規模並列デプロイメント用に設計された推論エンジンです。xDiTは、Diffusion Models向けの効率的な並列アプローチのスイートと、GPUカーネルのアクセラレーションを提供します。 | |
| xDiTでは、[Unified Sequence Parallelism](https://huggingface.co/papers/2405.07719)、[PipeFusion](https://huggingface.co/papers/2405.14430)、CFG並列化、データ並列化の4つの並列化手法がサポートされています。xDiTの4つの並列化手法はハイブリッドに設定でき、基盤となるネットワークハードウェアに最も適した通信パターンを最適化できます。 | |
| 並列化とは直交する最適化は、単一 GPU の性能向上に焦点を当てています。周知の Attention 最適化ライブラリを活用するほか、torch.compile や onediff といったコンパイルによる高速化技術も活用しています。 | |
| xDiTの概要は以下の通りです。 | |
| 以下のコマンドを使用してxDiTをインストールできます: | |
| ```bash | |
| pip install xfuser | |
| ``` | |
| xDiTを使用してDiffusersモデルの推論を高速化する例を以下に示します。 | |
| ```diff | |
| import torch | |
| from diffusers import StableDiffusion3Pipeline | |
| from xfuser import xFuserArgs, xDiTParallel | |
| from xfuser.config import FlexibleArgumentParser | |
| from xfuser.core.distributed import get_world_group | |
| def main(): | |
| + parser = FlexibleArgumentParser(description="xFuser Arguments") | |
| + args = xFuserArgs.add_cli_args(parser).parse_args() | |
| + engine_args = xFuserArgs.from_cli_args(args) | |
| + engine_config, input_config = engine_args.create_config() | |
| local_rank = get_world_group().local_rank | |
| pipe = StableDiffusion3Pipeline.from_pretrained( | |
| pretrained_model_name_or_path=engine_config.model_config.model, | |
| dtype=torch.float16, | |
| ).to(f"cuda:{local_rank}") | |
| # do anything you want with pipeline here | |
| + pipe = xDiTParallel(pipe, engine_config, input_config) | |
| pipe( | |
| height=input_config.height, | |
| width=input_config.height, | |
| prompt=input_config.prompt, | |
| num_inference_steps=input_config.num_inference_steps, | |
| output_type=input_config.output_type, | |
| generator=torch.Generator(device="cuda").manual_seed(input_config.seed), # or "mps", "xpu", "cpu" | |
| ) | |
| + if input_config.output_type == "pil": | |
| + pipe.save("results", "stable_diffusion_3") | |
| if __name__ == "__main__": | |
| main() | |
| ``` | |
| ご覧のとおり、xFuserArgs を xDiT から使用して設定パラメータを取得し、これらのパラメータと Diffusers ライブラリのパイプラインオブジェクトを xDiTParallel に渡すだけで、Diffusers の特定のパイプラインの並列化を完了できます。 | |
| xDiTのランタイムパラメータは、コマンドラインで`-h`を指定して表示でき、詳細についてはこの[使用例](https://github.com/xdit-project/xDiT?tab=readme-ov-file#2-usage)を参照してください。 | |
| xDiT は、マルチノードおよびマルチ GPU 並列処理の機能を利用するために、torchrun を使用して起動する必要があります。例えば、8 GPU 並列推論には、次のコマンドを使用できます。 | |
| ```bash | |
| torchrun --nproc_per_node=8 ./inference.py --model models/FLUX.1-dev --data_parallel_degree 2 --ulysses_degree 2 --ring_degree 2 --prompt "A snowy mountain" "A small dog" --num_inference_steps 50 | |
| ``` | |
| ## サポートされているモデル | |
| Diffusers のモデルの一部、例えば Flux.1 や Stable Diffusion 3 など、が xDiT でサポートされています。サポートされている最新のモデルは[こちら](https://github.com/xdit-project/xDiT?tab=readme-ov-file#-supported-dits)で確認できます。 | |
| ## ベンチマーク | |
| さまざまなマシンで異なるモデルをテストし、一部のベンチマークデータを以下に示します。 | |
| ### Flux.1-schnell | |
| ### Stable Diffusion 3 | |
| ### HunyuanDiT | |
| より詳細なパフォーマンス指標は、[GitHubページ](https://github.com/xdit-project/xDiT?tab=readme-ov-file#perf)でご覧いただけます。 | |
| ## リファレンス | |
| [xDiT-project](https://github.com/xdit-project/xDiT) | |
| [USP: 長文脈生成AIのための統一シーケンス並列アプローチ](https://huggingface.co/papers/2405.07719) | |
| [PipeFusion: 拡散型Transformerモデルの推論におけるDisplaced Patch Pipeline Parallelism](https://huggingface.co/papers/2405.14430) | |
Xet Storage Details
- Size:
- 4.66 kB
- Xet hash:
- 5ffae7b0dc990215b873bdeff22ed219bc8903226d36007897ecc8fd8f1fe1cf
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.