Update README.md
Browse files
README.md
CHANGED
|
@@ -26,18 +26,17 @@ To generate a Cypher query using this model, you can provide a natural language
|
|
| 26 |
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
| 27 |
|
| 28 |
# Load pre-trained model and tokenizer
|
| 29 |
-
model_name = '
|
| 30 |
tokenizer = T5Tokenizer.from_pretrained(model_name)
|
| 31 |
model = T5ForConditionalGeneration.from_pretrained(model_name)
|
| 32 |
|
| 33 |
-
#
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
# Tokenize input
|
| 37 |
-
inputs = tokenizer.encode(input_text, return_tensors='pt')
|
| 38 |
|
| 39 |
# Generate Cypher query
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
| 42 |
|
| 43 |
-
print("Generated Cypher Query:", cypher_query)
|
|
|
|
| 26 |
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
| 27 |
|
| 28 |
# Load pre-trained model and tokenizer
|
| 29 |
+
model_name = 'VPrashant/cypher-gen'
|
| 30 |
tokenizer = T5Tokenizer.from_pretrained(model_name)
|
| 31 |
model = T5ForConditionalGeneration.from_pretrained(model_name)
|
| 32 |
|
| 33 |
+
# Example input for testing
|
| 34 |
+
test_input = "Which employees joined the company after 2015?"
|
| 35 |
+
test_encoding = tokenizer(test_input, return_tensors="pt", max_length=128, truncation=True, padding="max_length")
|
|
|
|
|
|
|
| 36 |
|
| 37 |
# Generate Cypher query
|
| 38 |
+
output = model.generate(input_ids=test_encoding['input_ids'], max_length=128)
|
| 39 |
+
generated_query = tokenizer.decode(output[0], skip_special_tokens=True)
|
| 40 |
+
|
| 41 |
+
print("Generated Cypher Query:", generated_query)
|
| 42 |
|
|
|