Content-Length: 350817 | pFad | http://github.com/postgresml/postgresml/commit/44d81339e969bf0e30c20a2d125bc19da807fe77

69 README updates · postgresml/postgresml@44d8133 · GitHub
Skip to content

Commit 44d8133

Browse files
committed
README updates
1 parent 27e1029 commit 44d8133

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</h2>
2020

2121
<p align="center">
22-
Generative AI and Simple ML with
22+
Generative AI and Traditional ML with
2323
<a href="https://www.postgresql.org/" target="_blank">PostgreSQL</a>
2424
</p>
2525

@@ -86,6 +86,7 @@ SELECT pgml.transform(
8686

8787

8888
**Sentiment Analysis**
89+
8990
*SQL query*
9091

9192
```sql
@@ -754,15 +755,21 @@ Similar to other tasks, we can specify a model for text-to-text generation.
754755
SELECT pgml.transform(
755756
task => '{
756757
"task" : "text2text-generation",
757-
"model" : "bigscience/T0"
758+
"model" : "t5-small"
758759
}'::JSONB,
759760
inputs => ARRAY[
760-
'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.'
761+
'translate from English to French: I''m very happy'
761762

762763
]
763764
) AS answer;
764-
765765
```
766+
*Result*
767+
```json
768+
[
769+
{"generated_text": "Je suis très heureux"}
770+
]
771+
```
772+
766773
## Fill-Mask
767774
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.
768775
![fill mask](pgml-docs/docs/images/fill-mask.png)
@@ -838,8 +845,14 @@ The index is being created on the embedding column in the tweet_embeddings table
838845
By creating an index on the embedding column, the database can quickly search for and retrieve records that are similar to a given query vector. This can be useful for a variety of machine learning applications, such as similarity search or recommendation systems.
839846

840847
```sql
841-
CREATE INDEX ON tweet_embeddings USING ivfflat (embedding vector_cosine_ops);
848+
CREATE EXTENSION vector; -- installing pgvector
849+
850+
CREATE TABLE items (text text, embedding vector(768));
851+
insert into items select text, embedding from tweet_embeddings;
852+
853+
CREATE INDEX ON items USING ivfflat (embedding vector_cosine_ops);
842854
```
855+
843856
## Step 3: Querying the index using embeddings for your queries
844857
Once your embeddings have been indexed, you can use them to perform queries against your database. To do this, you'll need to provide a query embedding that represents the query you want to perform. The index will then return the closest matching embeddings from your database, based on the similarity between the query embedding and the stored embeddings.
845858

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgresml/postgresml/commit/44d81339e969bf0e30c20a2d125bc19da807fe77

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy