Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 592fc59

Browse filesBrowse files
committed
Added fill mask section
1 parent 8381fe8 commit 592fc59
Copy full SHA for 592fc59

File tree

1 file changed

+41
-6
lines changed
Filter options

1 file changed

+41
-6
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+41-6Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@
4545
- [Text Generation](#text-generation)
4646
- [Text-to-Text Generation](#text-to-text-generation)
4747
- [Fill-Mask](#fill-mask)
48-
- [Sentence Similarity](#sentence-similarity)
49-
- [Regression](#regression)
50-
- [Classification](#classification)
48+
<!-- - [Regression](#regression)
49+
- [Classification](#classification) -->
5150

5251
# Introduction
5352
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(
729728
{"generated_text": "Je suis très heureux"}
730729
]
731730
```
731+
Similar to other tasks, we can specify a model for text-to-text generation.
732732

733+
```sql
734+
SELECT pgml.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+
```
733746
## 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.
734748
![fill mask](pgml-docs/docs/images/fill-mask.png)
735749

736-
## Sentence Similarity
750+
```sql
751+
SELECT pgml.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.
737772
![sentence similarity](pgml-docs/docs/images/sentence-similarity.png)
738773
739774
<!-- ## Conversational -->
740-
# Regression
741-
# Classification
775+
<!-- # Regression
776+
# Classification -->
742777

743778

744779

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.