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

Add Lora support to stable diffusion #483

Merged
merged 5 commits into from
Feb 28, 2024
Merged

Add Lora support to stable diffusion #483

merged 5 commits into from
Feb 28, 2024

Conversation

JingyaHuang
Copy link
Collaborator

What does this PR do?

  • Support tracing (one or multiple) lora weights through cli / exporter / Neuron modeling API
  • Add tests

Example:

  • Tiny
optimum-cli export neuron -m hf-internal-testing/tiny-stable-diffusion-torch --task stable-diffusion --batch_size 1 --height 64 --width 64 --num_images_per_prompt 4 --auto_cast matmul --lora_model_ids Jingya/tiny-stable-diffusion-lora-64 --lora_weight_names pytorch_lora_weights.safetensors --lora_adapter_names poke --lora_scales 0.9 --auto_cast_type bf16 tiny_sd_neuron_lora/
  • sdxl
optimum-cli export neuron -m stabilityai/stable-diffusion-xl-base-1.0 --task stable-diffusion-xl --batch_size 1 --height 1024 --width 1024 --num_images_per_prompt 4 --auto_cast matmul --lora_model_ids CiroN2022/toy-face --lora_weight_names toy_face_sdxl.safetensors --lora_adapter_names toy --lora_scales 0.9 --auto_cast_type bf16 sd_neuron_lora_xl/

Next:

Add examples and doc.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

optimum/commands/export/neuronx.py Outdated Show resolved Hide resolved
optimum/commands/export/neuronx.py Outdated Show resolved Hide resolved
optimum/commands/export/neuronx.py Outdated Show resolved Hide resolved
optimum/commands/export/neuronx.py Outdated Show resolved Hide resolved
optimum/commands/export/neuronx.py Outdated Show resolved Hide resolved
optimum/exporters/neuron/utils.py Outdated Show resolved Hide resolved
Copy link
Member

@michaelbenayoun michaelbenayoun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JingyaHuang JingyaHuang merged commit d02965b into main Feb 28, 2024
15 checks passed
@JingyaHuang JingyaHuang deleted the lora-support branch February 28, 2024 14:23
@JingyaHuang JingyaHuang mentioned this pull request Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants