Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -6,42 +6,15 @@ import logging
|
|
6 |
from diffusers import DiffusionPipeline
|
7 |
import subprocess
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
"" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
|
22 |
-
)
|
23 |
-
# Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
|
24 |
-
os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
|
25 |
-
|
26 |
-
if __name__ == "__main__":
|
27 |
-
logging.basicConfig(
|
28 |
-
format="[%(levelname)s] %(asctime)s %(message)s", level=logging.INFO
|
29 |
-
)
|
30 |
-
logging.info("Environment Variables: %s" % os.environ)
|
31 |
-
if _get_output(["nvcc", "--version"]) is None:
|
32 |
-
logging.info("Installing CUDA toolkit...")
|
33 |
-
install_cuda_toolkit()
|
34 |
-
else:
|
35 |
-
logging.info("Detected CUDA: %s" % _get_output(["nvcc", "--version"]))
|
36 |
-
|
37 |
-
# logging.info("Installing CUDA extensions...")
|
38 |
-
# setup_runtime_env()
|
39 |
-
|
40 |
-
logging.info("Starting the main application...")
|
41 |
-
# main(os.getenv("DEBUG") == "1")
|
42 |
-
|
43 |
-
|
44 |
-
# pipe = DiffusionPipeline.from_pretrained("azaneko/HiDream-I1-Fast-nf4")
|
45 |
-
|
46 |
-
# prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
|
47 |
-
# image = pipe(prompt).images[0]
|
|
|
6 |
from diffusers import DiffusionPipeline
|
7 |
import subprocess
|
8 |
|
9 |
+
os.environ["CUDA_HOME"] = "/usr/local/cuda"
|
10 |
+
CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
|
11 |
+
CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
|
12 |
+
subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
|
13 |
+
subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
|
14 |
+
subprocess.call([CUDA_TOOLKIT_FILE, "--toolkit"])
|
15 |
+
os.environ["CUDA_HOME"] = "/usr/local/cuda"
|
16 |
+
|
17 |
+
pipe = DiffusionPipeline.from_pretrained("azaneko/HiDream-I1-Fast-nf4")
|
18 |
+
|
19 |
+
prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
|
20 |
+
image = pipe(prompt).images[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|