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

[DO NOT MERGE] Restore non-inlined SDXL #668

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
7 changes: 0 additions & 7 deletions optimum/exporters/neuron/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,6 @@ def export_models(
output_path.parent.mkdir(parents=True, exist_ok=True)

try:
# TODO: Remove after the weights/neff separation compilation of sdxl is patched by a neuron sdk release: https://github.com/aws-neuron/aws-neuron-sdk/issues/859
if not inline_weights_to_neff and getattr(sub_neuron_config, "is_sdxl", False):
logger.warning(
"The compilation of SDXL's unet with the weights/neff separation is broken since the Neuron sdk 2.18 release. `inline_weights_to_neff` will be set to True and the caching will be disabled. If you still want to separate the neff and weights, please downgrade your Neuron setup to the 2.17.1 release."
)
inline_weights_to_neff = True

start_time = time.time()
neuron_inputs, neuron_outputs = export(
model=submodel,
Expand Down
32 changes: 32 additions & 0 deletions tests/cli/test_export_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,38 @@ def test_stable_diffusion_single_controlnet(self):

@requires_neuronx
def test_stable_diffusion_xl(self):
model_id = "echarlaix/tiny-random-stable-diffusion-xl"
with tempfile.TemporaryDirectory() as tempdir:
subprocess.run(
[
"optimum-cli",
"export",
"neuron",
"--model",
model_id,
"--inline-weights-neff",
"--task",
"stable-diffusion-xl",
"--batch_size",
"1",
"--height",
"64",
"--width",
"64",
"--num_images_per_prompt",
"4",
"--auto_cast",
"matmul",
"--auto_cast_type",
"bf16",
tempdir,
],
shell=False,
check=True,
)

@requires_neuronx
def test_stable_diffusion_xl_non_inlined(self):
model_id = "echarlaix/tiny-random-stable-diffusion-xl"
with tempfile.TemporaryDirectory() as tempdir:
subprocess.run(
Expand Down
Loading