File size: 618 Bytes
dc72d06
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/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"