You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PostgresML is a PostgreSQL extension that enables you to perform ML training and inference on text and tabular data using SQL queries. With PostgresML, you can seamlessly integrate machine learning models into your PostgreSQL database and harness the power of cutting-edge algorithms to process text and tabular data efficiently.
@@ -729,16 +728,52 @@ SELECT pgml.transform(
729
728
{"generated_text": "Je suis très heureux"}
730
729
]
731
730
```
731
+
Similar to other tasks, we can specify a model for text-to-text generation.
732
732
733
+
```sql
734
+
SELECTpgml.transform(
735
+
task =>'{
736
+
"task" : "text2text-generation",
737
+
"model" : "bigscience/T0"
738
+
}'::JSONB,
739
+
inputs => ARRAY[
740
+
'Is the word ''table'' used in the same meaning in the two previous sentences? Sentence A: you can leave the books on the table over there. Sentence B: the tables in this book are very hard to read.'
741
+
742
+
]
743
+
) AS answer;
744
+
745
+
```
733
746
## Fill-Mask
747
+
Fill-mask refers to a task where certain words in a sentence are hidden or "masked", and the objective is to predict what words should fill in those masked positions. Such models are valuable when we want to gain statistical insights about the language used to train the model.
734
748

735
749
736
-
## Sentence Similarity
750
+
```sql
751
+
SELECTpgml.transform(
752
+
task =>'{
753
+
"task" : "fill-mask"
754
+
}'::JSONB,
755
+
inputs => ARRAY[
756
+
'Paris is the <mask> of France.'
757
+
758
+
]
759
+
) AS answer;
760
+
```
761
+
*Result*
762
+
```json
763
+
[
764
+
{"score": 0.679, "token": 812, "sequence": "Paris is the capital of France.", "token_str": " capital"},
765
+
{"score": 0.051, "token": 32357, "sequence": "Paris is the birthplace of France.", "token_str": " birthplace"},
766
+
{"score": 0.038, "token": 1144, "sequence": "Paris is the heart of France.", "token_str": " heart"},
767
+
{"score": 0.024, "token": 29778, "sequence": "Paris is the envy of France.", "token_str": " envy"},
768
+
{"score": 0.022, "token": 1867, "sequence": "Paris is the Capital of France.", "token_str": " Capital"}]
769
+
```
770
+
<!-- ## Sentence Similarity
771
+
Sentence Similarity involves determining the degree of similarity between two texts. To accomplish this, Sentence similarity models convert the input texts into vectors (embeddings) that encapsulate semantic information, and then measure the proximity (or similarity) between the vectors. This task is especially beneficial for tasks such as information retrieval and clustering/grouping.
0 commit comments