Instructions to use QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF", dtype="auto") - llama-cpp-python
How to use QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF", filename="Meta-Llama-3.1-8B-Text-to-SQL.Q2_K.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF:Q4_K_M
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 QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF:Q4_K_M
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 QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF with Ollama:
ollama run hf.co/QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF:Q4_K_M
- Unsloth Studio new
How to use QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF 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 QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF 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 QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF to start chatting
- Docker Model Runner
How to use QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.Meta-Llama-3.1-8B-Text-to-SQL-GGUF-Q4_K_M
List all available models
lemonade list
QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF
This is quantized version of ruslanmv/Meta-Llama-3.1-8B-Text-to-SQL created using llama.cpp
Original Model Card
Meta LLaMA 3.1 8B 4-bit Finetuned Model
This model is a fine-tuned version of Meta-Llama-3.1-8B, developed by ruslanmv for text generation tasks. It leverages 4-bit quantization, making it more efficient for inference while maintaining strong performance in natural language generation.
Model Details
- Base Model:
unsloth/meta-llama-3.1-8b-bnb-4bit - Finetuned by: ruslanmv
- Language: English
- License: Apache 2.0
- Tags:
- text-generation-inference
- transformers
- unsloth
- llama
- trl
- sft
Model Usage
Installation
To use this model, you will need to install the necessary libraries:
pip install transformers accelerate
Loading the Model in Python
Here’s an example of how to load this fine-tuned model using Hugging Face's transformers library:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load the model and tokenizer
model_name = "ruslanmv/Meta-Llama-3.1-8B-Text-to-SQL"
# Ensure you have the right device setup
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# Load the model and tokenizer from the Hugging Face Hub
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", torch_dtype=torch.float16)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Initialize the tokenizer (adjust the model name as needed)
# Define EOS token for terminating the sequences
EOS_TOKEN = tokenizer.eos_token
# Define Alpaca-style prompt template
alpaca_prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
{}
### Input:
{}
### Response:
"""
# Format the prompt without the response part
prompt = alpaca_prompt.format(
"Provide the SQL query",
"Seleziona tutte le colonne della tabella table1 dove la colonna anni è uguale a 2020"
)
# Tokenize the prompt and generate text
inputs = tokenizer([prompt], return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=64, use_cache=True)
# Decode the generated text
generated_text = tokenizer.batch_decode(outputs, skip_special_tokens=True)[0]
# Extract the generated response only (remove the prompt part)
response_start = generated_text.find("### Response:") + len("### Response:\n")
response = generated_text[response_start:].strip()
# Print the response (excluding the prompt)
print(response)
and the answer is
SELECT * FROM table1 WHERE anni = 2020
Model Features
- Text Generation: This model is fine-tuned to generate coherent and contextually accurate text based on the provided input.
License
This model is licensed under the Apache 2.0 License. You are free to use, modify, and distribute this model, provided that you comply with the license terms.
Acknowledgments
This model was fine-tuned by ruslanmv based on the original work of unsloth and the meta-llama-3.1-8b-bnb-4bit model.
- Downloads last month
- 197
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit
docker model run hf.co/QuantFactory/Meta-Llama-3.1-8B-Text-to-SQL-GGUF: