"...git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "c8bb1ff53ee1210e04861abd41518f197cfd8b3c"
Commit 92a33630 authored by Max Ryabinin's avatar Max Ryabinin
Browse files

Replace print_stderr with warnings.warn

parent 9fc0ab41
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
# cli() # cli()
import os import os
import sys import sys
import torch from warnings import warn
import torch
HEADER_WIDTH = 60 HEADER_WIDTH = 60
...@@ -32,8 +33,6 @@ print() ...@@ -32,8 +33,6 @@ print()
from . import COMPILED_WITH_CUDA, PACKAGE_GITHUB_URL from . import COMPILED_WITH_CUDA, PACKAGE_GITHUB_URL
from .cuda_setup.main import get_compute_capabilities, get_cuda_lib_handle from .cuda_setup.main import get_compute_capabilities, get_cuda_lib_handle
from .cuda_setup.env_vars import to_be_ignored from .cuda_setup.env_vars import to_be_ignored
from .utils import print_stderr
print_header("POTENTIALLY LIBRARY-PATH-LIKE ENV VARS") print_header("POTENTIALLY LIBRARY-PATH-LIKE ENV VARS")
for k, v in os.environ.items(): for k, v in os.environ.items():
...@@ -84,7 +83,7 @@ try: ...@@ -84,7 +83,7 @@ try:
except ImportError: except ImportError:
print() print()
print_stderr( warn(
f"WARNING: {__package__} is currently running as CPU-only!\n" f"WARNING: {__package__} is currently running as CPU-only!\n"
"Therefore, 8-bit optimizers and GPU quantization are unavailable.\n\n" "Therefore, 8-bit optimizers and GPU quantization are unavailable.\n\n"
f"If you think that this is so erroneously,\nplease report an issue!" f"If you think that this is so erroneously,\nplease report an issue!"
......
...@@ -2,7 +2,6 @@ from pathlib import Path ...@@ -2,7 +2,6 @@ from pathlib import Path
from typing import Set, Union from typing import Set, Union
from warnings import warn from warnings import warn
from ..utils import print_stderr
from .env_vars import get_potentially_lib_path_containing_env_vars from .env_vars import get_potentially_lib_path_containing_env_vars
CUDA_RUNTIME_LIB: str = "libcudart.so" CUDA_RUNTIME_LIB: str = "libcudart.so"
...@@ -18,7 +17,7 @@ def remove_non_existent_dirs(candidate_paths: Set[Path]) -> Set[Path]: ...@@ -18,7 +17,7 @@ def remove_non_existent_dirs(candidate_paths: Set[Path]) -> Set[Path]:
} }
if non_existent_directories: if non_existent_directories:
print_stderr( warn(
"WARNING: The following directories listed in your path were found to " "WARNING: The following directories listed in your path were found to "
f"be non-existent: {non_existent_directories}" f"be non-existent: {non_existent_directories}"
) )
......
import shlex import shlex
import subprocess import subprocess
import sys
from typing import Tuple from typing import Tuple
...@@ -22,7 +21,3 @@ def execute_and_return(command_string: str) -> Tuple[str, str]: ...@@ -22,7 +21,3 @@ def execute_and_return(command_string: str) -> Tuple[str, str]:
std_out, std_err = execute_and_return_decoded_std_streams(command_string) std_out, std_err = execute_and_return_decoded_std_streams(command_string)
return std_out, std_err return std_out, std_err
def print_stderr(s: str) -> None:
print(s, file=sys.stderr)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment