From 06353cbf60eed8f58a86a01b4b9f49f6e9640c1e Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Wed, 13 May 2026 16:09:00 +0900 Subject: [PATCH 1/4] add serge reviewer to enable claude for inline reviews. --- .claude/settings.local.json | 15 +++++ .github/workflows/serge_review.yml | 66 +++++++++++++++++++ .../controlnet_flux/test_controlnet_flux.py | 4 +- .../test_controlnet_hunyuandit.py | 4 +- .../test_controlnet_inpaint_sd3.py | 6 +- .../controlnet_sd3/test_controlnet_sd3.py | 4 +- 6 files changed, 90 insertions(+), 9 deletions(-) create mode 100644 .claude/settings.local.json create mode 100644 .github/workflows/serge_review.yml diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 000000000000..e4849704d499 --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,15 @@ +{ + "permissions": { + "allow": [ + "Bash(CUDA_VISIBLE_DEVICES=\"\" python -m pytest tests/pipelines/controlnet_sd3/test_controlnet_sd3.py::StableDiffusion3ControlNetPipelineFastTests::test_controlnet_sd3 -x)", + "Bash(CUDA_VISIBLE_DEVICES=\"\" python *)", + "Bash(DIFFUSERS_TEST_DEVICE=cpu python -m pytest tests/pipelines/controlnet_sd3/test_controlnet_sd3.py::StableDiffusion3ControlNetPipelineFastTests::test_controlnet_sd3 -x)", + "Bash(pip show *)", + "Bash(CUDA_VISIBLE_DEVICES=\"\" DIFFUSERS_TEST_DEVICE=cpu python -m pytest tests/pipelines/controlnet_sd3/test_controlnet_sd3.py::StableDiffusion3ControlNetPipelineFastTests::test_controlnet_sd35 tests/pipelines/controlnet_flux/test_controlnet_flux.py::FluxControlNetPipelineFastTests::test_controlnet_flux tests/pipelines/controlnet_hunyuandit/test_controlnet_hunyuandit.py::HunyuanDiTControlNetPipelineFastTests::test_controlnet_hunyuandit tests/pipelines/controlnet_sd3/test_controlnet_inpaint_sd3.py::StableDiffusion3ControlInpaintNetPipelineFastTests::test_controlnet_inpaint_sd3)", + "Bash(python *)", + "Bash(DIFFUSERS_TEST_DEVICE=cpu python -m pytest tests/pipelines/controlnet_sd3/test_controlnet_sd3.py::StableDiffusion3ControlNetPipelineFastTests::test_controlnet_sd35 -x)", + "Bash(DIFFUSERS_TEST_DEVICE=cpu python -m pytest tests/pipelines/controlnet_flux/test_controlnet_flux.py::FluxControlNetPipelineFastTests::test_controlnet_flux -x)", + "Bash(DIFFUSERS_TEST_DEVICE=cpu python -m pytest tests/pipelines/controlnet_hunyuandit/test_controlnet_hunyuandit.py::HunyuanDiTControlNetPipelineFastTests::test_controlnet_hunyuandit -x)" + ] + } +} diff --git a/.github/workflows/serge_review.yml b/.github/workflows/serge_review.yml new file mode 100644 index 000000000000..c637736ef1a3 --- /dev/null +++ b/.github/workflows/serge_review.yml @@ -0,0 +1,66 @@ +name: Claude AI Review with inline comments + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + +permissions: + contents: read + pull-requests: write + issues: read + +jobs: + claude-ai-review: + if: | + ( + github.event_name == 'issue_comment' && + github.event.issue.pull_request && + github.event.issue.state == 'open' && + contains(github.event.comment.body, '@claude') && + (github.event.comment.author_association == 'MEMBER' || + github.event.comment.author_association == 'OWNER' || + github.event.comment.author_association == 'COLLABORATOR') + ) || ( + github.event_name == 'pull_request_review_comment' && + contains(github.event.comment.body, '@claude') && + (github.event.comment.author_association == 'MEMBER' || + github.event.comment.author_association == 'OWNER' || + github.event.comment.author_association == 'COLLABORATOR') + ) + concurrency: + group: claude-ai-review-${{ github.event.issue.number || github.event.pull_request.number }} + cancel-in-progress: false + runs-on: ubuntu-latest + steps: + - name: Resolve PR number + id: pr + run: | + NUM="${{ github.event.issue.number || github.event.pull_request.number }}" + echo "number=${NUM}" >> "$GITHUB_OUTPUT" + + - name: Check out PR head (shallow) + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: refs/pull/${{ steps.pr.outputs.number }}/head + fetch-depth: 1 + + - name: Strip fork-supplied reviewer/agent config + # ai-reviewer fetches its config (.ai/review-rules.md, .ai/review-tools.json, + # .ai/context-script) from the base repo's default branch via the GitHub + # Contents API, so wiping the fork's local copies does not affect rule + # loading. The wipe matters because the action also exposes read-only + # browse tools (read_file/list_dir/grep) rooted at the PR-head checkout — + # without this step a fork could ship its own .ai/review-tools.json or + # .ai/context-script and surface them to the LLM. .claude/ + CLAUDE.md + # are wiped for parity with the hardening in claude_review.yml. + run: rm -rf .ai/ .claude/ CLAUDE.md + + - uses: tarekziade/ai-reviewer@main + with: + llm_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + llm_api_base: https://api.anthropic.com + llm_model: claude-opus-4-6 + llm_stream: 'true' + mention_trigger: '@claude' diff --git a/tests/pipelines/controlnet_flux/test_controlnet_flux.py b/tests/pipelines/controlnet_flux/test_controlnet_flux.py index 8607cd6944d9..4d5471571d04 100644 --- a/tests/pipelines/controlnet_flux/test_controlnet_flux.py +++ b/tests/pipelines/controlnet_flux/test_controlnet_flux.py @@ -143,7 +143,7 @@ def get_dummy_inputs(self, device, seed=0): (1, 3, 32, 32), generator=generator, device=torch.device(device), - dtype=torch.float16, + dtype=torch.float32, ) controlnet_conditioning_scale = 0.5 @@ -163,7 +163,7 @@ def get_dummy_inputs(self, device, seed=0): def test_controlnet_flux(self): components = self.get_dummy_components() flux_pipe = FluxControlNetPipeline(**components) - flux_pipe = flux_pipe.to(torch_device, dtype=torch.float16) + flux_pipe = flux_pipe.to(torch_device, dtype=torch.float32) flux_pipe.set_progress_bar_config(disable=None) inputs = self.get_dummy_inputs(torch_device) diff --git a/tests/pipelines/controlnet_hunyuandit/test_controlnet_hunyuandit.py b/tests/pipelines/controlnet_hunyuandit/test_controlnet_hunyuandit.py index 034ef56b0fd3..d7cfc5c91556 100644 --- a/tests/pipelines/controlnet_hunyuandit/test_controlnet_hunyuandit.py +++ b/tests/pipelines/controlnet_hunyuandit/test_controlnet_hunyuandit.py @@ -126,7 +126,7 @@ def get_dummy_inputs(self, device, seed=0): (1, 3, 16, 16), generator=generator, device=torch.device(device), - dtype=torch.float16, + dtype=torch.float32, ) controlnet_conditioning_scale = 0.5 @@ -146,7 +146,7 @@ def get_dummy_inputs(self, device, seed=0): def test_controlnet_hunyuandit(self): components = self.get_dummy_components() pipe = HunyuanDiTControlNetPipeline(**components) - pipe = pipe.to(torch_device, dtype=torch.float16) + pipe = pipe.to(torch_device, dtype=torch.float32) pipe.set_progress_bar_config(disable=None) inputs = self.get_dummy_inputs(torch_device) diff --git a/tests/pipelines/controlnet_sd3/test_controlnet_inpaint_sd3.py b/tests/pipelines/controlnet_sd3/test_controlnet_inpaint_sd3.py index 072f9aa405d9..4c00eefdbc60 100644 --- a/tests/pipelines/controlnet_sd3/test_controlnet_inpaint_sd3.py +++ b/tests/pipelines/controlnet_sd3/test_controlnet_inpaint_sd3.py @@ -156,14 +156,14 @@ def get_dummy_inputs(self, device, seed=0): (1, 3, 32, 32), generator=generator, device=torch.device(device), - dtype=torch.float16, + dtype=torch.float32, ) control_mask = randn_tensor( (1, 1, 32, 32), generator=generator, device=torch.device(device), - dtype=torch.float16, + dtype=torch.float32, ) controlnet_conditioning_scale = 0.95 @@ -184,7 +184,7 @@ def get_dummy_inputs(self, device, seed=0): def test_controlnet_inpaint_sd3(self): components = self.get_dummy_components() sd_pipe = StableDiffusion3ControlNetInpaintingPipeline(**components) - sd_pipe = sd_pipe.to(torch_device, dtype=torch.float16) + sd_pipe = sd_pipe.to(torch_device, dtype=torch.float32) sd_pipe.set_progress_bar_config(disable=None) inputs = self.get_dummy_inputs(torch_device) diff --git a/tests/pipelines/controlnet_sd3/test_controlnet_sd3.py b/tests/pipelines/controlnet_sd3/test_controlnet_sd3.py index 46b08cf1f00b..1a37eb0c245d 100644 --- a/tests/pipelines/controlnet_sd3/test_controlnet_sd3.py +++ b/tests/pipelines/controlnet_sd3/test_controlnet_sd3.py @@ -173,7 +173,7 @@ def get_dummy_inputs(self, device, seed=0): (1, 3, 32, 32), generator=generator, device=torch.device(device), - dtype=torch.float16, + dtype=torch.float32, ) controlnet_conditioning_scale = 0.5 @@ -192,7 +192,7 @@ def get_dummy_inputs(self, device, seed=0): def run_pipe(self, components, use_sd35=False): sd_pipe = StableDiffusion3ControlNetPipeline(**components) - sd_pipe = sd_pipe.to(torch_device, dtype=torch.float16) + sd_pipe = sd_pipe.to(torch_device, dtype=torch.float32) sd_pipe.set_progress_bar_config(disable=None) inputs = self.get_dummy_inputs(torch_device) From 31b949d323e4dda4772f59c57b9c0e9e8bbbf2bc Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Wed, 13 May 2026 16:09:15 +0900 Subject: [PATCH 2/4] remove local settings --- .claude/settings.local.json | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .claude/settings.local.json diff --git a/.claude/settings.local.json b/.claude/settings.local.json deleted file mode 100644 index e4849704d499..000000000000 --- a/.claude/settings.local.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "permissions": { - "allow": [ - "Bash(CUDA_VISIBLE_DEVICES=\"\" python -m pytest tests/pipelines/controlnet_sd3/test_controlnet_sd3.py::StableDiffusion3ControlNetPipelineFastTests::test_controlnet_sd3 -x)", - "Bash(CUDA_VISIBLE_DEVICES=\"\" python *)", - "Bash(DIFFUSERS_TEST_DEVICE=cpu python -m pytest tests/pipelines/controlnet_sd3/test_controlnet_sd3.py::StableDiffusion3ControlNetPipelineFastTests::test_controlnet_sd3 -x)", - "Bash(pip show *)", - "Bash(CUDA_VISIBLE_DEVICES=\"\" DIFFUSERS_TEST_DEVICE=cpu python -m pytest tests/pipelines/controlnet_sd3/test_controlnet_sd3.py::StableDiffusion3ControlNetPipelineFastTests::test_controlnet_sd35 tests/pipelines/controlnet_flux/test_controlnet_flux.py::FluxControlNetPipelineFastTests::test_controlnet_flux tests/pipelines/controlnet_hunyuandit/test_controlnet_hunyuandit.py::HunyuanDiTControlNetPipelineFastTests::test_controlnet_hunyuandit tests/pipelines/controlnet_sd3/test_controlnet_inpaint_sd3.py::StableDiffusion3ControlInpaintNetPipelineFastTests::test_controlnet_inpaint_sd3)", - "Bash(python *)", - "Bash(DIFFUSERS_TEST_DEVICE=cpu python -m pytest tests/pipelines/controlnet_sd3/test_controlnet_sd3.py::StableDiffusion3ControlNetPipelineFastTests::test_controlnet_sd35 -x)", - "Bash(DIFFUSERS_TEST_DEVICE=cpu python -m pytest tests/pipelines/controlnet_flux/test_controlnet_flux.py::FluxControlNetPipelineFastTests::test_controlnet_flux -x)", - "Bash(DIFFUSERS_TEST_DEVICE=cpu python -m pytest tests/pipelines/controlnet_hunyuandit/test_controlnet_hunyuandit.py::HunyuanDiTControlNetPipelineFastTests::test_controlnet_hunyuandit -x)" - ] - } -} From 8d21c973eda660dd8e62c1d8647db03958fa3073 Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Wed, 13 May 2026 16:13:38 +0900 Subject: [PATCH 3/4] fix controlnet test failures. --- tests/pipelines/controlnet_flux/test_controlnet_flux.py | 4 +--- .../controlnet_hunyuandit/test_controlnet_hunyuandit.py | 9 +-------- .../controlnet_sd3/test_controlnet_inpaint_sd3.py | 4 +--- tests/pipelines/controlnet_sd3/test_controlnet_sd3.py | 4 ++-- 4 files changed, 5 insertions(+), 16 deletions(-) diff --git a/tests/pipelines/controlnet_flux/test_controlnet_flux.py b/tests/pipelines/controlnet_flux/test_controlnet_flux.py index 4d5471571d04..8208a79904ed 100644 --- a/tests/pipelines/controlnet_flux/test_controlnet_flux.py +++ b/tests/pipelines/controlnet_flux/test_controlnet_flux.py @@ -174,9 +174,7 @@ def test_controlnet_flux(self): assert image.shape == (1, 32, 32, 3) - expected_slice = np.array( - [0.47387695, 0.63134766, 0.5605469, 0.61621094, 0.7207031, 0.7089844, 0.70410156, 0.6113281, 0.64160156] - ) + expected_slice = np.array([0.6677, 0.6138, 0.5296, 0.6109, 0.5672, 0.6373, 0.5463, 0.6068, 0.5569]) assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2, ( f"Expected: {expected_slice}, got: {image_slice.flatten()}" diff --git a/tests/pipelines/controlnet_hunyuandit/test_controlnet_hunyuandit.py b/tests/pipelines/controlnet_hunyuandit/test_controlnet_hunyuandit.py index d7cfc5c91556..1f765a1675ae 100644 --- a/tests/pipelines/controlnet_hunyuandit/test_controlnet_hunyuandit.py +++ b/tests/pipelines/controlnet_hunyuandit/test_controlnet_hunyuandit.py @@ -156,14 +156,7 @@ def test_controlnet_hunyuandit(self): image_slice = image[0, -3:, -3:, -1] assert image.shape == (1, 16, 16, 3) - if torch_device == "xpu": - expected_slice = np.array( - [0.6948242, 0.89160156, 0.59375, 0.5078125, 0.57910156, 0.6035156, 0.58447266, 0.53564453, 0.52246094] - ) - else: - expected_slice = np.array( - [0.6953125, 0.89208984, 0.59375, 0.5078125, 0.5786133, 0.6035156, 0.5839844, 0.53564453, 0.52246094] - ) + expected_slice = np.array([0.5925, 0.5392, 0.4450, 0.7140, 0.3954, 0.3553, 0.3842, 0.5994, 0.3765]) assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2, ( f"Expected: {expected_slice}, got: {image_slice.flatten()}" diff --git a/tests/pipelines/controlnet_sd3/test_controlnet_inpaint_sd3.py b/tests/pipelines/controlnet_sd3/test_controlnet_inpaint_sd3.py index 4c00eefdbc60..28abf122c41b 100644 --- a/tests/pipelines/controlnet_sd3/test_controlnet_inpaint_sd3.py +++ b/tests/pipelines/controlnet_sd3/test_controlnet_inpaint_sd3.py @@ -195,9 +195,7 @@ def test_controlnet_inpaint_sd3(self): assert image.shape == (1, 32, 32, 3) - expected_slice = np.array( - [0.51708984, 0.7421875, 0.4580078, 0.6435547, 0.65625, 0.43603516, 0.5151367, 0.65722656, 0.60839844] - ) + expected_slice = np.array([0.2875, 0.3173, 0.4028, 0.7248, 0.6338, 0.4238, 0.1730, 0.4609, 0.5424]) assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2, ( f"Expected: {expected_slice}, got: {image_slice.flatten()}" diff --git a/tests/pipelines/controlnet_sd3/test_controlnet_sd3.py b/tests/pipelines/controlnet_sd3/test_controlnet_sd3.py index 1a37eb0c245d..4c8e80d38bfa 100644 --- a/tests/pipelines/controlnet_sd3/test_controlnet_sd3.py +++ b/tests/pipelines/controlnet_sd3/test_controlnet_sd3.py @@ -204,9 +204,9 @@ def run_pipe(self, components, use_sd35=False): assert image.shape == (1, 32, 32, 3) if not use_sd35: - expected_slice = np.array([0.5767, 0.7100, 0.5981, 0.5674, 0.5952, 0.4102, 0.5093, 0.5044, 0.6030]) + expected_slice = np.array([0.4578, 0.3582, 0.4046, 0.0953, 0.6878, 0.5821, 0.5541, 0.5888, 0.4651]) else: - expected_slice = np.array([1.0000, 0.9072, 0.4209, 0.2744, 0.5737, 0.3840, 0.6113, 0.6250, 0.6328]) + expected_slice = np.array([0.3721, 0.5626, 0.4657, 0.2845, 0.5241, 0.5917, 0.6265, 0.6955, 0.3969]) assert np.abs(image_slice.flatten() - expected_slice).max() < 1e-2, ( f"Expected: {expected_slice}, got: {image_slice.flatten()}" From 784c78e68eb3140a42299b8dce8499c16460e539 Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Wed, 13 May 2026 16:14:06 +0900 Subject: [PATCH 4/4] remove serge reviewer workflow from the mix --- .github/workflows/serge_review.yml | 66 ------------------------------ 1 file changed, 66 deletions(-) delete mode 100644 .github/workflows/serge_review.yml diff --git a/.github/workflows/serge_review.yml b/.github/workflows/serge_review.yml deleted file mode 100644 index c637736ef1a3..000000000000 --- a/.github/workflows/serge_review.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Claude AI Review with inline comments - -on: - issue_comment: - types: [created] - pull_request_review_comment: - types: [created] - -permissions: - contents: read - pull-requests: write - issues: read - -jobs: - claude-ai-review: - if: | - ( - github.event_name == 'issue_comment' && - github.event.issue.pull_request && - github.event.issue.state == 'open' && - contains(github.event.comment.body, '@claude') && - (github.event.comment.author_association == 'MEMBER' || - github.event.comment.author_association == 'OWNER' || - github.event.comment.author_association == 'COLLABORATOR') - ) || ( - github.event_name == 'pull_request_review_comment' && - contains(github.event.comment.body, '@claude') && - (github.event.comment.author_association == 'MEMBER' || - github.event.comment.author_association == 'OWNER' || - github.event.comment.author_association == 'COLLABORATOR') - ) - concurrency: - group: claude-ai-review-${{ github.event.issue.number || github.event.pull_request.number }} - cancel-in-progress: false - runs-on: ubuntu-latest - steps: - - name: Resolve PR number - id: pr - run: | - NUM="${{ github.event.issue.number || github.event.pull_request.number }}" - echo "number=${NUM}" >> "$GITHUB_OUTPUT" - - - name: Check out PR head (shallow) - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - ref: refs/pull/${{ steps.pr.outputs.number }}/head - fetch-depth: 1 - - - name: Strip fork-supplied reviewer/agent config - # ai-reviewer fetches its config (.ai/review-rules.md, .ai/review-tools.json, - # .ai/context-script) from the base repo's default branch via the GitHub - # Contents API, so wiping the fork's local copies does not affect rule - # loading. The wipe matters because the action also exposes read-only - # browse tools (read_file/list_dir/grep) rooted at the PR-head checkout — - # without this step a fork could ship its own .ai/review-tools.json or - # .ai/context-script and surface them to the LLM. .claude/ + CLAUDE.md - # are wiped for parity with the hardening in claude_review.yml. - run: rm -rf .ai/ .claude/ CLAUDE.md - - - uses: tarekziade/ai-reviewer@main - with: - llm_api_key: ${{ secrets.ANTHROPIC_API_KEY }} - llm_api_base: https://api.anthropic.com - llm_model: claude-opus-4-6 - llm_stream: 'true' - mention_trigger: '@claude'