muryshev commited on
Commit
88279e1
·
verified ·
1 Parent(s): d9c831a

Update run.sh

Browse files
Files changed (1) hide show
  1. run.sh +4 -32
run.sh CHANGED
@@ -3,21 +3,9 @@
3
  N_GPU_LAYERS="${N_GPU_LAYERS:-20}"
4
  MODEL_PATH="${MODEL_PATH:-/data/mixtral-8x7b-instruct-v0.1.Q2_K.gguf}"
5
  MODEL_URL="${MODEL_URL:-https://huggingface.co/TheBloke/Mixtral-8x7B-Instruct-v0.1-GGUF/resolve/main/mixtral-8x7b-instruct-v0.1.Q2_K.gguf}"
6
- PORT="${PORT:-7867}"
7
  CONTEXT="${CONTEXT:-30000}"
8
 
9
- # Function to print download progress
10
- print_progress() {
11
- local percentage=$1
12
- echo "Download progress: $percentage%"
13
- }
14
-
15
- calculate_progress() {
16
- local current=$1
17
- local total=$2
18
- echo "scale=2; $current / $total * 100" | bc
19
- }
20
-
21
  # Check if the file exists
22
  if [ ! -e "$MODEL_PATH" ]; then
23
  echo "Downloading model."
@@ -33,31 +21,15 @@ if [ ! -e "$MODEL_PATH" ]; then
33
  fi
34
 
35
  # Download the file with the final URL
36
- {
37
  echo "Download started from $final_url"
38
- total_size=$(curl --head --location "$final_url" | grep -i 'Content-Length' | awk '{print $2}' | tr -d '\r\n')
39
- downloaded_size=0
40
 
41
  curl --location --output "$MODEL_PATH" "$final_url" \
42
  --progress-bar \
43
- --write-out "%{size_download}\n" | \
44
- while read -r size; do
45
- downloaded_size=$((downloaded_size + size))
46
- progress=$(calculate_progress "$downloaded_size" "$total_size")
47
-
48
- # Print progress messages every 10%
49
- if (( $(echo "$progress % 10 == 0" | bc -l) )); then
50
- print_progress "$progress"
51
- fi
52
- done
53
 
54
  echo "Download completed from $final_url"
55
- } | awk '
56
- /^Download progress:/ {
57
- print $0;
58
- fflush();
59
- }
60
- '
61
 
62
  echo "File downloaded successfully from $final_url."
63
  else
 
3
  N_GPU_LAYERS="${N_GPU_LAYERS:-20}"
4
  MODEL_PATH="${MODEL_PATH:-/data/mixtral-8x7b-instruct-v0.1.Q2_K.gguf}"
5
  MODEL_URL="${MODEL_URL:-https://huggingface.co/TheBloke/Mixtral-8x7B-Instruct-v0.1-GGUF/resolve/main/mixtral-8x7b-instruct-v0.1.Q2_K.gguf}"
6
+ PORT="${PORT:-7860}"
7
  CONTEXT="${CONTEXT:-30000}"
8
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  # Check if the file exists
10
  if [ ! -e "$MODEL_PATH" ]; then
11
  echo "Downloading model."
 
21
  fi
22
 
23
  # Download the file with the final URL
24
+
25
  echo "Download started from $final_url"
 
 
26
 
27
  curl --location --output "$MODEL_PATH" "$final_url" \
28
  --progress-bar \
29
+ --write-out "%{size_download}\n"
 
 
 
 
 
 
 
 
 
30
 
31
  echo "Download completed from $final_url"
32
+
 
 
 
 
 
33
 
34
  echo "File downloaded successfully from $final_url."
35
  else