patch_xformers-0.0.22.post7.rocm.sh 1.1 KB

12345678910111213141516171819202122
  1. #!/bin/bash
  2. export XFORMERS_FMHA_FLASH_PATH=$(python -c 'from xformers import ops as xops; print(xops.fmha.flash.__file__)')
  3. export XFORMERS_FMHA_COMMON_PATH=$(python -c 'from xformers import ops as xops; print(xops.fmha.common.__file__)')
  4. echo $XFORMERS_FMHA_FLASH_PATH
  5. echo $XFORMERS_FMHA_COMMON_PATH
  6. if ! patch -R -p0 -s -f --dry-run $XFORMERS_FMHA_FLASH_PATH "./rocm_patch/flashpy_xformers-0.0.22.post7.rocm.patch"; then
  7. echo "Applying patch to ${XFORMERS_FMHA_FLASH_PATH}"
  8. patch -p0 $XFORMERS_FMHA_FLASH_PATH "./rocm_patch/flashpy_xformers-0.0.22.post7.rocm.patch"
  9. echo "Successfully patch ${XFORMERS_FMHA_FLASH_PATH}"
  10. else
  11. echo "${XFORMERS_FMHA_FLASH_PATH} was patched before"
  12. fi
  13. if ! patch -R -p0 -s -f --dry-run $XFORMERS_FMHA_COMMON_PATH "./rocm_patch/commonpy_xformers-0.0.22.post7.rocm.patch"; then
  14. echo "Applying patch to ${XFORMERS_FMHA_COMMON_PATH}"
  15. patch -p0 $XFORMERS_FMHA_COMMON_PATH "./rocm_patch/commonpy_xformers-0.0.22.post7.rocm.patch"
  16. echo "Successfully patch ${XFORMERS_FMHA_COMMON_PATH}"
  17. else
  18. echo "${XFORMERS_FMHA_COMMON_PATH} was patched before"
  19. fi