Spaces:
Sleeping
Sleeping
Upload 6 files
Browse files- 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
|
| 19 |
if ! command -v llama-quantize &>/dev/null; then
|
| 20 |
-
echo "Fetching
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
#
|
| 24 |
-
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
|
| 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 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
"
|
| 51 |
-
echo "
|
| 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 |
-
|
| 62 |
-
find /tmp/llama-bin -name "llama-
|
| 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
|
| 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
|