Repository: wandb/wandb (branch: update/diffusers)
Commit date: 2024-01-08T10:33:58Z

Workflow file: .github/workflows/pre-commit.yml (pre-commit)
name: pre-commit

on:
  pull_request:
  push:
    branches: [main]

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    services:
      pypi_wayback:
        image: ghcr.io/waleko/pypi-wayback
        ports:
          - 8629:8080
    steps:
    - uses: actions/checkout@v3
    - uses: actions/setup-go@v4
      with:
        go-version: '1.21'
    - uses: actions/setup-python@v3
    - name: setup env
      run: |
        ./core/scripts/code-checks.sh update
    - uses: pre-commit/action@v3.0.0
      with:
        extra_args: --hook-stage pre-push --all-files
      env:
        SKIP: go-generate-graphql

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


Failed build logs:
step_name: pre-commit/6_Run pre-commitaction@v3.0.0.txt
log: ##[group]Run pre-commit/action@v3.0.0
with:
  extra_args: --hook-stage pre-push --all-files
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.12.1/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.1/x64/lib
  SKIP: go-generate-graphql
##[endgroup]
##[group]Run python -m pip install pre-commit
[36;1mpython -m pip install pre-commit[0m
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.12.1/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.1/x64/lib
  SKIP: go-generate-graphql
##[endgroup]
Collecting pre-commit
  Downloading pre_commit-3.6.0-py2.py3-none-any.whl.metadata (1.3 kB)
Collecting cfgv>=2.0.0 (from pre-commit)
  Downloading cfgv-3.4.0-py2.py3-none-any.whl.metadata (8.5 kB)
Collecting identify>=1.0.0 (from pre-commit)
  Downloading identify-2.5.33-py2.py3-none-any.whl.metadata (4.4 kB)
Collecting nodeenv>=0.11.1 (from pre-commit)
  Downloading nodeenv-1.8.0-py2.py3-none-any.whl.metadata (21 kB)
Collecting pyyaml>=5.1 (from pre-commit)
  Downloading PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.1 kB)
Collecting virtualenv>=20.10.0 (from pre-commit)
  Downloading virtualenv-20.25.0-py3-none-any.whl.metadata (4.5 kB)
Collecting setuptools (from nodeenv>=0.11.1->pre-commit)
  Downloading setuptools-69.0.3-py3-none-any.whl.metadata (6.3 kB)
Collecting distlib<1,>=0.3.7 (from virtualenv>=20.10.0->pre-commit)
  Downloading distlib-0.3.8-py2.py3-none-any.whl.metadata (5.1 kB)
Collecting filelock<4,>=3.12.2 (from virtualenv>=20.10.0->pre-commit)
  Downloading filelock-3.13.1-py3-none-any.whl.metadata (2.8 kB)
Collecting platformdirs<5,>=3.9.1 (from virtualenv>=20.10.0->pre-commit)
  Downloading platformdirs-4.1.0-py3-none-any.whl.metadata (11 kB)
Downloading pre_commit-3.6.0-py2.py3-none-any.whl (204 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 204.0/204.0 kB 31.8 MB/s eta 0:00:00
Downloading cfgv-3.4.0-py2.py3-none-any.whl (7.2 kB)
Downloading identify-2.5.33-py2.py3-none-any.whl (98 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.9/98.9 kB 31.0 MB/s eta 0:00:00
Downloading nodeenv-1.8.0-py2.py3-none-any.whl (22 kB)
Downloading PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (724 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 725.0/725.0 kB 87.6 MB/s eta 0:00:00
Downloading virtualenv-20.25.0-py3-none-any.whl (3.8 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.8/3.8 MB 116.8 MB/s eta 0:00:00
Downloading distlib-0.3.8-py2.py3-none-any.whl (468 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 468.9/468.9 kB 49.6 MB/s eta 0:00:00
Downloading filelock-3.13.1-py3-none-any.whl (11 kB)
Downloading platformdirs-4.1.0-py3-none-any.whl (17 kB)
Downloading setuptools-69.0.3-py3-none-any.whl (819 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 819.5/819.5 kB 92.1 MB/s eta 0:00:00
Installing collected packages: distlib, setuptools, pyyaml, platformdirs, identify, filelock, cfgv, virtualenv, nodeenv, pre-commit
Successfully installed cfgv-3.4.0 distlib-0.3.8 filelock-3.13.1 identify-2.5.33 nodeenv-1.8.0 platformdirs-4.1.0 pre-commit-3.6.0 pyyaml-6.0.1 setuptools-69.0.3 virtualenv-20.25.0
##[group]Run python -m pip freeze --local
[36;1mpython -m pip freeze --local[0m
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.12.1/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.1/x64/lib
  SKIP: go-generate-graphql
##[endgroup]
cfgv==3.4.0
distlib==0.3.8
filelock==3.13.1
identify==2.5.33
nodeenv==1.8.0
platformdirs==4.1.0
pre-commit==3.6.0
PyYAML==6.0.1
setuptools==69.0.3
virtualenv==20.25.0
##[group]Run actions/cache@v3
with:
  path: ~/.cache/pre-commit
  key: pre-commit-3|/opt/hostedtoolcache/Python/3.12.1/x64|a333fd88224707918ef5e53726a9b083fdaa934e65d17db828a35f3ab158770e
  enableCrossOsArchive: false
  fail-on-cache-miss: false
  lookup-only: false
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.12.1/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.1/x64/lib
  SKIP: go-generate-graphql
##[endgroup]
Received 0 of 48931996 (0.0%), 0.0 MBs/sec
Cache Size: ~47 MB (48931996 B)
[command]/usr/bin/tar -xf /home/runner/work/_temp/2e6b382b-db1b-4411-add2-ddbcf402d5ce/cache.tzst -P -C /home/runner/work/wandb/wandb --use-compress-program unzstd
Received 48931996 of 48931996 (100.0%), 23.3 MBs/sec
Cache restored successfully
Cache restored from key: pre-commit-3|/opt/hostedtoolcache/Python/3.12.1/x64|a333fd88224707918ef5e53726a9b083fdaa934e65d17db828a35f3ab158770e
##[group]Run pre-commit run --show-diff-on-failure --color=always --hook-stage pre-push --all-files
[36;1mpre-commit run --show-diff-on-failure --color=always --hook-stage pre-push --all-files[0m
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.12.1/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.1/x64/lib
  SKIP: go-generate-graphql
##[endgroup]
clippy...................................................................[42mPassed[m
ruff.....................................................................[42mPassed[m
black-jupyter............................................................[41mFailed[m
[2m- hook id: black-jupyter[m
[2m- files were modified by this hook[m

[1mreformatted wandb/integration/diffusers/autologger.py[0m

[1mAll done! ✨ 🍰 ✨[0m
[34m[1m1 file [0m[1mreformatted[0m, [34m887 files [0mleft unchanged.

blacken-docs.............................................................[42mPassed[m
clang-format.............................................................[42mPassed[m
check for merge conflicts................................................[42mPassed[m
trailing-whitespace......................................................[42mPassed[m
end-of-file-fixer........................................................[42mPassed[m
check-yaml...............................................................[42mPassed[m
check-added-large-files..................................................[42mPassed[m
check-shebang-scripts-are-executable.....................................[42mPassed[m
check-executables-have-shebangs..........................................[42mPassed[m
check-symlinks.......................................(no files to check)[46;30mSkipped[m
check-toml...............................................................[42mPassed[m
debug-statements.........................................................[42mPassed[m
forbid-submodules....................................(no files to check)[46;30mSkipped[m
black....................................................................[42mPassed[m
go-generate-proto........................................................[42mPassed[m
go-generate-graphql.....................................................[43;30mSkipped[m
go-fmt...................................................................[42mPassed[m
go-imports...............................................................[42mPassed[m
go-unit-tests............................................................[42mPassed[m
go-vet...................................................................[42mPassed[m
golangci-lint............................................................[42mPassed[m
go-critic................................................................[42mPassed[m
go-cyclo.................................................................[42mPassed[m
go-mod-tidy..............................................................[42mPassed[m
go-build.................................................................[42mPassed[m
pre-commit hook(s) made changes.
If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`.
To run `pre-commit` as part of git workflow, use `pre-commit install`.
All changes made by hooks:
[1mdiff --git a/wandb/integration/diffusers/autologger.py b/wandb/integration/diffusers/autologger.py[m
[1mindex ab88d9c..e10ee15 100644[m
[1m--- a/wandb/integration/diffusers/autologger.py[m
[1m+++ b/wandb/integration/diffusers/autologger.py[m
[36m@@ -65,7 +65,7 @@[m [mautolog = AutologAPI([m
         "TextToVideoSDPipeline.__call__",[m
         "TextToVideoZeroPipeline.__call__",[m
         "StableVideoDiffusionPipeline.__call__",[m
[31m-        "AmusedPipeline.__call__"[m
[32m+[m[32m        "AmusedPipeline.__call__",[m
     ),[m
     resolver=DiffusersPipelineResolver(),[m
     telemetry_feature="diffusers_autolog",[m
##[error]Process completed with exit code 1.


Changed files:
wandb/integration/diffusers/autologger.py
wandb/integration/diffusers/pipeline_resolver.py
wandb/integration/diffusers/resolvers/multimodal.py

Fix diff:
diff --git a/wandb/integration/diffusers/autologger.py b/wandb/integration/diffusers/autologger.py
index ab88d9c7d..e10ee1549 100644
--- a/wandb/integration/diffusers/autologger.py
+++ b/wandb/integration/diffusers/autologger.py
@@ -65,7 +65,7 @@ autolog = AutologAPI(
         "TextToVideoSDPipeline.__call__",
         "TextToVideoZeroPipeline.__call__",
         "StableVideoDiffusionPipeline.__call__",
-        "AmusedPipeline.__call__"
+        "AmusedPipeline.__call__",
     ),
     resolver=DiffusersPipelineResolver(),
     telemetry_feature="diffusers_autolog",
diff --git a/wandb/integration/diffusers/pipeline_resolver.py b/wandb/integration/diffusers/pipeline_resolver.py
index 37cf75fd7..9d3736d2d 100644
--- a/wandb/integration/diffusers/pipeline_resolver.py
+++ b/wandb/integration/diffusers/pipeline_resolver.py
@@ -18,6 +18,7 @@ class DiffusersPipelineResolver:
 
     def __init__(self) -> None:
         self.wandb_table = None
+        self.pipeline_call_count = 1
 
     def __call__(
         self,
@@ -43,7 +44,10 @@ class DiffusersPipelineResolver:
         pipeline_name = args[0].__class__.__name__
         resolver = None
         if pipeline_name in SUPPORTED_MULTIMODAL_PIPELINES:
-            resolver = DiffusersMultiModalPipelineResolver(pipeline_name)
+            resolver = DiffusersMultiModalPipelineResolver(
+                pipeline_name, self.pipeline_call_count
+            )
+            self.pipeline_call_count += 1
         elif pipeline_name in SUPPORTED_SDXL_PIPELINES:
             resolver = SDXLResolver(pipeline_name)
         loggable_dict = resolver(args, kwargs, response, start_time, time_elapsed)
diff --git a/wandb/integration/diffusers/resolvers/multimodal.py b/wandb/integration/diffusers/resolvers/multimodal.py
index 2948778f9..021efcf2c 100644
--- a/wandb/integration/diffusers/resolvers/multimodal.py
+++ b/wandb/integration/diffusers/resolvers/multimodal.py
@@ -502,8 +502,9 @@ class DiffusersMultiModalPipelineResolver:
         pipeline_name: (str) The name of the Diffusion Pipeline.
     """
 
-    def __init__(self, pipeline_name: str) -> None:
+    def __init__(self, pipeline_name: str, pipeline_call_count: int) -> None:
         self.pipeline_name = pipeline_name
+        self.pipeline_call_count = pipeline_call_count
         columns = []
         if pipeline_name in SUPPORTED_MULTIMODAL_PIPELINES:
             columns += SUPPORTED_MULTIMODAL_PIPELINES[pipeline_name]["table-schema"]
@@ -543,9 +544,30 @@ class DiffusersMultiModalPipelineResolver:
             pipeline_configs = dict(pipeline.config)
             pipeline_configs["pipeline-name"] = self.pipeline_name
 
-            wandb.config.update(
-                {"workflow": {"pipeline": pipeline_configs, "params": kwargs}}
-            )
+            if "workflow" not in wandb.config:
+                wandb.config.update(
+                    {
+                        "workflow": [
+                            {
+                                "pipeline": pipeline_configs,
+                                "params": kwargs,
+                                "stage": f"Pipeline-Call-{self.pipeline_call_count}",
+                            }
+                        ]
+                    }
+                )
+            else:
+                existing_workflow = wandb.config.workflow
+                updated_workflow = existing_workflow + [
+                    {
+                        "pipeline": pipeline_configs,
+                        "params": kwargs,
+                        "stage": f"Pipeline-Call-{self.pipeline_call_count}",
+                    }
+                ]
+                wandb.config.update(
+                    {"workflow": updated_workflow}, allow_val_change=True
+                )
 
             # Return the WandB loggable dict
             loggable_dict = self.prepare_loggable_dict(response, kwargs)
@@ -596,7 +618,13 @@ class DiffusersMultiModalPipelineResolver:
                 caption = loggable_kwarg_chunks[prompt_index][idx]
             except ValueError:
                 caption = None
-            wandb.log({"Generated-Image": wandb.Image(image, caption=caption)})
+            wandb.log(
+                {
+                    f"Generated-Image/Pipeline-Call-{self.pipeline_call_count}": wandb.Image(
+                        image, caption=caption
+                    )
+                }
+            )
         else:
             if (
                 SUPPORTED_MULTIMODAL_PIPELINES[self.pipeline_name]["output-type"]
@@ -611,7 +639,7 @@ class DiffusersMultiModalPipelineResolver:
                     caption = None
                 wandb.log(
                     {
-                        "Generated-Video": wandb.Video(
+                        f"Generated-Video/Pipeline-Call-{self.pipeline_call_count}": wandb.Video(
                             postprocess_pils_to_np(image), fps=4, caption=caption
                         )
                     }
@@ -629,7 +657,7 @@ class DiffusersMultiModalPipelineResolver:
                     caption = None
                 wandb.log(
                     {
-                        "Generated-Audio": wandb.Audio(
+                        f"Generated-Audio/Pipeline-Call-{self.pipeline_call_count}": wandb.Audio(
                             image, sample_rate=16000, caption=caption
                         )
                     }
@@ -696,7 +724,11 @@ class DiffusersMultiModalPipelineResolver:
                 images, normalize=self.pipeline_name == "TextToVideoZeroPipeline"
             )
             wandb.log(
-                {"Generated-Video": wandb.Video(video, fps=4, caption=kwargs["prompt"])}
+                {
+                    f"Generated-Video/Pipeline-Call-{self.pipeline_call_count}": wandb.Video(
+                        video, fps=4, caption=kwargs["prompt"]
+                    )
+                }
             )
             loggable_kwarg_ids = SUPPORTED_MULTIMODAL_PIPELINES[self.pipeline_name][
                 "kwarg-logging"
@@ -727,5 +759,6 @@ class DiffusersMultiModalPipelineResolver:
                     self.log_media(image, loggable_kwarg_chunks, idx)
                     # Populate the row of the wandb_table
                     self.add_data_to_table(image, loggable_kwarg_chunks, idx)
-
-        return {"Result-Table": self.wandb_table}
+        return {
+            f"Result-Table/Pipeline-Call-{self.pipeline_call_count}": self.wandb_table
+        }