Spaces:
Running
on
Zero
Running
on
Zero
bug fix for cache_download of huggingface_hub
Browse files
app.py
CHANGED
|
@@ -11,6 +11,23 @@
|
|
| 11 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
# See the License for the specific language governing permissions and
|
| 13 |
# limitations under the License.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
import os
|
| 15 |
import sys
|
| 16 |
import argparse
|
|
|
|
| 11 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
# See the License for the specific language governing permissions and
|
| 13 |
# limitations under the License.
|
| 14 |
+
import os
|
| 15 |
+
import importlib
|
| 16 |
+
import sys
|
| 17 |
+
|
| 18 |
+
dynamic_modules_file = '/usr/local/lib/python3.10/site-packages/diffusers/utils/dynamic_modules_utils.py'
|
| 19 |
+
|
| 20 |
+
def modify_dynamic_modules_file():
|
| 21 |
+
if os.path.exists(dynamic_modules_file):
|
| 22 |
+
with open(dynamic_modules_file, 'r') as file:
|
| 23 |
+
lines = file.readlines()
|
| 24 |
+
with open(dynamic_modules_file, 'w') as file:
|
| 25 |
+
for line in lines:
|
| 26 |
+
if "from huggingface_hub import cached_download" in line:
|
| 27 |
+
file.write("from huggingface_hub import hf_hub_download, model_info\n")
|
| 28 |
+
else:
|
| 29 |
+
file.write(line)
|
| 30 |
+
|
| 31 |
import os
|
| 32 |
import sys
|
| 33 |
import argparse
|