Repository: huggingface/diffusers (branch: ipadapterfaceid)
Commit date: 2024-01-10T20:03:01Z

Workflow file: .github/workflows/pr_quality.yml (Run code quality checks)
name: Run code quality checks

on:
  pull_request:
    branches:
      - main
  push:
    branches:
      - main

concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

jobs:
  check_code_quality:
    runs-on: ubuntu-latest
    services:
      pypi_wayback:
        image: ghcr.io/waleko/pypi-wayback
        ports:
          - 8629:8080
    steps:
      - uses: actions/checkout@v3
      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: "3.8"
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install .[quality]
      - name: Check quality
        run: |
          ruff check examples tests src utils scripts
          ruff format examples tests src utils scripts --check

  check_repository_consistency:
    runs-on: ubuntu-latest
    services:
      pypi_wayback:
        image: ghcr.io/waleko/pypi-wayback
        ports:
          - 8629:8080
    steps:
      - uses: actions/checkout@v3
      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: "3.8"
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install .[quality]
      - name: Check quality
        run: |
          python utils/check_copies.py
          python utils/check_dummies.py
          make deps_table_check_updated

env:
  PIP_INDEX_URL: http://localhost:8629/2024-01-10
  UV_INDEX_URL: http://localhost:8629/2024-01-10


Failed build logs:
step_name: check_code_quality/5_Check quality.txt
log: ##[group]Run ruff check examples tests src utils scripts
[36;1mruff check examples tests src utils scripts[0m
[36;1mruff format examples tests src utils scripts --check[0m
shell: /usr/bin/bash -e {0}
env:
  pythonLocation: /opt/actions-runner/_work/_tool/Python/3.8.18/x64
  PKG_CONFIG_PATH: /opt/actions-runner/_work/_tool/Python/3.8.18/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/actions-runner/_work/_tool/Python/3.8.18/x64
  Python2_ROOT_DIR: /opt/actions-runner/_work/_tool/Python/3.8.18/x64
  Python3_ROOT_DIR: /opt/actions-runner/_work/_tool/Python/3.8.18/x64
  LD_LIBRARY_PATH: /opt/actions-runner/_work/_tool/Python/3.8.18/x64/lib
##[endgroup]
examples/community/ip_adapter_face_id.py:15:1: I001 [*] Import block is un-sorted or un-formatted
Found 1 error.
[*] 1 fixable with the `--fix` option.
##[error]Process completed with exit code 1.


Changed files:
examples/community/README.md
examples/community/ip_adapter_face_id.py

Fix diff:
diff --git a/examples/community/README.md b/examples/community/README.md
index f205f3b70..2fdbdb414 100755
--- a/examples/community/README.md
+++ b/examples/community/README.md
@@ -3307,7 +3307,7 @@ pipeline = DiffusionPipeline.from_pretrained(
     torch_dtype=torch.float16,
     scheduler=noise_scheduler,
     vae=vae,
-    custom_pipeline="./forked/diffusers/examples/community/ip_adapter_face_id.py"
+    custom_pipeline="ip_adapter_face_id"
 )
 pipeline.load_ip_adapter_face_id("h94/IP-Adapter-FaceID", "ip-adapter-faceid_sd15.bin")
 pipeline.to("cuda")
diff --git a/examples/community/ip_adapter_face_id.py b/examples/community/ip_adapter_face_id.py
index e3c5a2c84..d9325742c 100644
--- a/examples/community/ip_adapter_face_id.py
+++ b/examples/community/ip_adapter_face_id.py
@@ -14,12 +14,12 @@
 
 import inspect
 from typing import Any, Callable, Dict, List, Optional, Union
-from safetensors import safe_open
 
 import torch
 import torch.nn as nn
 import torch.nn.functional as F
 from packaging import version
+from safetensors import safe_open
 from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, CLIPVisionModelWithProjection
 
 from diffusers.configuration_utils import FrozenDict
@@ -27,20 +27,20 @@ from diffusers.image_processor import VaeImageProcessor
 from diffusers.loaders import FromSingleFileMixin, IPAdapterMixin, LoraLoaderMixin, TextualInversionLoaderMixin
 from diffusers.models import AutoencoderKL, UNet2DConditionModel
 from diffusers.models.attention_processor import FusedAttnProcessor2_0
-from diffusers.models.lora import adjust_lora_scale_text_encoder, LoRALinearLayer
+from diffusers.models.lora import LoRALinearLayer, adjust_lora_scale_text_encoder
+from diffusers.pipelines.pipeline_utils import DiffusionPipeline
+from diffusers.pipelines.stable_diffusion.pipeline_output import StableDiffusionPipelineOutput
+from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker
 from diffusers.schedulers import KarrasDiffusionSchedulers
 from diffusers.utils import (
-    _get_model_file,
     USE_PEFT_BACKEND,
+    _get_model_file,
     deprecate,
     logging,
     scale_lora_layers,
     unscale_lora_layers,
 )
 from diffusers.utils.torch_utils import randn_tensor
-from diffusers.pipelines.pipeline_utils import DiffusionPipeline
-from diffusers.pipelines.stable_diffusion.pipeline_output import StableDiffusionPipelineOutput
-from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker
 
 
 logger = logging.get_logger(__name__)  # pylint: disable=invalid-name
@@ -555,7 +555,7 @@ class IPAdapterFaceIDStableDiffusionPipeline(
             revision=revision,
             subfolder=subfolder,
             user_agent=user_agent,
-            )
+        )
         if weight_name.endswith(".safetensors"):
             state_dict = {"image_proj": {}, "ip_adapter": {}}
             with safe_open(model_file, framework="pt", device="cpu") as f:
@@ -1438,7 +1438,7 @@ class IPAdapterFaceIDStableDiffusionPipeline(
         extra_step_kwargs = self.prepare_extra_step_kwargs(generator, eta)
 
         # 6.1 Add image embeds for IP-Adapter
-        added_cond_kwargs ={"image_embeds": image_embeds} if image_embeds is not None else None
+        added_cond_kwargs = {"image_embeds": image_embeds} if image_embeds is not None else None
 
         # 6.2 Optionally get Guidance Scale Embedding
         timestep_cond = None