Instructions to use InfAI/flan-t5-text2sparql-custom-tokenizer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use InfAI/flan-t5-text2sparql-custom-tokenizer with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("InfAI/flan-t5-text2sparql-custom-tokenizer") model = AutoModelForSeq2SeqLM.from_pretrained("InfAI/flan-t5-text2sparql-custom-tokenizer", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -45,17 +45,16 @@ inputs = tokenizer_in([sample], return_tensors="pt")
|
|
| 45 |
outputs = model.generate(**inputs)
|
| 46 |
|
| 47 |
print(f"Gold answer: {gold_answer}")
|
| 48 |
-
print(
|
| 49 |
```
|
| 50 |
|
| 51 |
```
|
| 52 |
Gold answer: SELECT ?obj WHERE { wd:Q42168 p:P1082 ?s . ?s ps:P1082 ?obj . ?s pq:P585 ?x filter(contains(YEAR(?x),'2013')) }
|
| 53 |
-
|
| 54 |
```
|
| 55 |
|
| 56 |
Common errors include:
|
| 57 |
|
| 58 |
-
- Adding a `<pad>` token at the beginning
|
| 59 |
- A stray closed curly brace at the end
|
| 60 |
- One of subject / predicate / object is wrong, while the other two are correct
|
| 61 |
|
|
|
|
| 45 |
outputs = model.generate(**inputs)
|
| 46 |
|
| 47 |
print(f"Gold answer: {gold_answer}")
|
| 48 |
+
print(" " + tokenizer_out.decode(outputs[0], skip_special_tokens=True))
|
| 49 |
```
|
| 50 |
|
| 51 |
```
|
| 52 |
Gold answer: SELECT ?obj WHERE { wd:Q42168 p:P1082 ?s . ?s ps:P1082 ?obj . ?s pq:P585 ?x filter(contains(YEAR(?x),'2013')) }
|
| 53 |
+
SELECT?obj WHERE { wd:Q4754 p:P1082?s.?s ps:P1082?obj.?s pq:P585?x filter(contains(YEAR(?x),'2013')) }
|
| 54 |
```
|
| 55 |
|
| 56 |
Common errors include:
|
| 57 |
|
|
|
|
| 58 |
- A stray closed curly brace at the end
|
| 59 |
- One of subject / predicate / object is wrong, while the other two are correct
|
| 60 |
|