Views
No views yet
Q2_0) Under 2 Minutes 🚀Q2_0 variant.1!pip install -q huggingface_hub
2
3import os
4from huggingface_hub import hf_hub_download
5
6# --- CONFIGURATION ---
7repo_id = "IamPradeep/Ternary-Bonsai-27B-GGUF-Colab-Prebuilt-GPU"
8
9print("1. Downloading pre-compiled binary package...")
10bin_zip_path = hf_hub_download(repo_id=repo_id, filename="llama_bin.tar.gz")
11
12# Extract the binaries into a folder called 'llama_bin'
13!mkdir -p ./llama_bin
14!tar -xzvf {bin_zip_path} -C ./llama_bin
15
16# Grant executable permissions to the binary
17!chmod +x ./llama_bin/llama-cli
18
19print("\n2. Downloading model (this takes ~1–2 minutes for 7.17 GB)...")
20model_path = hf_hub_download(repo_id=repo_id, filename="Ternary-Bonsai-27B-Q2_0.gguf")
21
22# Add the extracted folder to LD_LIBRARY_PATH for dynamic CUDA libraries
23os.environ["LD_LIBRARY_PATH"] = f"./llama_bin:{os.environ.get('LD_LIBRARY_PATH', '')}"
241# Run text inference!
2system_prompt = "You are a helpful AI assistant."
3prompt = "Explain quantum computing in simple terms."
4
5print(f"\n--- Running inference with Ternary-Bonsai-27B-GGUF ---\n")
6
7!./llama_bin/llama-cli \
8 -m "{model_path}" \
9 -ngl 99 \
10 -sys "{system_prompt}" \
11 -p "{prompt}" \
12 --temp 0.7 \
13 --top-p 0.95 \
14 -n 2048 \
15 --reasoning off # Use "on" to enable reasoning/thinking
16mmproj) and uploading an image directly inside Google Colab:1from PIL import Image
2from google.colab import files
3
4# 1. Download Vision Projector (~629 MB)
5print("Downloading Vision Projector...")
6mmproj_path = hf_hub_download(repo_id=repo_id, filename="Ternary-Bonsai-27B-mmproj-Q8_0.gguf")
7
8# 2. Live Image Upload
9print("\n" + "="*50)
10print("📸 PLEASE UPLOAD AN IMAGE FROM YOUR DEVICE:")
11print("="*50)
12
13uploaded = files.upload()
14
15if not uploaded:
16 print("\n❌ No file was uploaded!")
17else:
18 # Save the uploaded file path
19 image_filename = list(uploaded.keys())[0]
20 image_path = f"./{image_filename}"
21
22 print(f"\n✅ Uploaded successfully: {image_filename}")
23 display(Image.open(image_path))
24
25 # 3. Run Multimodal Inference
26 system_prompt = "You are an expert AI vision assistant. Provide clear, detailed, and accurate descriptions of images."
27 prompt = "Describe what you see in this image in detail."
28
29 print(f"\n🤖 Running Vision Inference on {image_filename}...\n")
30
31 !./llama_bin/llama-cli \
32 -m "{model_path}" \
33 --mmproj "{mmproj_path}" \
34 --image "{image_path}" \
35 -sys "{system_prompt}" \
36 -p "{prompt}" \
37 -ngl 99 \
38 --temp 0.2 \
39 -n 2048 \
40 --reasoning off # Use "on" to enable reasoning/thinking
41Ternary-Bonsai-27B-Q2_0.gguf file is ~7.17 GB. Downloading it inside Colab typically takes around 1 to 2 minutes depending on network throughput.Ternary-Bonsai-27B-F16.gguf (53.8 GB)Ternary-Bonsai-27B-Q2_g64.gguf (7.59 GB)Ternary-Bonsai-27B-dspark-bf16.gguf (7.29 GB)Ternary-Bonsai-27B-PQ2_0.gguf (7.17 GB)Ternary-Bonsai-27B-Q2_0.gguf (7.17 GB)Ternary-Bonsai-27B-dspark-Q4_1.gguf (1.95 GB)mmproj):Ternary-Bonsai-27B-mmproj-BF16.gguf (931 MB)Ternary-Bonsai-27B-mmproj-Q8_0.gguf (629 MB)filename parameter in hf_hub_download to load your preferred variant.