• <xmp id="om0om">
  • <table id="om0om"><noscript id="om0om"></noscript></table>
  • Computer Vision / Video Analytics

    NVIDIA AI ?? ????? ???? Diffusion XL? ?? ??? ????

    Reading Time: 8 minutes

    ?? ??? ?? ??? ?????? ?????? ???? ????. ? ??? ??? ?? ?? ??? ?? ??? ???? ????? AI ?? ???? ???? ??? ??? ?? ??? ??? ???? ?? ???? ?????. ? ??? ???? ?? ???? ??? ??, ?? ? ??? ?? ??? ??? ?? ??, ??? ??? ?? ? ??? ??? ? ??? ?? ?? ??? ??? ? ????.

    ?? ??? ?????? ???? ? ??? ??? ? ? ???, ???? ??? ?? ?? ???? ??? ? ? ????. 4?? ???? ??? ?? ??? ???? ? CPU? ?? ??? ??????? ? ?? ?? ? ???, ?? ???? ??? ???? ??? ??? ?? ??(SLA)? ????? ?? ????? ??? ? ? ????.

    ? ?????? NVIDIA AI ?? ???? ??? ??? ??? ??? ? ??? Stable Diffusion XL(SDXL)? ??? ?? ?????. ?? ??? ???? ??? SDXL? ??? ? ???? ???? ???? ???? NVIDIA L4 Tensor ?? GPU, NVIDIA TensorRT ? NVIDIA Triton ?? ?? ??? Google Cloud G2 ????? ??? ??? ???? ? ??? ??? ??? ??? ?????. ???? AI ??? ?? ????? ?? ???(Let’s Enhance)? NVIDIA AI ?? ???? Google ?????? SDXL? ???? ??? ?? ? ??? ???? ?? ???? ??? ? ??? ???? ??? ?????. ?????, Google Cloud?? SDXL? ???? ?? ???? ??? ??? ???? ??? ?? ??? ????? ?????.

    SDXL ???? ??? ??? ????

    ???? ???? AI ????? ???? ?? ?? ?? ???? ????. ???? ?? ?? ??? ??? ??? ??? ????, ?? ??? ?? ??? ????? ???? ?? ??? ????, ?? ??? ?? ??? ??? ???? ?? ?????.

    ??? ???? ???? ?? ??? ???? ?? ???? ???? ?? ???, ??? ??? ? ??? ??? ?? ?? ??, ??? ?????? SLA ?? ???? ?? ?? ???? ????.

    ? ?????? ??? ? ??? ?? ??? ???? NVIDIA ? ?? ?? ???? ??? ??? ???? ? ??? ??? ? ? ??? ???????.

    GPU? ??? ?? ?? ????

    ??? ??? ??? ???? ?? ???, ? ?? ?? ???? ???? U-Net ?????. ? ??? ? ?? ?? ??? ????, ? ?? ??? ????(??? ??)? ???? ???? ?? ??? ???? ??????. ? ?????? ??? ?? ??? ?????. ? ??? ?? ????? ??? ??? ?? ???? ?? ??? ?? ? ?????.

    ?? 1. ???? ?? ??? ?? ????

    ?? ???? ??? ? ? ??? NVIDIA ?? ??? ?? ?? ??? GPU ??? ??? ?? ?? ? ????. ??? ?? ??? ???? ?? ??-?? ??? ?????? ???? ??? ?? ??? ?????.

    200? ??? ?? ??? ???? NVIDIA ?? L4 GPU? ???? ??? SDXL? ????? ???? ???? ?? ???? AI ??????. ??? G2 ????? ?? ?????? L4 GPU? ???? ??? CSP? Google Cloud? ?? ???? ??? ????? ?? L4 GPU? ???? ? ????.

    Figure 2. NVIDIA L4 Tensor Core GPU

    ??? ??? ? ??? ???

    SDXL? ???? ?? ?????? ???????? ? ??? ?? ??? ?? ??? ??? ?? ??? ? ??? ??? ???? ?? ???? AI ?????? ?????.

    ?? ??, SDXL? ???? ??? ?? ???? ?? ??? ???? ?? ??? ?? ?? ???? SDXL ??? ???? ?? ?? ?? ??? ??? ??? ? ????. ?? ???? SDXL ??? ??? ??? ???? ????? ???? ?? ??? ?????? ???? ? ?? ???? ??????? ?? ?? ???? ??? ? ????.

    ??? ??? ??? ? ??? ??? ???? AI ??????? ???? ??? ?? ?? Triton ?? ??? ?? ?? ??? ?? AI ?? ?? ??? ???? ???? ? ????. ??? ?? ??? ????? ??? ?? ???? ???? ??? ??? ??? ?? ???? ?? ??? ???? ??? ? ???? ???? ??? ??? ????.

    ?? 3. ???? ?????? ??? SDXL

    ??? ?? ??? ??? SDXL ??? ???? ?? ?? ?? ???? ? ??? ??? ?? ??? ???? ???? ??? ??? ? ?? ?? ??? ??? ??? ? ????. ??? ? ??? ??? CPU??, SDXL ??? GPU?? ????? ????? ?? ?????? GPU?? ????? ???? ?? ??? ?? ?? ??????? ??? ? ????. ?? ??? ???? SDXL ?????? ????? ?? ??? ???? ???? ??? ? ????.

    ???? ??? ?? ???? ??

    ?? ? ?? ??? ???? ??? ?? SDXL? ????? ??? ???? ??? ??? ????? ?? ???? GPU ???? ????? ??? ?? ? ????? ????. ??? ???? ???? ??? ??? ?? ?? ??? ????? ??? ???? ???? ?? ??? ???? ? ????? ?????.

    ??? ?? ??? ?? ?? ?? ?? ? ?? ?? ??? ?? ?? ??? ?? TensorRT? ?? ?? ?? GPU ?? ??? ??? ???? ??? ??? ??? ? ????.

    ?? ??, ?? ??? ????? ??? ???? ???? ???? SDXL ??? ?? TensorFlow ? PyTorch ??? ?? ?? ?? ?? AI ??? ??? ???? ????? ??? ???. ??? SDXL ??? ?? ??? ?? ??? ?? ??? ????? TensorRT? ???? ? ????.

    ?? ??? ?? ??? ?? ?? ?? ? ?? ?? ??? ?? ??? ?????? ???? ?? ??? ?? ??? ?? ??? ????? ?? ???? ??? ? ????. ? ?? ??? ???? ????? ??? ? ?? ???? ?? ? ?? ???? ??? ?? ??? ??? ? ??? ?????.

    ?? 4. ?? ?? ???? ?? AI ??? ???? NVIDIA Triton

    ??? ?? ??? ?? ??? ???? ???

    NVIDIA AI ?? ???? ??? ???? ???? ???? SDXL? ????? ??? ?? ?? Let’s Enhance? ? ? ????. ? ???? AI ????? 3? ?? Triton Inference Server? ??? NVIDIA Tensor ?? GPU? 30? ??? AI ??? ??? ????.

    ?? Let’s Enhance? SDXL ??? ??? ??? ?? ??? ????? ???? ? ??? ???? ?? ???? ??? ???? ???? ?? ??? AI Photoshoot? ??? ??????.

    ??? ?????? ???? ?? ??? ?? ??? ??? ??? ?? ?? ?? ??? ?? Let’s Enhance? ????? CTO? Vlad Pranskevichus? ML ????? ?? ??? ?????? SDXL ??? ?? AI ?????? ???? ??? ? ???, ?? ? ?? ??? ? ?? ??? ??? ? ?? ?????.

    ???? ?? ??? ?? ? AI ??? ?? ????? SDXL ??? Google Cloud G2 ????? NVIDIA L4 GPU? ???????? ??? 30% ?????, 2024? ???? ?? ?????? ??????? ???? ???? ??????.

    ?? 5. ??? ?? ?? ???? ???? ??? ?? ???

    L4 GPU? TensorRT? ??? SDXL ????

    ?? ????? ??? ?? ?? ??? ?? Google Cloud? G2 ????? TensorRT? ???? ??? SDXL? ???? ???? ??? ????????. NVIDIA ????? ???? Google Cloud?? VM ????? ?????? ?? ??? ????.

    ?? ?? ?? ??? ?????:

    • ?? ??: g2-standard-8
    • CPU ???: ?? ????? ???
    • ?? CPU ???: ??
    • ????? ??: ?????
    • GPU: 1 x NVIDIA L4

    g2-standard-8 ?? ??? NVIDIA L4 GPU 1?? vCPU 4?? ??? ????. ??? ??? ??? ?? ? ? ?? ??? ??? ? ????.

    ?? ?? ??? ??? ???? ?? ???? ???? ??? ?????:

    • ??: ???? ????? ???
    • ??: 500GB
    • ??: us-central1-a
    • ???: None
    • ?? ?: ????-1
    • ??? ??: ??
    • ?? ???: c0-deeplearning-common-gpu
    • ??? ??: Google ??
    • ??? ??: ??

    Google ? ?? VM?? ?? NVIDIA GPU ?????? ???? ????.

    VM ????? ???? ?? ???? ??? ??, SSH, ?? ? ??? ?????. ??? ???? ?? SSH ???? ?????.

    ?? ??? ?? TensorRT? ???? ???? Stable Diffusion XL? ???? ???? ?????.

    TensorRT OSS ?????? ?????:

    https://console.cloud.google.com/marketplace/product/click-to-deploy-images/deeplearning?project=nvidia-ngc-public

    NVIDIA-docker? ???? PyTorch ????? ?????:

    https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker

    ?? TensorRT ???? ?????:

    https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker

    ??? ???? ?????:

    export TRT_OSSPATH=/workspace
    export HF_TOKEN=<your_hf_token_to_download_models>
    cd $TRT_OSSPATH/demo/Diffusion
    pip3 install -r requirements.txt

    ?? “art deco, realistic”??? ????? ?? TensorRT? ???? Stable Diffusion XL ??? ?????:

    python3 demo_txt2img_xl.py "art deco, realistic" --hf-token=$HF_TOKEN --version xl-1.0 --batch-size 1 --build-static-batch --num-warmup-runs 5 --seed 3 --verbose --use-cuda-graph

    ??? ????? ? ? ?? ?? ???? ?????:

    from IPython.display import display
    from PIL import Image
    img = Image.open('output/xl_base-fp16-art_deco,_-1-xxxx.png')
    display(img)
    ?? 6. ?? ??? ?????? ??? ??? ??

    ?????! TensorRT? ???? Stable Diffusion XL? ???? ?? ???? ??????.

    ???? ???? ?? 8?? L4 GPU? ???? ? ? ?? ??? ???? ? GPU? ??? ???? ???? ?? ??? ? ? ????. ? ?? ??? ?? ??? ?? ?? ?, ??? ??? ?? ???? ??? ? ????. ?? ??, ?? ??? ??? ?? ?? ?? 30??? 20?? ??? ?? ??? ???? 1.5? ?????.

    L4 GPU? ?? ?? ??? ?????. ??? ??? ??????? ???? ?? ??? ??? ???? NVIDIA A100 ?? ?? GPU? ?? 1??? 1.4? ? ?? ???? ?????. ??? ?? ??? ??? ???????? L4? ?? A100 ?? H100? ?? 3.8~7.9? ? ??? ???? ????? ? ?? ?????.

    ??? ?? ??, ???, ??? ?? ??, ??? ??? ? ?? ???? ?? ??? ?? ?????. ?? ??? ? ?? ??? ?? ??? ??? /NVIDIA/TensorRT GitHub ?????? DemoDiffusion ??? ?????.

    Triton ?? ??? ???? ??? SDXL ????

    ??? g2-standard-32 ?? ???? Triton ?? ??? ???? ???? ???? SDXL ??? ???? ?????.

    Triton ?? ?? ???? ?????? ?????:

    git clone https://github.com/triton-inference-server/tutorials.git -b r24.02 --single-branch
    cd tutorials/Popular_Models_Guide/StableDiffusion 

    ??? ?? ?? ?? ???? ???? ?????:

    ./build.sh

    ???? ????? ??? ?? ?????. ?? ??? ????? ???? ?? ????? ?? ???? ?? ??????:

    ./run.sh

    Stable Diffusion XL TensorRT ??? ?????. ? ? ?? ????.

    ./scripts/build_models.sh --model stable_diffusion_xl

    ??? ???? ?? ??? ??? ????:

    diffusion-models
     |-- stable_diffusion_xl
        |-- 1
        |   |-- xl-1.0-engine-batch-size-1
        |   |-- xl-1.0-onnx
        |   `-- xl-1.0-pytorch_model
        `-- config.pbtxt

    ??? ?? ??? ?????. ? ????? EXPLICIT ?? ?? ??? ???? ???? Stable Diffusion ??? ?????. ???? ??? ?? ??? ??? ?? ?? ?? ??? ?????.

    tritonserver --model-repository diffusion-models --model-control-mode explicit --load-model stable_diffusion_xl

    ???? ?? ??? ??? ????:

    <SNIP>
    I0229 20:22:22.912465 1440 server.cc:676]
    +---------------------+---------+--------+
    | Model               | Version | Status |
    +---------------------+---------+--------+
    | stable_diffusion_xl | 1       | READY  |
    +---------------------+---------+--------+
    <SNIP>/sy

    ??? ??? ??? ? ????? ???? ?? ??? ?? ?? ?????? ?????. ?? ??? ????? ???? ?? ????? ?? ???? ?? ??????:

    ./run.sh

    Stable Diffusion XL? ????? ????:

    python3 client.py --model stable_diffusion_xl --prompt "butterfly in new york, 4k, realistic" --save-image
    ?? 8. “????? ? ??, 4K, ???” ????? ?? ??? ??? ??

    ?????! ????? SDXL? ????? ??????.

    ??? ?? ??? ??? ?? ?? ??

    ?? Triton ?? ??? ???? ??? ??? ?? max_batch_size ????? ?? ?? ?? ??? ???? ? ????.

    ??? ?? ??? ?? ??? ?????. ??? ??? CTRL-C? ???? ??? ??? ? ????.

    ?? ?? ??? ./diffusion-models/stable_diffusion_xl/config.pbtxt? ???? ?? ??? 2? ????:

    • ??: max_batch_size: 1
    • ??: max_batch_size: 2

    ?? ?? 2? ?? TRT ??? ?? ?????. ? ? ?? ????.

    ./scripts/build_models.sh --model stable_diffusion_xl

    ??? ???? ?? ??? ??? ????:

    diffusion-models
    |-- stable_diffusion_xl
       |-- 1
       |   |-- xl-1.0-engine-batch-size-2
       |   |-- xl-1.0-onnx
       |   `-- xl-1.0-pytorch_model
       `-- config.pbtxt

    ??? ?? ??? ?? ?????:

    tritonserver --model-repository diffusion-models --model-control-mode explicit --load-model stable_diffusion_xl

    ???? ?? ??? ??? ????:

    <SNIP>
    I0229 20:22:22.912465 1440 server.cc:676]
    +---------------------+---------+--------+
    | Model               | Version | Status |
    +---------------------+---------+--------+
    | stable_diffusion_xl | 1       | READY  |
    +---------------------+---------+--------+
    <SNIP>

    ??? ?? ??? ????. ??? ?? ??? ???? ?? ????? ??? ??? ??? ?? ?????? ??? ???. ?? ?????? ???? ????? ?? ?? ?? ?? ??? ??? ??? ? ????.

    python3 client.py --model stable_diffusion_xl --prompt "butterfly in new york, 4k, realistic" --clients 2 –requests 5

    ?? ??? ???? ?????. ?? ?? ??, ?? ??, ?? ?? ??? ???? ? ??? ? ??? ??? ???? ?? ?? ?? ??? TensorRT ??? ?????.

    57291 │ I0229 20:36:23.017339 2146 model.py:184] Client Requests in Batch:2
    57292 │ I0229 20:36:23.017428 2146 model.py:185] Prompts in Batch:2

    ?? 9. NVIDIA Triton ?? ??? ???? SDXL? ??? ??? ??

    ??

    NVIDIA AI ?? ???? SDXL? ???? ??? ?? ???? ????? ?? ???? ???? ?? ? ????.

    TensorRT? Triton Inference Server? ?? ??? ????? ???? ?? ??? ???? ? ???, ?? ???? ???????? ???? NVIDIA AI Enterprise? ??? ???? ????. AI Enterprise? AI ??? ???? ?? ?? ???? ? ?????? ?? ??????? ???, ??, ?? ???? ?? NVIDIA ?? ???? ?????.

    ?? ?????? ???? ?? ???? ??? ??? AI? ?? ????? NVIDIA Picasso? ?? ?? ?? ??? ??, ?? ??, ??? ? ??? ? ????.

    SDXL? NVIDIA AI ????? ??? NGC ????? ??? ????, ?????? ?? SDXL? ??? ??? ? ? ?? ???? ?? ?????? ?????.

    NVIDIA GTC 2024?? ?? ?? ?? ?????? ???? ??? ?? ??? ?????:

    ?? ???

    Discuss (0)
    +1

    Tags

    人人超碰97caoporen国产