File size: 1,717 Bytes
24ba880
e4b3c1f
6b42843
 
 
 
 
e4b3c1f
6b42843
e4b3c1f
24ba880
e4b3c1f
24ba880
6b42843
 
 
 
 
 
 
24ba880
e4b3c1f
6b42843
 
 
 
 
 
797e76b
6b42843
 
 
797e76b
 
 
6b42843
 
797e76b
 
 
 
24ba880
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
tags:
  - text2cypher
  - cypher
  - neo4j
  - natural-language-processing
  - artificial-intelligence
widget:
  - text: "Which employees joined the company after 2015?"
---

# 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:

```python
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)