Replace print_stderr with warnings.warn
This commit is contained in:
parent
9fc0ab415c
commit
92a3363096
|
@ -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()
|
||||||
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:
|
||||||
|
|
||||||
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
|
||||||
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]:
|
||||||
}
|
}
|
||||||
|
|
||||||
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}"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
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]:
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user