add info about ninstance and license

This commit is contained in:
Anna Alberska 2023-01-05 13:16:23 +01:00
parent 71e90423dc
commit 872cc9e873
11 changed files with 35 additions and 6 deletions

View file

@ -151,26 +151,25 @@ pip install intel-openmp
pip install intel_extension_for_pytorch -f https://software.intel.com/ipex-whl-stable pip install intel_extension_for_pytorch -f https://software.intel.com/ipex-whl-stable
``` ```
To sample from the _SD2.1-v_ model with TorchScript+IPEX optimizations, run the following: To sample from the _SD2.1-v_ model with TorchScript+IPEX optimizations, run the following. Remember to specify desired number of instances you want to run the program on ([more](https://github.com/intel/intel-extension-for-pytorch/blob/master/intel_extension_for_pytorch/cpu/launch.py#L48)).
# TODO HOW TO EXPLAIN -NINSTANCE
``` ```
MALLOC_CONF=oversize_threshold:1,background_thread:true,metadata_thp:auto,dirty_decay_ms:9000000000,muzzy_decay_ms:9000000000 python -m intel_extension_for_pytorch.cpu.launch --ninstance 1 --enable_jemalloc scripts/txt2img.py --prompt \"a corgi is playing guitar, oil on canvas\" --ckpt <path/to/768model.ckpt/> --config configs/stable-diffusion/ipex/v2-inference-v-fp32.yaml --H 768 --W 768 --precision full --device cpu --torchscript --ipex MALLOC_CONF=oversize_threshold:1,background_thread:true,metadata_thp:auto,dirty_decay_ms:9000000000,muzzy_decay_ms:9000000000 python -m intel_extension_for_pytorch.cpu.launch --ninstance <number of an instance> --enable_jemalloc scripts/txt2img.py --prompt \"a corgi is playing guitar, oil on canvas\" --ckpt <path/to/768model.ckpt/> --config configs/stable-diffusion/ipex/v2-inference-v-fp32.yaml --H 768 --W 768 --precision full --device cpu --torchscript --ipex
``` ```
To sample from the base model with IPEX optimizations, use To sample from the base model with IPEX optimizations, use
``` ```
MALLOC_CONF=oversize_threshold:1,background_thread:true,metadata_thp:auto,dirty_decay_ms:9000000000,muzzy_decay_ms:9000000000 python -m intel_extension_for_pytorch.cpu.launch --ninstance 1 --enable_jemalloc scripts/txt2img.py --prompt \"a corgi is playing guitar, oil on canvas\" --ckpt <path/to/model.ckpt/> --config configs/stable-diffusion/ipex/v2-inference-fp32.yaml --n_samples 1 --n_iter 4 --precision full --device cpu --torchscript --ipex MALLOC_CONF=oversize_threshold:1,background_thread:true,metadata_thp:auto,dirty_decay_ms:9000000000,muzzy_decay_ms:9000000000 python -m intel_extension_for_pytorch.cpu.launch --ninstance <number of an instance> --enable_jemalloc scripts/txt2img.py --prompt \"a corgi is playing guitar, oil on canvas\" --ckpt <path/to/model.ckpt/> --config configs/stable-diffusion/ipex/v2-inference-fp32.yaml --n_samples 1 --n_iter 4 --precision full --device cpu --torchscript --ipex
``` ```
If you're using a CPU that supports `bfloat16`, consider sample from the model with bfloat16 enabled for a performance boost, like so If you're using a CPU that supports `bfloat16`, consider sample from the model with bfloat16 enabled for a performance boost, like so
```bash ```bash
# SD2.1-v # SD2.1-v
MALLOC_CONF=oversize_threshold:1,background_thread:true,metadata_thp:auto,dirty_decay_ms:9000000000,muzzy_decay_ms:9000000000 python -m intel_extension_for_pytorch.cpu.launch --ninstance 1 --enable_jemalloc scripts/txt2img.py --prompt \"a corgi is playing guitar, oil on canvas\" --ckpt <path/to/768model.ckpt/> --config configs/stable-diffusion/ipex/v2-inference-v-bf16.yaml --H 768 --W 768 --precision full --device cpu --torchscript --ipex --bf16 MALLOC_CONF=oversize_threshold:1,background_thread:true,metadata_thp:auto,dirty_decay_ms:9000000000,muzzy_decay_ms:9000000000 python -m intel_extension_for_pytorch.cpu.launch --ninstance <number of an instance> --enable_jemalloc scripts/txt2img.py --prompt \"a corgi is playing guitar, oil on canvas\" --ckpt <path/to/768model.ckpt/> --config configs/stable-diffusion/ipex/v2-inference-v-bf16.yaml --H 768 --W 768 --precision full --device cpu --torchscript --ipex --bf16
# SD2.1-base # SD2.1-base
MALLOC_CONF=oversize_threshold:1,background_thread:true,metadata_thp:auto,dirty_decay_ms:9000000000,muzzy_decay_ms:9000000000 python -m intel_extension_for_pytorch.cpu.launch --ninstance 1 --enable_jemalloc scripts/txt2img.py --prompt \"a corgi is playing guitar, oil on canvas\" --ckpt <path/to/model.ckpt/> --config configs/stable-diffusion/ipex/v2-inference-bf16.yaml --precision full --device cpu --torchscript --ipex --bf16 MALLOC_CONF=oversize_threshold:1,background_thread:true,metadata_thp:auto,dirty_decay_ms:9000000000,muzzy_decay_ms:9000000000 python -m intel_extension_for_pytorch.cpu.launch --ninstance <number of an instance> --enable_jemalloc scripts/txt2img.py --prompt \"a corgi is playing guitar, oil on canvas\" --ckpt <path/to/model.ckpt/> --config configs/stable-diffusion/ipex/v2-inference-bf16.yaml --precision full --device cpu --torchscript --ipex --bf16
``` ```
### Image Modification with Stable Diffusion ### Image Modification with Stable Diffusion

View file

@ -1,3 +1,6 @@
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: MIT
model: model:
base_learning_rate: 1.0e-4 base_learning_rate: 1.0e-4
target: ldm.models.diffusion.ddpm.LatentDiffusion target: ldm.models.diffusion.ddpm.LatentDiffusion

View file

@ -1,3 +1,6 @@
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: MIT
model: model:
base_learning_rate: 1.0e-4 base_learning_rate: 1.0e-4
target: ldm.models.diffusion.ddpm.LatentDiffusion target: ldm.models.diffusion.ddpm.LatentDiffusion

View file

@ -1,3 +1,6 @@
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: MIT
model: model:
base_learning_rate: 1.0e-4 base_learning_rate: 1.0e-4
target: ldm.models.diffusion.ddpm.LatentDiffusion target: ldm.models.diffusion.ddpm.LatentDiffusion

View file

@ -1,3 +1,6 @@
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: MIT
model: model:
base_learning_rate: 1.0e-4 base_learning_rate: 1.0e-4
target: ldm.models.diffusion.ddpm.LatentDiffusion target: ldm.models.diffusion.ddpm.LatentDiffusion

View file

@ -1,3 +1,6 @@
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: MIT
"""SAMPLING ONLY.""" """SAMPLING ONLY."""
import torch import torch

View file

@ -1,3 +1,6 @@
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: MIT
""" """
wild mixture of wild mixture of
https://github.com/lucidrains/denoising-diffusion-pytorch/blob/7706bdfc6f527f58d33f84b7b522e61e6e3164b3/denoising_diffusion_pytorch/denoising_diffusion_pytorch.py https://github.com/lucidrains/denoising-diffusion-pytorch/blob/7706bdfc6f527f58d33f84b7b522e61e6e3164b3/denoising_diffusion_pytorch/denoising_diffusion_pytorch.py

View file

@ -1,3 +1,6 @@
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: MIT
"""SAMPLING ONLY.""" """SAMPLING ONLY."""
import torch import torch

View file

@ -1,3 +1,6 @@
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: MIT
"""SAMPLING ONLY.""" """SAMPLING ONLY."""
import torch import torch

View file

@ -1,3 +1,6 @@
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: MIT
from abc import abstractmethod from abc import abstractmethod
import math import math

View file

@ -1,3 +1,6 @@
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: MIT
import argparse, os import argparse, os
import cv2 import cv2
import torch import torch