How to use from
llama.cpp
Install from brew
brew install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama-server -hf NguyenDinhHieu/Cube-Python-1.0
# Run inference directly in the terminal:
llama-cli -hf NguyenDinhHieu/Cube-Python-1.0
Install from WinGet (Windows)
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama-server -hf NguyenDinhHieu/Cube-Python-1.0
# Run inference directly in the terminal:
llama-cli -hf NguyenDinhHieu/Cube-Python-1.0
Use pre-built binary
# Download pre-built binary from:
# https://github.com/ggerganov/llama.cpp/releases
# Start a local OpenAI-compatible server with a web UI:
./llama-server -hf NguyenDinhHieu/Cube-Python-1.0
# Run inference directly in the terminal:
./llama-cli -hf NguyenDinhHieu/Cube-Python-1.0
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
cmake -B build
cmake --build build -j --target llama-server llama-cli
# Start a local OpenAI-compatible server with a web UI:
./build/bin/llama-server -hf NguyenDinhHieu/Cube-Python-1.0
# Run inference directly in the terminal:
./build/bin/llama-cli -hf NguyenDinhHieu/Cube-Python-1.0
Use Docker
docker model run hf.co/NguyenDinhHieu/Cube-Python-1.0
Quick Links

AI Python — Code Assistant (LangChain + CTransformers)

Demo chạy LLM dạng GGUF bằng ctransformers + langchain để trả lời theo prompt: “chỉ trả lời bằng code Python”.

Demo nhanh

  • Input: một yêu cầu/bài toán Python (text)
  • Output: chỉ code Python (không giải thích)

File chạy chính: app.py
Model mặc định: Cube-Python.gguf

Cài đặt

Tạo môi trường ảo (khuyến nghị) rồi cài dependencies:

pip install -U langchain langchain-community ctransformers

Chạy

Đảm bảo file model Cube-Python.gguf nằm cùng thư mục với app.py, rồi chạy:

python app.py

Cấu hình (trong app.py)

  • MODEL_FILE: tên file GGUF (mặc định Cube-Python.gguf)
  • MODEL_TYPE: loại model cho CTransformers (mặc định llama)
  • GPU_LAYERS:
    • 0 = chạy CPU
    • nếu máy có GPU VRAM đủ, tăng lên (ví dụ 10–20) để nhanh hơn
  • CONTEXT_LENGTH: độ dài ngữ cảnh (mặc định 4096)

Cấu trúc repo

  • app.py: prompt + chain (LangChain) + load model GGUF (CTransformers)
  • Cube-Python.gguf: file model GGUF

Ví dụ prompt

Bạn có thể thay biến question trong app.py bằng bài toán của bạn (tiếng Việt/tiếng Anh đều được).

Credits

  • LangChain
  • CTransformers

Nếu bạn thấy hay

Cho mình xin 1 follow trên Hugging Face và 1 tym (like) cho repo nhé. ❤️

Downloads last month
485
GGUF
Model size
3B params
Architecture
qwen2
Hardware compatibility
Log In to add your hardware

We're not able to determine the quantization variants.

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support