summaryrefslogtreecommitdiff
path: root/bitsandbytes
diff options
context:
space:
mode:
authorMax Ryabinin <mryabinin0@gmail.com>2022-08-24 18:45:17 +0300
committerMax Ryabinin <mryabinin0@gmail.com>2022-08-24 18:45:17 +0300
commit92a3363096e10ad6a5c4e944af898bd1186d806a (patch)
tree4d21c6cb5cef45e992cf2cc36caf89af3c81632e /bitsandbytes
parent9fc0ab415c564d278b673c694de9b884ea1121d2 (diff)
Replace print_stderr with warnings.warn
Diffstat (limited to 'bitsandbytes')
-rw-r--r--bitsandbytes/__main__.py7
-rw-r--r--bitsandbytes/cuda_setup/paths.py3
-rw-r--r--bitsandbytes/utils.py5
3 files changed, 4 insertions, 11 deletions
diff --git a/bitsandbytes/__main__.py b/bitsandbytes/__main__.py
index 5f11875..175a30e 100644
--- a/bitsandbytes/__main__.py
+++ b/bitsandbytes/__main__.py
@@ -3,8 +3,9 @@
# cli()
import os
import sys
-import torch
+from warnings import warn
+import torch
HEADER_WIDTH = 60
@@ -32,8 +33,6 @@ print()
from . import COMPILED_WITH_CUDA, PACKAGE_GITHUB_URL
from .cuda_setup.main import get_compute_capabilities, get_cuda_lib_handle
from .cuda_setup.env_vars import to_be_ignored
-from .utils import print_stderr
-
print_header("POTENTIALLY LIBRARY-PATH-LIKE ENV VARS")
for k, v in os.environ.items():
@@ -84,7 +83,7 @@ try:
except ImportError:
print()
- print_stderr(
+ warn(
f"WARNING: {__package__} is currently running as CPU-only!\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!"
diff --git a/bitsandbytes/cuda_setup/paths.py b/bitsandbytes/cuda_setup/paths.py
index 610665f..6f6425f 100644
--- a/bitsandbytes/cuda_setup/paths.py
+++ b/bitsandbytes/cuda_setup/paths.py
@@ -2,7 +2,6 @@ from pathlib import Path
from typing import Set, Union
from warnings import warn
-from ..utils import print_stderr
from .env_vars import get_potentially_lib_path_containing_env_vars
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:
- print_stderr(
+ warn(
"WARNING: The following directories listed in your path were found to "
f"be non-existent: {non_existent_directories}"
)
diff --git a/bitsandbytes/utils.py b/bitsandbytes/utils.py
index 77bbd30..1cd90e3 100644
--- a/bitsandbytes/utils.py
+++ b/bitsandbytes/utils.py
@@ -1,6 +1,5 @@
import shlex
import subprocess
-import sys
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)
return std_out, std_err
-
-
-def print_stderr(s: str) -> None:
- print(s, file=sys.stderr)