Update README.md
Browse files
README.md
CHANGED
|
@@ -8,7 +8,7 @@ language:
|
|
| 8 |
# What does this model do?
|
| 9 |
This model converts the natural language input to MongoDB (MQL) query. It is a fine-tuned CodeT5+ 220M. This model is a part of nl2query repository which is present at https://github.com/Chirayu-Tripathi/nl2query
|
| 10 |
|
| 11 |
-
You can use this model via the github repository or via following code.
|
| 12 |
|
| 13 |
```python
|
| 14 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
|
@@ -17,6 +17,8 @@ model = AutoModelForSeq2SeqLM.from_pretrained("Chirayu/nl2mongo")
|
|
| 17 |
tokenizer = AutoTokenizer.from_pretrained("Chirayu/nl2mongo")
|
| 18 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 19 |
model = model.to(device)
|
|
|
|
|
|
|
| 20 |
def generate_query(
|
| 21 |
textual_query: str,
|
| 22 |
num_beams: int = 10,
|
|
|
|
| 8 |
# What does this model do?
|
| 9 |
This model converts the natural language input to MongoDB (MQL) query. It is a fine-tuned CodeT5+ 220M. This model is a part of nl2query repository which is present at https://github.com/Chirayu-Tripathi/nl2query
|
| 10 |
|
| 11 |
+
You can use this model via the github repository or via following code. More information can be found on the repository.
|
| 12 |
|
| 13 |
```python
|
| 14 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
|
|
|
| 17 |
tokenizer = AutoTokenizer.from_pretrained("Chirayu/nl2mongo")
|
| 18 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 19 |
model = model.to(device)
|
| 20 |
+
|
| 21 |
+
textual_query = '''mongo: which cabinet has average age less than 21? | titanic : _id, passengerid, survived, pclass, name, sex, age, sibsp, parch, ticket, fare, cabin, embarked'''
|
| 22 |
def generate_query(
|
| 23 |
textual_query: str,
|
| 24 |
num_beams: int = 10,
|