Spaces:
Running
on
Zero
Running
on
Zero
gokaygokay
commited on
Commit
•
ad540bf
1
Parent(s):
78112f2
diffusers
Browse files- setup_local_diffusers.py +8 -15
setup_local_diffusers.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import os
|
2 |
import sys
|
3 |
import subprocess
|
4 |
-
import pkg_resources
|
5 |
|
6 |
def setup_local_diffusers():
|
7 |
# 1. Try to uninstall existing diffusers package
|
@@ -13,27 +12,21 @@ def setup_local_diffusers():
|
|
13 |
|
14 |
# 2. Get the current directory and add it to PYTHONPATH
|
15 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
|
16 |
if current_dir not in sys.path:
|
17 |
sys.path.insert(0, current_dir)
|
18 |
print(f"Added {current_dir} to PYTHONPATH")
|
19 |
|
20 |
-
# 3.
|
21 |
-
diffusers_path = os.path.join(current_dir, 'diffusers')
|
22 |
-
if os.path.exists(diffusers_path):
|
23 |
-
try:
|
24 |
-
subprocess.check_call([sys.executable, "-m", "pip", "install", "-e", diffusers_path])
|
25 |
-
print(f"Successfully installed local diffusers from {diffusers_path}")
|
26 |
-
except subprocess.CalledProcessError as e:
|
27 |
-
print(f"Failed to install local diffusers: {e}")
|
28 |
-
return False
|
29 |
-
else:
|
30 |
-
print(f"Error: Could not find diffusers directory at {diffusers_path}")
|
31 |
-
return False
|
32 |
-
|
33 |
-
# 4. Verify the installation
|
34 |
try:
|
35 |
import diffusers
|
36 |
print(f"Successfully imported diffusers from: {diffusers.__file__}")
|
|
|
|
|
|
|
|
|
|
|
37 |
return True
|
38 |
except ImportError as e:
|
39 |
print(f"Failed to import diffusers: {e}")
|
|
|
1 |
import os
|
2 |
import sys
|
3 |
import subprocess
|
|
|
4 |
|
5 |
def setup_local_diffusers():
|
6 |
# 1. Try to uninstall existing diffusers package
|
|
|
12 |
|
13 |
# 2. Get the current directory and add it to PYTHONPATH
|
14 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|
15 |
+
|
16 |
+
# Add the parent directory of diffusers to Python path
|
17 |
if current_dir not in sys.path:
|
18 |
sys.path.insert(0, current_dir)
|
19 |
print(f"Added {current_dir} to PYTHONPATH")
|
20 |
|
21 |
+
# 3. Verify the import works
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
try:
|
23 |
import diffusers
|
24 |
print(f"Successfully imported diffusers from: {diffusers.__file__}")
|
25 |
+
|
26 |
+
# Verify specific module exists
|
27 |
+
from diffusers.loaders.single_file import FromOriginalModelMixin
|
28 |
+
print("Successfully imported FromOriginalModelMixin")
|
29 |
+
|
30 |
return True
|
31 |
except ImportError as e:
|
32 |
print(f"Failed to import diffusers: {e}")
|