SonicDiffusionClean / patch_diffusers.sh
alpercagann's picture
Add torch to requirements
dc72d06
raw
history blame contribute delete
618 Bytes
#!/bin/bash
# Run this script to patch the dynamic_modules_utils.py file
SITE_PACKAGES=$(python -c "import site; print(site.getsitepackages()[0])")
DMU_FILE="$SITE_PACKAGES/diffusers/utils/dynamic_modules_utils.py"
# Create a backup
cp "$DMU_FILE" "${DMU_FILE}.bak"
# Replace the import statement
sed -i 's/from huggingface_hub import cached_download, hf_hub_download, model_info/from huggingface_hub import hf_hub_download, model_info\n\ndef cached_download(*args, **kwargs):\n """Compatibility wrapper for hf_hub_download"""\n return hf_hub_download(*args, **kwargs)/g' "$DMU_FILE"
echo "Patched $DMU_FILE"