Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit44d8133

Browse files
committed
README updates
1 parent27e1029 commit44d8133

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
<palign="center">
22-
Generative AI andSimple ML with
22+
Generative AI andTraditional 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
SELECTpgml.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 areveryhard to read.'
761+
'translate from English to French: I''mveryhappy'
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-
CREATEINDEXON tweet_embeddings USING ivfflat (embedding vector_cosine_ops);
848+
CREATE EXTENSION vector;-- installing pgvector
849+
850+
CREATETABLEitems (texttext, embedding vector(768));
851+
insert into itemsselecttext, embeddingfrom tweet_embeddings;
852+
853+
CREATEINDEXON 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)

[8]ページ先頭

©2009-2025 Movatter.jp