Instructions to use Adhishtanaka/llama_3.2_1b_SQL with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use Adhishtanaka/llama_3.2_1b_SQL with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Adhishtanaka/llama_3.2_1b_SQL", filename="llama_3.2_1b_SQL.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use Adhishtanaka/llama_3.2_1b_SQL with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Adhishtanaka/llama_3.2_1b_SQL # Run inference directly in the terminal: llama-cli -hf Adhishtanaka/llama_3.2_1b_SQL
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Adhishtanaka/llama_3.2_1b_SQL # Run inference directly in the terminal: llama-cli -hf Adhishtanaka/llama_3.2_1b_SQL
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 Adhishtanaka/llama_3.2_1b_SQL # Run inference directly in the terminal: ./llama-cli -hf Adhishtanaka/llama_3.2_1b_SQL
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 Adhishtanaka/llama_3.2_1b_SQL # Run inference directly in the terminal: ./build/bin/llama-cli -hf Adhishtanaka/llama_3.2_1b_SQL
Use Docker
docker model run hf.co/Adhishtanaka/llama_3.2_1b_SQL
- LM Studio
- Jan
- Ollama
How to use Adhishtanaka/llama_3.2_1b_SQL with Ollama:
ollama run hf.co/Adhishtanaka/llama_3.2_1b_SQL
- Unsloth Studio new
How to use Adhishtanaka/llama_3.2_1b_SQL with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Adhishtanaka/llama_3.2_1b_SQL to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Adhishtanaka/llama_3.2_1b_SQL to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Adhishtanaka/llama_3.2_1b_SQL to start chatting
- Pi new
How to use Adhishtanaka/llama_3.2_1b_SQL with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf Adhishtanaka/llama_3.2_1b_SQL
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Adhishtanaka/llama_3.2_1b_SQL" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use Adhishtanaka/llama_3.2_1b_SQL with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf Adhishtanaka/llama_3.2_1b_SQL
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default Adhishtanaka/llama_3.2_1b_SQL
Run Hermes
hermes
- Docker Model Runner
How to use Adhishtanaka/llama_3.2_1b_SQL with Docker Model Runner:
docker model run hf.co/Adhishtanaka/llama_3.2_1b_SQL
- Lemonade
How to use Adhishtanaka/llama_3.2_1b_SQL with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Adhishtanaka/llama_3.2_1b_SQL
Run and chat with the model
lemonade run user.llama_3.2_1b_SQL-{{QUANT_TAG}}List all available models
lemonade list
Fine-tuning LLaMA 3.2 1B for SQL Generation
This project is about fine-tuning a small LLaMA model (1B) to generate SQL queries from natural language. I'm using a dataset that contains examples of how people ask questions and how those get translated into SQL.
What I'm Doing
- I'm starting with a pre-trained LLaMA 3.2 1B model.
- I use a dataset called
synthetic_text_to_sql-ShareGPTwhich has examples of prompts and the corresponding SQL queries.
Dataset URL: https://huggingface.co/datasets/mlabonne/synthetic_text_to_sql-ShareGPT - I fine-tune the model using Unsloth libary with LoRA Adapters. This allows me to train only parts of the model, which makes it much faster and memory-efficient.
Evaluation Process
The evaluation pipeline is implemented in Evaluate_LLM.ipynb:
SQL Question Generation : Groq’s
llama3-8b-8192model generates 10 SQL question blocks, each with table creation, inserts, and a natural language SQL question.Model Answering : Each question is passed to a local fine-tuned LLaMA model (using
llama-cpp-python) to generate SQL queries and explanations.Automated Evaluation : Groq’s
gemma2-9b-itmodel acts as an expert tutor to score each (question, answer) pair on correctness and completeness (1–10 scale) and provide feedback.Summary : Average scores and detailed feedback for all questions are output.
Note:
- The question generation and evaluation both use Groq's hosted models (Llama 3_8b for question generation, Gemma 2_9b for evaluation).
- The local LLaMA_3.2_1b fine tuned model is only used for generating answers.
- Normally, I use Gemini for evaluation, but due to Gemini being slow today, I used Groq for both question generation and evaluation in this run.
Why I’m Doing This
I want to build a model that can understand plain English and generate accurate SQL queries. This can be useful for tools where people want to ask questions about their data without writing SQL themselves.
Where to Find the Model & Notebooks
You can find the fine-tuned model, including the .gguf file format for easy local use, on my Hugging Face repository:
👉 https://huggingface.co/Adhishtanaka/llama_3.2_1b_SQL/tree/main
You can find the Jupyter Notebook files used in this project directly in this repository:
Evaluate_LLM.ipynb: The evaluation pipeline for the fine-tuned model.Llama3.2_1B-SQL.ipynb: The main notebook for fine-tuning and experimentation.
👉 Browse these files in the GitHub repository for full code and documentation.
- Downloads last month
- 7
We're not able to determine the quantization variants.
docker model run hf.co/Adhishtanaka/llama_3.2_1b_SQL