-
Notifications
You must be signed in to change notification settings - Fork 111
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
deprecated onediffx.lora #1179
base: main
Are you sure you want to change the base?
deprecated onediffx.lora #1179
Conversation
WalkthroughThe changes focus on marking certain LoRA-related functions and tests as deprecated in the OneDiff library. A new Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
onediff_diffusers_extensions/onediffx/lora/lora.py
(7 hunks)onediff_diffusers_extensions/tests/test_lora.py
(6 hunks)
🧰 Additional context used
🪛 Ruff (0.8.2)
onediff_diffusers_extensions/onediffx/lora/lora.py
49-49: No explicit stacklevel
keyword argument found
(B028)
🔇 Additional comments (12)
onediff_diffusers_extensions/onediffx/lora/lora.py (6)
Line range hint
60-77
: LGTM! Function correctly marked as deprecated.The deprecation marking is appropriate while maintaining the existing functionality.
🧰 Tools
🪛 Ruff (0.8.2)
49-49: No explicit
stacklevel
keyword argument found(B028)
Line range hint
83-203
: LGTM! Function correctly marked as deprecated.The deprecation marking is appropriate while maintaining the existing functionality.
Line range hint
207-224
: LGTM! Function correctly marked as deprecated.The deprecation marking is appropriate while maintaining the existing functionality.
Line range hint
227-268
: LGTM! Function correctly marked as deprecated.The deprecation marking is appropriate while maintaining the existing functionality.
Line range hint
271-297
: LGTM! Function correctly marked as deprecated.The deprecation marking is appropriate while maintaining the existing functionality.
Line range hint
300-305
: LGTM! Function correctly marked as deprecated.The deprecation marking is appropriate while maintaining the existing functionality.
onediff_diffusers_extensions/tests/test_lora.py (6)
39-40
: LGTM! Directory creation check added.The change ensures the test directory exists before running tests.
Line range hint
167-197
: LGTM! Test correctly marked as skipped.The test is appropriately marked as skipped due to the deprecation of onediffx.lora.
Line range hint
198-231
: LGTM! Test correctly marked as skipped.The test is appropriately marked as skipped due to the deprecation of onediffx.lora.
Line range hint
232-242
: LGTM! Test correctly marked as skipped.The test is appropriately marked as skipped due to the deprecation of onediffx.lora.
Line range hint
243-257
: LGTM! Test correctly marked as skipped.The test is appropriately marked as skipped due to the deprecation of onediffx.lora.
Line range hint
258-287
: Consider keeping the numerical stability test active.This test verifies an important aspect of the LoRA implementation - numerical stability after multiple adapter operations. Even though the LoRA functionality is deprecated, this test should remain active until the functionality is completely removed to ensure stability during the deprecation period.
warnings.filterwarnings("always", category=DeprecationWarning) | ||
|
||
def deprecated(): | ||
def decorator(func): | ||
@functools.wraps(func) | ||
def wrapper(*args, **kwargs): | ||
warnings.warn( | ||
f"lora function {func.__name__} is deprecated", | ||
category=DeprecationWarning, | ||
) | ||
return func(*args, **kwargs) | ||
return wrapper | ||
return decorator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Enhance deprecation warning with migration guidance and stacklevel.
The deprecation warning should include guidance on the recommended alternative and use the stacklevel parameter to point to the caller's location.
def deprecated():
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
warnings.warn(
- f"lora function {func.__name__} is deprecated",
+ f"lora function {func.__name__} is deprecated. Please use diffusers.LoraLoaderMixin methods directly.",
category=DeprecationWarning,
+ stacklevel=2
)
return func(*args, **kwargs)
return wrapper
return decorator
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
warnings.filterwarnings("always", category=DeprecationWarning) | |
def deprecated(): | |
def decorator(func): | |
@functools.wraps(func) | |
def wrapper(*args, **kwargs): | |
warnings.warn( | |
f"lora function {func.__name__} is deprecated", | |
category=DeprecationWarning, | |
) | |
return func(*args, **kwargs) | |
return wrapper | |
return decorator | |
warnings.filterwarnings("always", category=DeprecationWarning) | |
def deprecated(): | |
def decorator(func): | |
@functools.wraps(func) | |
def wrapper(*args, **kwargs): | |
warnings.warn( | |
f"lora function {func.__name__} is deprecated. Please use diffusers.LoraLoaderMixin methods directly.", | |
category=DeprecationWarning, | |
stacklevel=2 | |
) | |
return func(*args, **kwargs) | |
return wrapper | |
return decorator |
🧰 Tools
🪛 Ruff (0.8.2)
49-49: No explicit stacklevel
keyword argument found
(B028)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.github/workflows/examples.yml (1)
308-310
: LGTM! Consider adding error handling.The addition of copying the test image file into the ComfyUI input directory is a good enhancement to the test setup.
Consider adding error handling to ensure the
docker cp
command succeeds:- docker cp /src/onediff/tests/comfyui/workflows/input/control/sdxl-unet-control-lora-speedup.png ${{ env.CONTAINER_NAME}}:/app/ComfyUI/input + docker cp /src/onediff/tests/comfyui/workflows/input/control/sdxl-unet-control-lora-speedup.png ${{ env.CONTAINER_NAME}}:/app/ComfyUI/input || { + echo "Failed to copy test image into container" + exit 1 + }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
onediff_diffusers_extensions/examples/requirements.txt (1)
3-3
: Consider aligning version specificationsThe examples use an exact version match (
==0.27.0
) whilesetup.py
uses a minimum version (>=0.27.0
). Consider:
- Using
>=0.27.0
here to matchsetup.py
if the examples should work with future versions- Adding a comment explaining why an exact version is required if
==0.27.0
is intentional
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
onediff_comfy_nodes/benchmarks/resources/workflows/oneflow/sdxl-control-lora-speedup.json
(1 hunks)onediff_diffusers_extensions/examples/requirements.txt
(1 hunks)setup.py
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: diffusers_examples onediff-pro:torch2.3-cuda12.1
- GitHub Check: diffusers_examples onediff:torch2.3-cuda11.8
🔇 Additional comments (2)
onediff_comfy_nodes/benchmarks/resources/workflows/oneflow/sdxl-control-lora-speedup.json (1)
125-125
: Verify the image file location and accessibility.The image path has been simplified from
"control/sdxl-unet-control-lora-speedup.png"
to"sdxl-unet-control-lora-speedup.png"
. Let's ensure this change is consistent and the file is accessible.setup.py (1)
20-20
: Verify compatibility with diffusers 0.27.0The significant version bump from 0.19.3 to 0.27.0 might introduce breaking changes. Please ensure:
- The new version is compatible with the deprecated LoRA functionality
- All dependent features have been tested with this version
Let's check the release notes and potential breaking changes:
✅ Verification successful
Version upgrade to diffusers 0.27.0 is compatible with LoRA functionality
The codebase has robust LoRA support with custom implementations and extensive testing that ensures compatibility across diffusers versions. The version upgrade is safe to proceed with.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check diffusers changelog for breaking changes between 0.19.3 and 0.27.0 # Fetch the changelog curl -s https://raw.githubusercontent.com/huggingface/diffusers/main/CHANGELOG.md | \ awk '/## v0.27.0/,/## v0.19.3/' || echo "Failed to fetch changelog" # Check if there are any existing issues related to this version gh issue list --search "diffusers 0.27.0" --limit 5Length of output: 282
Script:
#!/bin/bash # Search for diffusers imports and usage echo "=== Diffusers imports ===" rg "from diffusers" -l echo -e "\n=== LoRA related code ===" rg "LoRA|lora" -i echo -e "\n=== Diffusers specific class usage ===" rg "diffusers\." -B 1 -A 1Length of output: 73049
Summary by CodeRabbit
Deprecation
Testing
Warning Management
Workflow Enhancements
Dependency Updates
diffusers
package version in bothrequirements.txt
andsetup.py
.