memmywinks commited on
Commit
acc7797
ยท
verified ยท
1 Parent(s): 8731047

Upload 6 files

Browse files
Files changed (1) hide show
  1. scripts/entrypoint.sh +20 -36
scripts/entrypoint.sh CHANGED
@@ -15,55 +15,39 @@ mkdir -p /workspace/output
15
  LOG_FILE="/workspace/output/conversion.log"
16
  exec > >(tee -a "$LOG_FILE") 2>&1
17
 
18
- # โ”€โ”€ Download pre-built llama-quantize binary from GitHub releases โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
19
  if ! command -v llama-quantize &>/dev/null; then
20
- echo "Fetching latest llama.cpp release info..."
21
 
22
- # Asset name format is: llama-bin-ubuntu-x64.tar.gz
23
- # (plain CPU build, no cuda/vulkan/rocm suffix)
24
- RELEASE_JSON=$(curl -fsSL "https://api.github.com/repos/ggml-org/llama.cpp/releases/latest")
 
 
25
 
26
- ASSET_URL=$(echo "$RELEASE_JSON" | python3 -c "
27
- import sys, json
28
- data = json.load(sys.stdin)
29
- for a in data.get('assets', []):
30
- name = a['name']
31
- # Must be ubuntu x64, tar.gz, no GPU variants
32
- if (name.startswith('llama-bin-ubuntu') and
33
- 'x64' in name and
34
- name.endswith('.tar.gz') and
35
- 'cuda' not in name and
36
- 'vulkan' not in name and
37
- 'rocm' not in name and
38
- 'openvino' not in name):
39
- print(a['browser_download_url'])
40
- break
41
- ")
42
 
43
- if [[ -z "$ASSET_URL" ]]; then
44
- # Print all asset names to help debug future breakage
45
- echo "Available assets:"
46
- echo "$RELEASE_JSON" | python3 -c "
47
- import sys, json
48
- for a in json.load(sys.stdin).get('assets', []):
49
- print(' ', a['name'])
50
- "
51
- echo "ERROR: Could not find llama-bin-ubuntu-x64.tar.gz in the release assets above."
52
  exit 1
53
  fi
54
 
55
- echo "Downloading: $ASSET_URL"
56
- curl -fsSL "$ASSET_URL" -o /tmp/llama-bin.tar.gz
57
  mkdir -p /tmp/llama-bin
58
  tar -xzf /tmp/llama-bin.tar.gz -C /tmp/llama-bin
59
  rm /tmp/llama-bin.tar.gz
60
 
61
- # Install the tools we need
62
- find /tmp/llama-bin -name "llama-quantize" -exec install -m 755 {} /usr/local/bin/ \;
63
- find /tmp/llama-bin -name "llama-gguf-split" -exec install -m 755 {} /usr/local/bin/ \; 2>/dev/null || true
64
  rm -rf /tmp/llama-bin
65
 
66
- echo "llama-quantize installed at: $(which llama-quantize)"
67
  else
68
  echo "llama-quantize already available, skipping download."
69
  fi
 
15
  LOG_FILE="/workspace/output/conversion.log"
16
  exec > >(tee -a "$LOG_FILE") 2>&1
17
 
18
+ # โ”€โ”€ Download pre-built llama-quantize binary โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
19
  if ! command -v llama-quantize &>/dev/null; then
20
+ echo "Fetching llama.cpp release tag..."
21
 
22
+ # Step 1: resolve the latest release tag via redirect (no API token needed,
23
+ # no pagination issues โ€” GitHub redirects /latest to the actual tag page)
24
+ LATEST_TAG=$(curl -fsSL -o /dev/null -w '%{url_effective}' \
25
+ "https://github.com/ggml-org/llama.cpp/releases/latest" \
26
+ | grep -oP '(?<=/releases/tag/)[^/]+')
27
 
28
+ echo "Latest tag: $LATEST_TAG"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
+ # Step 2: build the direct asset URL โ€” filename is llama-{TAG}-bin-ubuntu-x64.tar.gz
31
+ ASSET_URL="https://github.com/ggml-org/llama.cpp/releases/download/${LATEST_TAG}/llama-${LATEST_TAG}-bin-ubuntu-x64.tar.gz"
32
+ echo "Downloading: $ASSET_URL"
33
+
34
+ # Step 3: download with fallback check
35
+ HTTP_CODE=$(curl -fsSL -o /tmp/llama-bin.tar.gz -w '%{http_code}' "$ASSET_URL")
36
+ if [[ "$HTTP_CODE" != "200" ]]; then
37
+ echo "ERROR: Download failed (HTTP $HTTP_CODE)."
38
+ echo "Try setting LLAMA_BIN_URL env var to a direct .tar.gz URL and restarting."
39
  exit 1
40
  fi
41
 
 
 
42
  mkdir -p /tmp/llama-bin
43
  tar -xzf /tmp/llama-bin.tar.gz -C /tmp/llama-bin
44
  rm /tmp/llama-bin.tar.gz
45
 
46
+ find /tmp/llama-bin -name "llama-quantize" -exec install -m 755 {} /usr/local/bin/ \;
47
+ find /tmp/llama-bin -name "llama-gguf-split" -exec install -m 755 {} /usr/local/bin/ \; 2>/dev/null || true
 
48
  rm -rf /tmp/llama-bin
49
 
50
+ echo "llama-quantize installed: $(which llama-quantize)"
51
  else
52
  echo "llama-quantize already available, skipping download."
53
  fi