From 2067a55a46280a16f67ca0aa324873e9aafbcafa Mon Sep 17 00:00:00 2001 From: Xibo Sun Date: Mon, 23 Sep 2024 09:56:24 +0800 Subject: [PATCH] fix: update the comment format and update github actions --- .github/workflows/build.yml | 49 ++++++++++++------- .../layers/attention_processor.py | 30 ++++++------ 2 files changed, 46 insertions(+), 33 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b822441..939fa46f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,29 +1,42 @@ name: GitHub Actions Demo run-name: Pushed by ${{ github.actor }} 🚀 -on: [push] +on: [push, pull_request_target] jobs: - test-xfuser: - name: Test xfuser + upload: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run a multi-line script + run: git archive --format zip HEAD > xDiT.zip + - name: copy file via ssh password + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.SSH_HOST }} + port: ${{ secrets.SSH_PORT }} + username: ${{ secrets.SSH_USER }} + password: ${{ secrets.SSH_KEY }} + source: "xDiT.zip" + target: "~/" + setup-env-and-test: + needs: upload runs-on: [self-hosted, linux, x64] - strategy: - fail-fast: false - max-parallel: 5 - matrix: - python-versions: [3.11] - torch-versions: [2.4.1] - include: - - python-versions: 3.11 - python-versions-full: 3_11 - - torch-versions: 2.4.1 - torch-versions-full: 2_4_1 + continue-on-error: true steps: - - uses: actions/checkout@v4 - + - name: unzip + run: rm -rf ~/xDiT + - run: mkdir ~/xDiT + - run: unzip ~/xDiT.zip -d ~/xDiT - name: Setup docker - run: docker run --rm --name xfuser_test_docker -d -i -t --runtime=nvidia --gpus all -v ~/actions-runner/_work/xDiT/xDiT:/code xfuser_cicd/test-py_${{matrix.python-versions-full}}-torch_${{matrix.torch-versions-full}} /bin/bash + run: docker run --rm --name xfuser_test_docker -d -i -t --runtime=nvidia --gpus all -v /cfs:/cfs -v /mnt:/mnt -v ~/xDiT:/code xfuser_cicd/test-py_3_11-torch_2_4_1 /bin/bash - name: Install xfuser - run: docker exec -w /code xfuser_test_docker pip${{matrix.python-versions}} install -e . + run: docker exec -w /code xfuser_test_docker pip3.11 install -e . - name: Test xfuser run: docker exec -w /code xfuser_test_docker sh -c "torchrun --nproc_per_node=8 ./examples/sd3_example.py --model /cfs/dit/stable-diffusion-3-medium-diffusers --pipefusion_parallel_degree 2 --ulysses_degree 2 --ring_degree 1 --height 1024 --width 1024 --no_use_resolution_binning --num_inference_steps 20 --warmup_steps 0 --prompt 'A small dog' --use_cfg_parallel" + clear-env: + needs: setup-env-and-test + runs-on: [self-hosted, linux, x64] + steps: + - name: Remove Files + run: docker exec -w /code xfuser_test_docker sh -c "rm -r *" - name: Destroy docker run: docker stop xfuser_test_docker diff --git a/xfuser/model_executor/layers/attention_processor.py b/xfuser/model_executor/layers/attention_processor.py index d23d6a0b..49fd5d96 100644 --- a/xfuser/model_executor/layers/attention_processor.py +++ b/xfuser/model_executor/layers/attention_processor.py @@ -121,23 +121,23 @@ def __init__( assert (to_k.bias is None) == (to_v.bias is None) assert to_k.weight.shape == to_v.weight.shape - '''in_size, out_size = to_k.in_features, to_k.out_features - to_kv = nn.Linear( - in_size, - out_size * 2, - bias=to_k.bias is not None, - device=to_k.weight.device, - dtype=to_k.weight.dtype, - ) - to_kv.weight.data[:out_size].copy_(to_k.weight.data) - to_kv.weight.data[out_size:].copy_(to_v.weight.data) + # in_size, out_size = to_k.in_features, to_k.out_features + # to_kv = nn.Linear( + # in_size, + # out_size * 2, + # bias=to_k.bias is not None, + # device=to_k.weight.device, + # dtype=to_k.weight.dtype, + # ) + # to_kv.weight.data[:out_size].copy_(to_k.weight.data) + # to_kv.weight.data[out_size:].copy_(to_v.weight.data) - if to_k.bias is not None: - assert to_v.bias is not None - to_kv.bias.data[:out_size].copy_(to_k.bias.data) - to_kv.bias.data[out_size:].copy_(to_v.bias.data) + # if to_k.bias is not None: + # assert to_v.bias is not None + # to_kv.bias.data[:out_size].copy_(to_k.bias.data) + # to_kv.bias.data[out_size:].copy_(to_v.bias.data) - self.to_kv = to_kv''' + # self.to_kv = to_kv class xFuserAttentionProcessorRegister: