TimDettmers / bitsandbytes

Accessible large language models via k-bit quantization for PyTorch.

Home Page:https://huggingface.co/docs/bitsandbytes/main/en/index

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bitsandbytes interprets URLs from environment variables as paths

allo- opened this issue · comments

System Info

Ubuntu 22.04, Python 3.10

Reproduction

export TEST_VAR="http://localhost/"
python3 somescript_using_bitsandbytes.py

Results in

The following directories listed in your path were found to be non-existent: {PosixPath('//localhost'), PosixPath('http')}

def is_relevant_candidate_env_var(env_var: str, value: str) -> bool:

is a bit too eager to interpret everything with os.sep in it as PATH variable.

Expected behavior

bitsandbytes should only look in relevant PATH variables for paths. This also avoids the risk of finding existing paths with wrong library versions that weren't meant to be used in the current script.

Related: #1126
I agree; this could use some improvement.

As bitsandbytes prints a lot of information on how to debug not found libraries, I wonder if it needs such a broad search for possible paths in the environment or could just check a list of known path variables and otherwise print help on how to set variables like CUDA_HOME as a clean way to provide the library paths.