Instructions to use Azzedde/llama3.1-8b-text2cypher with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Azzedde/llama3.1-8b-text2cypher with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Azzedde/llama3.1-8b-text2cypher") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Azzedde/llama3.1-8b-text2cypher") model = AutoModelForCausalLM.from_pretrained("Azzedde/llama3.1-8b-text2cypher") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Azzedde/llama3.1-8b-text2cypher with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Azzedde/llama3.1-8b-text2cypher" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Azzedde/llama3.1-8b-text2cypher", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Azzedde/llama3.1-8b-text2cypher
- SGLang
How to use Azzedde/llama3.1-8b-text2cypher with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Azzedde/llama3.1-8b-text2cypher" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Azzedde/llama3.1-8b-text2cypher", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Azzedde/llama3.1-8b-text2cypher" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Azzedde/llama3.1-8b-text2cypher", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio new
How to use Azzedde/llama3.1-8b-text2cypher 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 Azzedde/llama3.1-8b-text2cypher 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 Azzedde/llama3.1-8b-text2cypher to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Azzedde/llama3.1-8b-text2cypher to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="Azzedde/llama3.1-8b-text2cypher", max_seq_length=2048, ) - Docker Model Runner
How to use Azzedde/llama3.1-8b-text2cypher with Docker Model Runner:
docker model run hf.co/Azzedde/llama3.1-8b-text2cypher
Model Card for Llama3.1-8B-Cypher
Model Details
Model Description
This is the model card for Llama3.1-8B-Cypher, a fine-tuned version of Meta’s Llama-3.1-8B, optimized for generating Cypher queries from natural language input. The model has been trained using Unsloth for efficient fine-tuning and inference.
Developed by: Azzedine (GitHub: Azzedde)
Funded by [optional]: N/A
Shared by [optional]: Azzedde
Model Type: Large Language Model (LLM) optimized for Cypher query generation
Language(s) (NLP): English
License: Apache 2.0
Finetuned from model [optional]: Meta-Llama-3.1-8B-Instruct
Model Sources
Repository: Hugging Face
Paper [optional]: N/A
Demo [optional]: N/A
Uses
Direct Use
This model is designed for generating Cypher queries for Neo4j databases based on natural language inputs. It can be used in:
- Database administration
- Knowledge graph construction
- Query automation for structured data retrieval
Downstream Use [optional]
- Integrating into LLM-based database assistants
- Automating graph database interactions in enterprise applications
- Enhancing semantic search and recommendation systems
Out-of-Scope Use
- General NLP tasks unrelated to graph databases
- Applications requiring strong factual accuracy outside Cypher query generation
Bias, Risks, and Limitations
- The model may generate incorrect or suboptimal Cypher queries, especially for complex database schemas.
- The model has not been trained to validate or optimize queries, so users should manually verify generated queries.
- Limited to English-language inputs and Neo4j graph database use cases.
Recommendations
Users should be aware of:
- The importance of validating model-generated queries before execution.
- The potential for biases in database schema interpretation.
- The need for fine-tuning on domain-specific datasets for best performance.
How to Get Started with the Model
Use the following code to load and use the model:
from unsloth import FastLanguageModel
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("Azzedde/llama3.1-8b-text2cypher")
model = FastLanguageModel.from_pretrained("Azzedde/llama3.1-8b-text2cypher")
# Example inference
cypher_prompt = """Below is a database Neo4j schema and a question related to that database. Write a Cypher query to answer the question.
### Schema:
{schema}
### Question:
{question}
### Cypher:
"""
input_text = cypher_prompt.format(schema="<Your Schema>", question="Find all users with more than 5 transactions")
inputs = tokenizer(input_text, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=64, use_cache=True)
print(tokenizer.decode(outputs[0]))
Training Details
Training Data: The model was fine-tuned on the Neo4j Text2Cypher dataset (2024v1).
Training Procedure:
- Preprocessing: Tokenized using the Alpaca format.
- Training Hyperparameters:
batch_size=2gradient_accumulation_steps=4num_train_epochs=3learning_rate=2e-4fp16=True
Evaluation
Testing Data
- Used the Neo4j Text2Cypher 2024v1 test split.
Factors
- Model performance was measured on accuracy of Cypher query generation.
Metrics
- Exact Match with ground truth Cypher queries.
- Execution Success Rate on a test Neo4j instance.
Results
- High accuracy for standard database queries.
- Some errors in complex queries requiring multi-hop reasoning.
Environmental Impact
Hardware Type: Tesla T4 (Google Colab)
Hours Used: ~7.71 minutes
Cloud Provider: Google Colab
Compute Region: N/A
Carbon Emitted: Estimated using ML Impact calculator
Technical Specifications
Model Architecture and Objective
- Based on Llama-3.1 8B with LoRA fine-tuning.
Compute Infrastructure
- Fine-tuned using Unsloth for efficient training and inference.
Hardware
- GPU: Tesla T4
- Max Reserved Memory: ~7.922 GB
Software
- Libraries Used:
unsloth,transformers,TRL,datasets
Citation [optional]
BibTeX:
@article{llama3.1-8b-cypher,
author = {Azzedde},
title = {Llama3.1-8B-Cypher: A Cypher Query Generation Model},
year = {2025},
url = {https://huggingface.co/Azzedde/llama3.1-8b-text2cypher}
}
APA:
Azzedde. (2025). Llama3.1-8B-Cypher: A Cypher Query Generation Model. Retrieved from Hugging Face
More Information
For questions, reach out via Hugging Face discussions or GitHub issues.
Model Card Authors
- Azzedde (GitHub: Azzedde)
Model Card Contact
Contact: Hugging Face Profile
- Downloads last month
- 1,285
Model tree for Azzedde/llama3.1-8b-text2cypher
Base model
meta-llama/Llama-3.1-8B