Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for diffusers 0.21.0 release #229

Merged
merged 5 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions optimum/exporters/neuron/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.
"""Neuron compiled model check and export functions."""
import copy
import os
import time
from collections import OrderedDict
from pathlib import Path
Expand Down Expand Up @@ -438,10 +437,6 @@ def export_neuronx(
else:
compiler_args = ["--auto-cast", "none"]

# WARNING: Enabled experimental parallel compilation
compiler_args.extend(["--enable-experimental-O1"])
compiler_args.extend(["--num-parallel-jobs", str(os.cpu_count())])

# diffusers specific
compiler_args = add_stable_diffusion_compiler_args(config, compiler_args)

Expand Down
19 changes: 14 additions & 5 deletions optimum/neuron/pipelines/diffusers/pipeline_stable_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,20 @@
from typing import Any, Callable, Dict, List, Optional, Union

import torch
from diffusers import StableDiffusionPipeline
from diffusers.loaders import LoraLoaderMixin, TextualInversionLoaderMixin
from diffusers.pipelines.stable_diffusion import StableDiffusionPipelineOutput
from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion import rescale_noise_cfg
from diffusers.utils import randn_tensor

from ....utils import is_diffusers_available


if is_diffusers_available():
from diffusers import StableDiffusionPipeline
from diffusers.loaders import LoraLoaderMixin, TextualInversionLoaderMixin
from diffusers.pipelines.stable_diffusion import StableDiffusionPipelineOutput
from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion import rescale_noise_cfg
from diffusers.utils.torch_utils import randn_tensor
JingyaHuang marked this conversation as resolved.
Show resolved Hide resolved
else:
raise ImportError(
"Stable diffusion requires the diffusers library but it was not found in your environment. You can install it with pip: `pip install diffusers`. Please note that you may need to restart your runtime after installation."
)


logger = logging.getLogger(__name__)
Expand Down
19 changes: 14 additions & 5 deletions optimum/neuron/pipelines/diffusers/pipeline_stable_diffusion_xl.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,20 @@
from typing import Any, Callable, Dict, List, Optional, Tuple, Union

import torch
from diffusers import StableDiffusionXLPipeline
from diffusers.loaders import LoraLoaderMixin, TextualInversionLoaderMixin
from diffusers.pipelines.stable_diffusion_xl import StableDiffusionXLPipelineOutput
from diffusers.pipelines.stable_diffusion_xl.pipeline_stable_diffusion_xl import rescale_noise_cfg
from diffusers.utils import randn_tensor

from ....utils import is_diffusers_available


if is_diffusers_available():
from diffusers import StableDiffusionXLPipeline
from diffusers.loaders import LoraLoaderMixin, TextualInversionLoaderMixin
from diffusers.pipelines.stable_diffusion_xl import StableDiffusionXLPipelineOutput
from diffusers.pipelines.stable_diffusion_xl.pipeline_stable_diffusion_xl import rescale_noise_cfg
from diffusers.utils.torch_utils import randn_tensor
else:
raise ImportError(
JingyaHuang marked this conversation as resolved.
Show resolved Hide resolved
"Stable diffusion XL requires the diffusers library but it was not found in your environment. You can install it with pip: `pip install diffusers`. Please note that you may need to restart your runtime after installation."
)


logger = logging.getLogger(__name__)
Expand Down
Loading