-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenv-setup.sh
More file actions
35 lines (31 loc) · 1.01 KB
/
Copy pathenv-setup.sh
File metadata and controls
35 lines (31 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
# Function to parse arguments and set up common variables
parse_args() {
USE_AMD=false
USE_METAL=false
while [[ $# -gt 0 ]]; do
case "$1" in
--amd)
USE_AMD=true
shift
;;
--metal)
USE_METAL=true
shift
;;
*) # Ignore unknown arguments or model aliases for now to simplify discovery mode.
# If we want to support specific models, they can be passed as flags later.
shift
;;
esac
done
# Set environment variables based on GPU mode if USE_AMD is set (passed from caller)
if [[ "$USE_AMD" == true ]]; then
export GPU_ENABLE_WGP_MODE=0
export HIP_VISIBLE_DEVICES=0
elif [[ "$USE_METAL" == false ]]; then
export AMD_VULKAN_ICD=RADV
fi
export LLAMA_ARG_N_PARALLEL=1
export LLAMA_COMMON_ARGS="--models-dir ./models --models-preset models.ini --models-max 1"
}