Cypher Query Generator
Model Overview
The Cypher Query Generator is a fine-tuned T5 model designed to translate natural language descriptions into Cypher queries. This model was trained on a dataset derived from WikiSQL examples that have been converted into Cypher queries, making it well-suited for generating queries compatible with Neo4j databases.
Model Details
- Architecture: T5
- Training Data: WikiSQL examples converted to Cypher queries
- Primary Use Case: Generating Cypher queries from natural language descriptions
How to Use
To generate a Cypher query using this model, you can provide a natural language description, and the model will output the corresponding Cypher query. For instance, if you want to find all employees who joined the company after 2015, you can use the following Python code:
from transformers import T5Tokenizer, T5ForConditionalGeneration
# Load pre-trained model and tokenizer
model_name = 'VPrashant/cypher-gen'
tokenizer = T5Tokenizer.from_pretrained(model_name)
model = T5ForConditionalGeneration.from_pretrained(model_name)
# Example input for testing
test_input = "Which employees joined the company after 2015?"
test_encoding = tokenizer(test_input, return_tensors="pt", max_length=128, truncation=True, padding="max_length")
# Generate Cypher query
output = model.generate(input_ids=test_encoding['input_ids'], max_length=128)
generated_query = tokenizer.decode(output[0], skip_special_tokens=True)
print("Generated Cypher Query:", generated_query)
- Downloads last month
- 23