huoju commited on
Commit
36395d7
·
verified ·
1 Parent(s): 29e4f08

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +138 -138
README.md CHANGED
@@ -1,138 +1,138 @@
1
- ---
2
- license: apache-2.0
3
- task_categories:
4
- - feature-extraction
5
- language:
6
- - en
7
- size_categories:
8
- - 10M<n<100M
9
- ---
10
-
11
- # `wikipedia_en`
12
-
13
- This is a curated Wikipedia English dataset for use with the [Chipmunk](https://github.com/Intelligent-Internet/Chipmunk) project.
14
-
15
- ## Dataset Details
16
-
17
- ### Dataset Description
18
-
19
- This dataset comprises a curated Wikipedia English pages. Data sourced directly from the official English Wikipedia database dump. We extract the pages, chunk them into smaller pieces, and embed them using [Snowflake/snowflake-arctic-embed-m-v2.0](https://huggingface.co/Snowflake/snowflake-arctic-embed-m-v2.0). All vector embeddings are 16-bit half-precision vectors optimized for `cosine` indexing with [vectorchord](https://github.com/tensorchord/vectorchord).
20
-
21
- ### Dataset Sources
22
-
23
- Based on the [wikipedia dumps](https://dumps.wikimedia.org/). Please check this page for the [LICENSE](https://dumps.wikimedia.org/legal.html) of the page data.
24
-
25
- ## Dataset Structure
26
-
27
- 1. Metadata Table
28
-
29
- - id: A unique identifier for the page.
30
- - revid: The revision ID of the page.
31
- - url: The URL of the page.
32
- - title: The title of the page.
33
- - ignored: Whether the page is ignored.
34
- - created_at: The creation time of the page.
35
- - updated_at: The update time of the page.
36
-
37
- 2. Chunking Table
38
-
39
- - id: A unique identifier for the chunk.
40
- - title: The title of the page.
41
- - url: The URL of the page.
42
- - source_id: The source ID of the page.
43
- - chunk_index: The index of the chunk.
44
- - chunk_text: The text of the chunk.
45
- - vector: The vector embedding of the chunk.
46
- - created_at: The creation time of the chunk.
47
- - updated_at: The update time of the chunk.
48
-
49
- ## Uses
50
-
51
- This dataset is available for a wide range of applications.
52
-
53
- Here is a demo of how to use the dataset with [Chipmunk](https://github.com/Intelligent-Internet/Chipmunk).
54
-
55
- ### Create the metadata and chunking tables in PostgreSQL
56
-
57
- ```sql
58
- CREATE TABLE IF NOT EXISTS ts_wikipedia_en (
59
- id BIGSERIAL PRIMARY KEY,
60
- revid BIGINT NOT NULL,
61
- url VARCHAR NOT NULL,
62
- title VARCHAR NOT NULL DEFAULT '',
63
- ignored BOOLEAN NOT NULL DEFAULT FALSE,
64
- created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
65
- updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
66
- );
67
-
68
- CREATE TABLE IF NOT EXISTS ts_wikipedia_en_embed (
69
- id BIGSERIAL PRIMARY KEY,
70
- title VARCHAR NOT NULL,
71
- url VARCHAR NOT NULL,
72
- source_id BIGINT NOT NULL,
73
- chunk_index BIGINT NOT NULL,
74
- chunk_text VARCHAR NOT NULL,
75
- vector halfvec(768) DEFAULT NULL,
76
- created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
77
- updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
78
- );
79
- ```
80
-
81
- ### Load csv files to database
82
-
83
- 1. Load the dataset from local file system to a remote PostgreSQL server:
84
-
85
- ```sql
86
- \copy ts_wikipedia_en FROM 'data/meta/ts_wikipedia_en.csv' CSV HEADER;
87
- \copy ts_wikipedia_en_embed FROM 'data/chunks/0000000.csv' CSV HEADER;
88
- \copy ts_wikipedia_en_embed FROM 'data/chunks/0000001.csv' CSV HEADER;
89
- \copy ts_wikipedia_en_embed FROM 'data/chunks/0000002.csv' CSV HEADER;
90
- ...
91
- ```
92
-
93
- 2. Load the dataset from the PostgreSQL server's file system:
94
-
95
- ```sql
96
- copy ts_wikipedia_en FROM 'data/meta/ts_wikipedia_en.csv' CSV HEADER;
97
- copy ts_wikipedia_en_embed FROM 'data/chunks/0000000.csv' CSV HEADER;
98
- copy ts_wikipedia_en_embed FROM 'data/chunks/0000001.csv' CSV HEADER;
99
- copy ts_wikipedia_en_embed FROM 'data/chunks/0000002.csv' CSV HEADER;
100
- ...
101
- ```
102
-
103
- ### Create Indexes
104
-
105
- You need to create the following indexes for the best performance.
106
-
107
- The `vector` column is a halfvec(768) column, which is a 16-bit half-precision vector optimized for `cosine` indexing with [vectorchord](https://github.com/tensorchord/vectorchord). You can get more information about the vector index from the [vectorchord](https://docs.vectorchord.ai/vectorchord/usage/indexing.html) documentation.
108
-
109
- 1. Create the metadata table index:
110
-
111
- ```sql
112
- CREATE INDEX IF NOT EXISTS ts_wikipedia_en_revid_index ON ts_wikipedia_en (revid);
113
- CREATE INDEX IF NOT EXISTS ts_wikipedia_en_url_index ON ts_wikipedia_en (url);
114
- CREATE INDEX IF NOT EXISTS ts_wikipedia_en_title_index ON ts_wikipedia_en (title);
115
- CREATE INDEX IF NOT EXISTS ts_wikipedia_en_ignored_index ON ts_wikipedia_en (ignored);
116
- CREATE INDEX IF NOT EXISTS ts_wikipedia_en_created_at_index ON ts_wikipedia_en (created_at);
117
- CREATE INDEX IF NOT EXISTS ts_wikipedia_en_updated_at_index ON ts_wikipedia_en (updated_at);
118
- ```
119
- 2. Create the chunking table index:
120
-
121
- ```sql
122
- CREATE INDEX IF NOT EXISTS ts_wikipedia_en_embed_source_id_index ON ts_wikipedia_en_embed (source_id);
123
- CREATE INDEX IF NOT EXISTS ts_wikipedia_en_embed_chunk_index_index ON ts_wikipedia_en_embed (chunk_index);
124
- CREATE INDEX IF NOT EXISTS ts_wikipedia_en_embed_chunk_text_index ON ts_wikipedia_en_embed USING bm25 (id, title, chunk_text) WITH (key_field='id');
125
- CREATE UNIQUE INDEX IF NOT EXISTS ts_wikipedia_en_embed_source_index ON ts_wikipedia_en_embed (source_id, chunk_index);
126
- CREATE INDEX IF NOT EXISTS ts_wikipedia_en_embed_vector_index ON ts_wikipedia_en_embed USING vchordrq (vector halfvec_cosine_ops) WITH (options = $$
127
- [build.internal]
128
- lists = [20000]
129
- build_threads = 6
130
- spherical_centroids = true
131
- $$);
132
- CREATE INDEX IF NOT EXISTS ts_wikipedia_en_embed_vector_null_index ON ts_wikipedia_en_embed (vector) WHERE vector IS NULL;
133
- SELECT vchordrq_prewarm('ts_wikipedia_en_embed_vector_index');
134
- ```
135
-
136
- ### Query with Chipmunk
137
-
138
- Click this link to learn how to query the dataset with [Chipmunk](https://github.com/Intelligent-Internet/Chipmunk).
 
1
+ ---
2
+ license: apache-2.0
3
+ task_categories:
4
+ - feature-extraction
5
+ language:
6
+ - en
7
+ size_categories:
8
+ - 10M<n<100M
9
+ ---
10
+
11
+ # `wikipedia_en`
12
+
13
+ This is a curated Wikipedia English dataset for use with the [Chipmunk](https://github.com/Intelligent-Internet/Chipmunk) project.
14
+
15
+ ## Dataset Details
16
+
17
+ ### Dataset Description
18
+
19
+ This dataset comprises a curated Wikipedia English pages. Data sourced directly from the official English Wikipedia database dump. We extract the pages, chunk them into smaller pieces, and embed them using [Snowflake/snowflake-arctic-embed-m-v2.0](https://huggingface.co/Snowflake/snowflake-arctic-embed-m-v2.0). All vector embeddings are 16-bit half-precision vectors optimized for `cosine` indexing with [vectorchord](https://github.com/tensorchord/vectorchord).
20
+
21
+ ### Dataset Sources
22
+
23
+ Based on the [wikipedia dumps](https://dumps.wikimedia.org/). Please check this page for the [LICENSE](https://dumps.wikimedia.org/legal.html) of the page data.
24
+
25
+ ## Dataset Structure
26
+
27
+ 1. Metadata Table
28
+
29
+ - id: A unique identifier for the page.
30
+ - revid: The revision ID of the page.
31
+ - url: The URL of the page.
32
+ - title: The title of the page.
33
+ - ignored: Whether the page is ignored.
34
+ - created_at: The creation time of the page.
35
+ - updated_at: The update time of the page.
36
+
37
+ 2. Chunking Table
38
+
39
+ - id: A unique identifier for the chunk.
40
+ - title: The title of the page.
41
+ - url: The URL of the page.
42
+ - source_id: The source ID of the page.
43
+ - chunk_index: The index of the chunk.
44
+ - chunk_text: The text of the chunk.
45
+ - vector: The vector embedding of the chunk.
46
+ - created_at: The creation time of the chunk.
47
+ - updated_at: The update time of the chunk.
48
+
49
+ ## Uses
50
+
51
+ This dataset is available for a wide range of applications.
52
+
53
+ Here is a demo of how to use the dataset with [Chipmunk](https://github.com/Intelligent-Internet/Chipmunk).
54
+
55
+ ### Create the metadata and chunking tables in PostgreSQL
56
+
57
+ ```sql
58
+ CREATE TABLE IF NOT EXISTS ts_wikipedia_en (
59
+ id BIGSERIAL PRIMARY KEY,
60
+ revid BIGINT NOT NULL,
61
+ url VARCHAR NOT NULL,
62
+ title VARCHAR NOT NULL DEFAULT '',
63
+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
64
+ updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
65
+ ignored BOOLEAN NOT NULL DEFAULT FALSE
66
+ );
67
+
68
+ CREATE TABLE IF NOT EXISTS ts_wikipedia_en_embed (
69
+ id BIGSERIAL PRIMARY KEY,
70
+ title VARCHAR NOT NULL,
71
+ url VARCHAR NOT NULL,
72
+ chunk_index BIGINT NOT NULL,
73
+ chunk_text VARCHAR NOT NULL,
74
+ source_id BIGINT NOT NULL,
75
+ vector halfvec(768) DEFAULT NULL,
76
+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
77
+ updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
78
+ );
79
+ ```
80
+
81
+ ### Load csv files to database
82
+
83
+ 1. Load the dataset from local file system to a remote PostgreSQL server:
84
+
85
+ ```sql
86
+ \copy ts_wikipedia_en FROM 'data/meta/ts_wikipedia_en.csv' CSV HEADER;
87
+ \copy ts_wikipedia_en_embed FROM 'data/chunks/0000000.csv' CSV HEADER;
88
+ \copy ts_wikipedia_en_embed FROM 'data/chunks/0000001.csv' CSV HEADER;
89
+ \copy ts_wikipedia_en_embed FROM 'data/chunks/0000002.csv' CSV HEADER;
90
+ ...
91
+ ```
92
+
93
+ 2. Load the dataset from the PostgreSQL server's file system:
94
+
95
+ ```sql
96
+ copy ts_wikipedia_en FROM 'data/meta/ts_wikipedia_en.csv' CSV HEADER;
97
+ copy ts_wikipedia_en_embed FROM 'data/chunks/0000000.csv' CSV HEADER;
98
+ copy ts_wikipedia_en_embed FROM 'data/chunks/0000001.csv' CSV HEADER;
99
+ copy ts_wikipedia_en_embed FROM 'data/chunks/0000002.csv' CSV HEADER;
100
+ ...
101
+ ```
102
+
103
+ ### Create Indexes
104
+
105
+ You need to create the following indexes for the best performance.
106
+
107
+ The `vector` column is a halfvec(768) column, which is a 16-bit half-precision vector optimized for `cosine` indexing with [vectorchord](https://github.com/tensorchord/vectorchord). You can get more information about the vector index from the [vectorchord](https://docs.vectorchord.ai/vectorchord/usage/indexing.html) documentation.
108
+
109
+ 1. Create the metadata table index:
110
+
111
+ ```sql
112
+ CREATE INDEX IF NOT EXISTS ts_wikipedia_en_revid_index ON ts_wikipedia_en (revid);
113
+ CREATE INDEX IF NOT EXISTS ts_wikipedia_en_url_index ON ts_wikipedia_en (url);
114
+ CREATE INDEX IF NOT EXISTS ts_wikipedia_en_title_index ON ts_wikipedia_en (title);
115
+ CREATE INDEX IF NOT EXISTS ts_wikipedia_en_ignored_index ON ts_wikipedia_en (ignored);
116
+ CREATE INDEX IF NOT EXISTS ts_wikipedia_en_created_at_index ON ts_wikipedia_en (created_at);
117
+ CREATE INDEX IF NOT EXISTS ts_wikipedia_en_updated_at_index ON ts_wikipedia_en (updated_at);
118
+ ```
119
+ 2. Create the chunking table index:
120
+
121
+ ```sql
122
+ CREATE INDEX IF NOT EXISTS ts_wikipedia_en_embed_source_id_index ON ts_wikipedia_en_embed (source_id);
123
+ CREATE INDEX IF NOT EXISTS ts_wikipedia_en_embed_chunk_index_index ON ts_wikipedia_en_embed (chunk_index);
124
+ CREATE INDEX IF NOT EXISTS ts_wikipedia_en_embed_chunk_text_index ON ts_wikipedia_en_embed USING bm25 (id, title, chunk_text) WITH (key_field='id');
125
+ CREATE UNIQUE INDEX IF NOT EXISTS ts_wikipedia_en_embed_source_index ON ts_wikipedia_en_embed (source_id, chunk_index);
126
+ CREATE INDEX IF NOT EXISTS ts_wikipedia_en_embed_vector_index ON ts_wikipedia_en_embed USING vchordrq (vector halfvec_cosine_ops) WITH (options = $$
127
+ [build.internal]
128
+ lists = [20000]
129
+ build_threads = 6
130
+ spherical_centroids = true
131
+ $$);
132
+ CREATE INDEX IF NOT EXISTS ts_wikipedia_en_embed_vector_null_index ON ts_wikipedia_en_embed (vector) WHERE vector IS NULL;
133
+ SELECT vchordrq_prewarm('ts_wikipedia_en_embed_vector_index');
134
+ ```
135
+
136
+ ### Query with Chipmunk
137
+
138
+ Click this link to learn how to query the dataset with [Chipmunk](https://github.com/Intelligent-Internet/Chipmunk).