🌐 AI搜索 & 代理 主页
Skip to content

Commit 6d60aac

Browse files
montanalowlevkk
andauthored
Add more docs (#1455)
Co-authored-by: Lev Kokotov <levkk@users.noreply.github.com>
1 parent 85e36ee commit 6d60aac

File tree

79 files changed

+1451
-727
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1451
-727
lines changed

README.md

Lines changed: 51 additions & 51 deletions
Large diffs are not rendered by default.

pgml-cms/blog/announcing-gptq-and-ggml-quantized-llm-support-for-huggingface-transformers.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ You can select the data type for torch tensors in PostgresML by setting the `tor
4141

4242
!!! code\_block time="4584.906 ms"
4343

44-
```sql
44+
```postgresql
4545
SELECT pgml.transform(
4646
task => '{
4747
"model": "tiiuae/falcon-7b-instruct",
@@ -102,7 +102,7 @@ PostgresML will automatically use GPTQ or GGML when a HuggingFace model has one
102102

103103
!!! code\_block time="281.213 ms"
104104

105-
```sql
105+
```postgresql
106106
SELECT pgml.transform(
107107
task => '{
108108
"task": "text-generation",
@@ -136,7 +136,7 @@ SELECT pgml.transform(
136136

137137
!!! code\_block time="252.213 ms"
138138

139-
```sql
139+
```postgresql
140140
SELECT pgml.transform(
141141
task => '{
142142
"task": "text-generation",
@@ -167,7 +167,7 @@ SELECT pgml.transform(
167167

168168
!!! code\_block time="279.888 ms"
169169

170-
```sql
170+
```postgresql
171171
SELECT pgml.transform(
172172
task => '{
173173
"task": "text-generation",
@@ -204,7 +204,7 @@ We can specify the CPU by passing a `"device": "cpu"` argument to the `task`.
204204

205205
!!! code\_block time="266.997 ms"
206206

207-
```sql
207+
```postgresql
208208
SELECT pgml.transform(
209209
task => '{
210210
"task": "text-generation",
@@ -236,7 +236,7 @@ SELECT pgml.transform(
236236

237237
!!! code\_block time="33224.136 ms"
238238

239-
```sql
239+
```postgresql
240240
SELECT pgml.transform(
241241
task => '{
242242
"task": "text-generation",
@@ -274,7 +274,7 @@ HuggingFace and these libraries have a lot of great models. Not all of these mod
274274

275275
!!! code\_block time="3411.324 ms"
276276

277-
```sql
277+
```postgresql
278278
SELECT pgml.transform(
279279
task => '{
280280
"task": "text-generation",
@@ -306,7 +306,7 @@ SELECT pgml.transform(
306306

307307
!!! code\_block time="4198.817 ms"
308308

309-
```sql
309+
```postgresql
310310
SELECT pgml.transform(
311311
task => '{
312312
"task": "text-generation",
@@ -338,7 +338,7 @@ SELECT pgml.transform(
338338

339339
!!! code\_block time="4198.817 ms"
340340

341-
```sql
341+
```postgresql
342342
SELECT pgml.transform(
343343
task => '{
344344
"task": "text-generation",
@@ -372,7 +372,7 @@ Many of these models are published with multiple different quantization methods
372372

373373
!!! code\_block time="6498.597"
374374

375-
```sql
375+
```postgresql
376376
SELECT pgml.transform(
377377
task => '{
378378
"task": "text-generation",
@@ -410,7 +410,7 @@ Shoutout to [Tostino](https://github.com/Tostino/) for the extended example belo
410410

411411
!!! code\_block time="3784.565"
412412

413-
```sql
413+
```postgresql
414414
SELECT pgml.transform(
415415
task => '{
416416
"task": "text-generation",

pgml-cms/blog/generating-llm-embeddings-with-open-source-models-in-postgresml.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Aside from using this function with strings passed from a client, we can use it
142142

143143
!!! generic
144144

145-
!!! code\_block time="54.820 ms"
145+
!!! code_block time="54.820 ms"
146146

147147
```postgresql
148148
SELECT
@@ -156,7 +156,7 @@ LIMIT 1;
156156

157157
!!! results
158158

159-
```
159+
```postgressql
160160
CREATE INDEX
161161
```
162162

pgml-cms/blog/how-to-improve-search-results-with-machine-learning.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Our search application will start with a **documents** table. Our documents have
3636

3737
!!! code\_block time="10.493 ms"
3838

39-
```sql
39+
```postgresql
4040
CREATE TABLE documents (
4141
id BIGSERIAL PRIMARY KEY,
4242
title TEXT,
@@ -54,7 +54,7 @@ We can add new documents to our _text corpus_ with the standard SQL `INSERT` sta
5454

5555
!!! code\_block time="3.417 ms"
5656

57-
```sql
57+
```postgresql
5858
INSERT INTO documents (title, body) VALUES
5959
('This is a title', 'This is the body of the first document.'),
6060
('This is another title', 'This is the body of the second document.'),
@@ -79,7 +79,7 @@ You can configure the grammatical rules in many advanced ways, but we'll use the
7979

8080
!!! code\_block time="0.651 ms"
8181

82-
```sql
82+
```postgresql
8383
SELECT *
8484
FROM documents
8585
WHERE to_tsvector('english', body) @@ to_tsquery('english', 'second');
@@ -109,7 +109,7 @@ The first step is to store the `tsvector` in the table, so we don't have to gene
109109

110110
!!! code\_block time="17.883 ms"
111111

112-
```sql
112+
```postgresql
113113
ALTER TABLE documents
114114
ADD COLUMN title_and_body_text tsvector
115115
GENERATED ALWAYS AS (to_tsvector('english', title || ' ' || body )) STORED;
@@ -125,7 +125,7 @@ One nice aspect of generated columns is that they will backfill the data for exi
125125

126126
!!! code\_block time="5.145 ms"
127127

128-
```sql
128+
```postgresql
129129
CREATE INDEX documents_title_and_body_text_index
130130
ON documents
131131
USING GIN (title_and_body_text);
@@ -141,7 +141,7 @@ And now, we'll demonstrate a slightly more complex `tsquery`, that requires both
141141

142142
!!! code\_block time="3.673 ms"
143143

144-
```sql
144+
```postgresql
145145
SELECT *
146146
FROM documents
147147
WHERE title_and_body_text @@ to_tsquery('english', 'another & second');
@@ -171,7 +171,7 @@ With multiple query terms OR `|` together, the `ts_rank` will add the numerators
171171

172172
!!! code\_block time="0.561 ms"
173173

174-
```sql
174+
```postgresql
175175
SELECT ts_rank(title_and_body_text, to_tsquery('english', 'second | title')), *
176176
FROM documents
177177
ORDER BY ts_rank DESC;
@@ -201,7 +201,7 @@ A quick improvement we could make to our search query would be to differentiate
201201

202202
!!! code\_block time="0.561 ms"
203203

204-
```sql
204+
```postgresql
205205
SELECT
206206
ts_rank(title, to_tsquery('english', 'second | title')) AS title_rank,
207207
ts_rank(body, to_tsquery('english', 'second | title')) AS body_rank,
@@ -230,7 +230,7 @@ First things first, we need to record some user clicks on our search results. We
230230

231231
!!! code\_block time="0.561 ms"
232232

233-
```sql
233+
```postgresql
234234
CREATE TABLE search_result_clicks (
235235
title_rank REAL,
236236
body_rank REAL,
@@ -250,7 +250,7 @@ I've made up 4 example searches, across our 3 documents, and recorded the `ts_ra
250250

251251
!!! code\_block time="2.161 ms"
252252

253-
```sql
253+
```postgresql
254254
INSERT INTO search_result_clicks
255255
(title_rank, body_rank, clicked)
256256
VALUES
@@ -289,7 +289,7 @@ Here goes some machine learning:
289289

290290
!!! code\_block time="6.867 ms"
291291

292-
```sql
292+
```postgresql
293293
SELECT * FROM pgml.train(
294294
project_name => 'Search Ranking',
295295
task => 'regression',
@@ -336,7 +336,7 @@ Once a model is trained, you can use `pgml.predict` to use it on new inputs. `pg
336336

337337
!!! code\_block time="3.119 ms"
338338

339-
```sql
339+
```postgresql
340340
SELECT
341341
clicked,
342342
pgml.predict('Search Ranking', array[title_rank, body_rank])
@@ -389,7 +389,7 @@ It's nice to organize the query into logical steps, and we can use **Common Tabl
389389

390390
!!! code\_block time="2.118 ms"
391391

392-
```sql
392+
```postgresql
393393
WITH first_pass_ranked_documents AS (
394394
SELECT
395395
-- Compute the ts_rank for the title and body text of each document

pgml-cms/blog/mindsdb-vs-postgresml.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ For both implementations, we can just pass in our data as part of the query for
9494

9595
!!! code\_block time="4769.337 ms"
9696

97-
```sql
97+
```postgresql
9898
SELECT pgml.transform(
9999
inputs => ARRAY[
100100
'I am so excited to benchmark deep learning models in SQL. I can not wait to see the results!'
@@ -124,7 +124,7 @@ The first time `transform` is run with a particular model name, it will download
124124

125125
!!! code\_block time="45.094 ms"
126126

127-
```sql
127+
```postgresql
128128
SELECT pgml.transform(
129129
inputs => ARRAY[
130130
'I don''t really know if 5 seconds is fast or slow for deep learning. How much time is spent downloading vs running the model?'
@@ -154,7 +154,7 @@ SELECT pgml.transform(
154154

155155
!!! code\_block time="165.036 ms"
156156

157-
```sql
157+
```postgresql
158158
SELECT pgml.transform(
159159
inputs => ARRAY[
160160
'Are GPUs really worth it? Sometimes they are more expensive than the rest of the computer combined.'
@@ -209,7 +209,7 @@ psql postgres://mindsdb:123@127.0.0.1:55432
209209

210210
And turn timing on to see how long it takes to run the same query:
211211

212-
```sql
212+
```postgresql
213213
\timing on
214214
```
215215

pgml-cms/blog/pg-stat-sysinfo-a-postgres-extension-for-querying-system-statistics.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ All system statistics are stored together in this one structure.
6262

6363
!!! code\_block
6464

65-
```sql
65+
```postgresql
6666
SELECT * FROM pg_stat_sysinfo
6767
WHERE metric = 'load_average'
6868
AND at BETWEEN '2023-04-07 19:20:09.3'
@@ -97,7 +97,7 @@ In the case of the load average, we could handle this situation by having a tabl
9797

9898
!!! code\_block
9999

100-
```sql
100+
```postgresql
101101
CREATE TABLE load_average (
102102
at timestamptz NOT NULL DEFAULT now(),
103103
"1m" float4 NOT NULL,
@@ -112,7 +112,7 @@ This structure is fine for `load_average` but wouldn't work for CPU, disk, RAM o
112112

113113
!!! code\_block
114114

115-
```sql
115+
```postgresql
116116
CREATE TABLE load_average (
117117
at timestamptz NOT NULL DEFAULT now(),
118118
"1m" float4 NOT NULL,
@@ -132,7 +132,7 @@ This has the disadvantage of baking in a lot of keys and the overall structure o
132132

133133
!!! code\_block
134134

135-
```sql
135+
```postgresql
136136
CREATE TABLE load_average (
137137
at timestamptz NOT NULL DEFAULT now(),
138138
"1m" float4 NOT NULL,

pgml-cms/blog/postgres-full-text-search-is-awesome.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ These queries can execute in milliseconds on large production-sized corpora with
5454

5555
The following full blown example is for demonstration purposes only of a 3rd generation search engine. You can test it for real in the PostgresML Gym to build up a complete understanding.
5656

57-
```sql
57+
```postgresql
5858
WITH query AS (
5959
-- construct a query context with arguments that would typically be
6060
-- passed in from the application layer

0 commit comments

Comments
 (0)