Views
No views yet
1import os
2import tarfile
3
4print("📦 Installing dependencies...")
5!pip install -q huggingface_hub
6
7from huggingface_hub import hf_hub_download
8
9HF_REPO = "Zlib2/bonsai-8b-colab-prebuilt"
10
11print("\n📥 1/3 Downloading pre-built llama.cpp (Fast)...")
12llama_zip = hf_hub_download(repo_id=HF_REPO, filename="llama_cpp_prebuilt.tar.gz")
13
14print("📥 2/3 Downloading Bonsai-8B.gguf model (Large file)...")
15model_path = hf_hub_download(repo_id=HF_REPO, filename="Bonsai-8B.gguf")
16
17print("📦 3/3 Extracting files...")
18!mkdir -p /content/llama.cpp
19
20with tarfile.open(llama_zip, "r:gz") as tar:
21 tar.extractall(path="/content/llama.cpp")
22
23!chmod +x /content/llama.cpp/build/bin/llama-cli
24
25print("\n🎉 Setup complete!")1USER_PROMPT = "Explain quantum computing in simple terms."
2SYSTEM_PROMPT = "You are a helpful assistant"
3
4!/content/llama.cpp/build/bin/llama-cli \
5 -m "{model_path}" \
6 --system-prompt "{SYSTEM_PROMPT}" \
7 -p "{USER_PROMPT}" \
8 -n 4096 \
9 --temp 0.5 \
10 --top-p 0.85 \
11 --top-k 20 \
12 -ngl 99