mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-20 02:24:59 +00:00
NVIDIA GPU detection support for WSL2 environments (#1891)
This change makes the assumption that "Microsoft Corporation Device 008e" is an NVIDIA CUDA device. If this is not the case, please update the hardware detection script here. Signed-off-by: Enrico Ros <enrico.ros@gmail.com> Co-authored-by: Dave <dave@gray101.com>
This commit is contained in:
parent
6cf99527f8
commit
5e12382524
1 changed files with 12 additions and 1 deletions
|
@ -33,6 +33,17 @@ function detect_gpu() {
|
|||
else
|
||||
echo "Intel GPU detected, but Intel GPU drivers are not installed. GPU acceleration will not be available."
|
||||
fi
|
||||
elif lspci | grep -E 'VGA|3D' | grep -iq "Microsoft Corporation Device 008e"; then
|
||||
# We make the assumption this WSL2 cars is NVIDIA, then check for nvidia-smi
|
||||
# Make sure the container was run with `--gpus all` as the only required parameter
|
||||
echo "NVIDIA GPU detected via WSL2"
|
||||
# nvidia-smi should be installed in the container
|
||||
if nvidia-smi; then
|
||||
GPU_ACCELERATION=true
|
||||
GPU_VENDOR=nvidia
|
||||
else
|
||||
echo "NVIDIA GPU detected via WSL2, but nvidia-smi is not installed. GPU acceleration will not be available."
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
Darwin)
|
||||
|
@ -95,4 +106,4 @@ check_vars
|
|||
|
||||
echo "Starting LocalAI with the following models: $MODELS"
|
||||
|
||||
/build/entrypoint.sh "$@"
|
||||
/build/entrypoint.sh "$@"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue