Repository: lightly-ai/lightly (branch: ersi-lig-3910-update-mae-benchmark-code)
Commit date: 2024-01-19T09:18:18Z

Workflow file: .github/workflows/test_code_format.yml (Code Format Check)
name: Code Format Check

on:
  push:
  pull_request:
  workflow_dispatch:

jobs:
  test:
    name: Check
    runs-on: ubuntu-latest
    services:
      pypi_wayback:
        image: ghcr.io/waleko/pypi-wayback
        ports:
          - 8629:8080
    steps:
    - name: Checkout Code
      uses: actions/checkout@v3
    - name: Hack to get setup-python to work on nektos/act
      run: |
        if [ ! -f "/etc/lsb-release" ] ; then
          echo "DISTRIB_RELEASE=18.04" > /etc/lsb-release
        fi
    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: "3.7"
    - uses: actions/cache@v2
      with:
        path: ${{ env.pythonLocation }}
        key: cache_v2_${{ env.pythonLocation }}-${{ hashFiles('requirements/**') }}
    - name: Install Dependencies and lightly
      run: pip install -e '.[all]'
    - name: Run Format Check
      run: |
        make format-check
    - name: Run Type Check
      run: |
        make type-check

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


Failed build logs:
step_name: Check/7_Run Format Check.txt
log: ##[group]Run make format-check
[36;1mmake format-check[0m
shell: /usr/bin/bash -e {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.7.17/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib
##[endgroup]
⚫ Checking code format...
isort --check-only --diff .
Skipped 2 files
black --check .
would reformat /home/runner/work/lightly/lightly/benchmarks/imagenet/vitb16/mae.py

Oh no! 💥 💔 💥
1 file would be reformatted, 350 files would be left unchanged.
make: *** [Makefile:46: format-check] Error 1
##[error]Process completed with exit code 2.


Changed files:
benchmarks/imagenet/vitb16/mae.py

Fix diff:
diff --git a/benchmarks/imagenet/vitb16/mae.py b/benchmarks/imagenet/vitb16/mae.py
index de70d9c0..f2df9feb 100644
--- a/benchmarks/imagenet/vitb16/mae.py
+++ b/benchmarks/imagenet/vitb16/mae.py
@@ -26,7 +26,7 @@ class MAE(LightningModule):
 
         self.mask_ratio = 0.75
         self.patch_size = vit.patch_embed.patch_size[0]
-        self.sequence_length = vit.patch_embed.num_patches + + vit.num_prefix_tokens
+        self.sequence_length = vit.patch_embed.num_patches + +vit.num_prefix_tokens
         self.mask_token = Parameter(torch.zeros(1, 1, decoder_dim))
         torch.nn.init.normal_(self.mask_token, std=0.02)
         self.backbone = MAEBackbone.from_vit(vit)