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

Commitb044163

Browse files
committed
Merge branch 'master' into dan-product-left-nav-update
2 parentsdcd197e +65b898d commitb044163

File tree

83 files changed

+1728
-787
lines changed

Some content is hidden

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

83 files changed

+1728
-787
lines changed

‎README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
</a>
3131
</p>
3232

33-
3433
#Table of contents
3534
-[Introduction](#introduction)
3635
-[Installation](#installation)
@@ -87,8 +86,6 @@ SELECT pgml.transform(
8786
]
8887
```
8988

90-
91-
9289
**Sentiment Analysis**
9390
*SQL query*
9491

@@ -117,7 +114,6 @@ SELECT pgml.transform(
117114
-[Millions of transactions per second](https://postgresml.org/blog/scaling-postgresml-to-one-million-requests-per-second)
118115
-[Horizontal scalability](https://github.com/postgresml/pgcat)
119116

120-
121117
**Training a classification model**
122118

123119
*Training*
@@ -242,7 +238,6 @@ SELECT pgml.transform(
242238
```
243239
The default <ahref="https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english"target="_blank">model</a> used for text classification is a fine-tuned version of DistilBERT-base-uncased that has been specifically optimized for the Stanford Sentiment Treebank dataset (sst2).
244240

245-
246241
*Using specific model*
247242

248243
To use one of the over 19,000 models available on Hugging Face, include the name of the desired model and`text-classification` task as a JSONB object in the SQL query. For example, if you want to use a RoBERTa <ahref="https://huggingface.co/models?pipeline_tag=text-classification"target="_blank">model</a> trained on around 40,000 English tweets and that has POS (positive), NEG (negative), and NEU (neutral) labels for its classes, include this information in the JSONB object when making your query.
@@ -681,7 +676,6 @@ SELECT pgml.transform(
681676
Sampling methods involve selecting the next word or sequence of words at random from the set of possible candidates, weighted by their probabilities according to the language model. This can result in more diverse and creative text, as well as avoiding repetitive patterns. In its most basic form, sampling means randomly picking the next word $w_t$ according to its conditional probability distribution:
682677
$$ w_t \approx P(w_t|w_{1:t-1})$$
683678

684-
685679
However, the randomness of the sampling method can also result in less coherent or inconsistent text, depending on the quality of the model and the chosen sampling parameters such as temperature, top-k, or top-p. Therefore, choosing an appropriate sampling method and parameters is crucial for achieving the desired balance between creativity and coherence in generated text.
686680

687681
You can pass`do_sample = True` in the arguments to use sampling methods. It is recommended to alter`temperature` or`top_p` but not both.
@@ -821,7 +815,6 @@ SELECT * from tweet_embeddings limit 2;
821815
|"QT@user In the original draft of the 7th book, Remus Lupin survived the Battle of Hogwarts. #HappyBirthdayRemusLupin"|{-0.1567948312,-0.3149209619,0.2163394839,..}|
822816
|"Ben Smith / Smith (concussion) remains out of the lineup Thursday, Curtis #NHL #SJ"|{-0.0701668188,-0.012231146,0.1304316372,.. }|
823817

824-
825818
##Step 2: Indexing your embeddings using different algorithms
826819
After you've created embeddings for your data, you need to index them using one or more indexing algorithms. There are several different types of indexing algorithms available, including B-trees, k-nearest neighbors (KNN), and approximate nearest neighbors (ANN). The specific type of indexing algorithm you choose will depend on your use case and performance requirements. For example, B-trees are a good choice for range queries, while KNN and ANN algorithms are more efficient for similarity searches.
827820

@@ -860,7 +853,6 @@ SELECT * FROM items, query ORDER BY items.embedding <-> query.embedding LIMIT 5;
860853
|5 RT's if you want the next episode of twilight princess tomorrow|
861854
|Jurassic Park is BACK! New Trailer for the 4th Movie, Jurassic World -|
862855

863-
864856
<!-- ## Sentence Similarity
865857
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.
866858
![sentence similarity](pgml-cms/docs/images/sentence-similarity.png)
@@ -869,7 +861,6 @@ Sentence Similarity involves determining the degree of similarity between two te
869861
<!-- # Regression
870862
# Classification-->
871863

872-
873864
#LLM Fine-tuning
874865

875866
In this section, we will provide a step-by-step walkthrough for fine-tuning a Language Model (LLM) for differnt tasks.
@@ -1036,7 +1027,6 @@ Fine-tuning a language model requires careful consideration of training paramete
10361027
* hub_token: Your Hugging Face API token to push the fine-tuned model to the Hugging Face Model Hub. Replace "YOUR_HUB_TOKEN" with the actual token.
10371028
* push_to_hub: A boolean flag indicating whether to push the model to the Hugging Face Model Hub after fine-tuning.
10381029

1039-
10401030
####5.3 Monitoring
10411031
During training, metrics like loss, gradient norm will be printed as info and also logged in pgml.logs table. Below is a snapshot of such output.
10421032

@@ -1151,7 +1141,6 @@ Here is an example pgml.transform call for real-time predictions on the newly mi
11511141
Time:175.264 ms
11521142
```
11531143

1154-
11551144
**Batch predictions**
11561145

11571146
```sql
@@ -1247,7 +1236,6 @@ SELECT pgml.tune(
12471236

12481237
By following these steps, you can effectively restart trainingfrom a previously trained model, allowing for further refinementand adaptation of the model basedon new requirementsor insights. Adjust parametersas needed for your specific use caseand dataset.
12491238

1250-
12511239
## 8. Hugging Face Hub vs. PostgresML as Model Repository
12521240
We utilize the Hugging Face Hubas the primary repository for fine-tuning Large Language Models (LLMs). Leveraging the HF hub offers several advantages:
12531241

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.terraform
2+
*.lock.hcl
3+
*.tfstate
4+
*.tfstate.backup

‎packages/pgml-rds-proxy/ec2/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#Terraform configuration for pgml-rds-proxy on EC2
2+
3+
This is a sample Terraform deployment for running pgml-rds-proxy on EC2. This will spin up an EC2 instance
4+
with a public IP and a working security group & install the community Docker runtime.
5+
6+
Once the instance is running, you can connect to it using the root key and run the pgml-rds-proxy Docker container
7+
with the correct PostgresML`DATABASE_URL`.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
terraform {
2+
required_providers {
3+
aws={
4+
source="hashicorp/aws"
5+
version="~> 5.46"
6+
}
7+
}
8+
9+
required_version=">= 1.2.0"
10+
}
11+
12+
provider"aws" {
13+
region="us-west-2"
14+
}
15+
16+
data"aws_ami""ubuntu" {
17+
most_recent=true
18+
19+
filter {
20+
name="name"
21+
values=["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"]
22+
}
23+
24+
filter {
25+
name="virtualization-type"
26+
values=["hvm"]
27+
}
28+
29+
owners=["099720109477"]# Canonical
30+
}
31+
32+
resource"aws_security_group""pgml-rds-proxy" {
33+
egress {
34+
from_port=0
35+
to_port=0
36+
protocol="-1"
37+
cidr_blocks=["0.0.0.0/0"]
38+
ipv6_cidr_blocks=["::/0"]
39+
}
40+
41+
ingress {
42+
from_port=6432
43+
to_port=6432
44+
protocol="tcp"
45+
cidr_blocks=["0.0.0.0/0"]
46+
ipv6_cidr_blocks=["::/0"]
47+
}
48+
49+
ingress {
50+
from_port=22
51+
to_port=22
52+
protocol="tcp"
53+
cidr_blocks=["0.0.0.0/0"]
54+
ipv6_cidr_blocks=["::/0"]
55+
}
56+
}
57+
58+
resource"aws_instance""pgml-rds-proxy" {
59+
ami=data.aws_ami.ubuntu.id
60+
instance_type="t3.micro"
61+
key_name=var.root_key
62+
63+
root_block_device {
64+
volume_size=30
65+
delete_on_termination=true
66+
}
67+
68+
vpc_security_group_ids=[
69+
"${aws_security_group.pgml-rds-proxy.id}",
70+
]
71+
72+
associate_public_ip_address=true
73+
user_data=file("${path.module}/user_data.sh")
74+
user_data_replace_on_change=false
75+
76+
tags={
77+
Name="pgml-rds-proxy"
78+
}
79+
}
80+
81+
variable"root_key" {
82+
type=string
83+
description="The name of the SSH Root Key you'd like to assign to this EC2 instance. Make sure it's a key you have access to."
84+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
#
3+
# Cloud init script to install Docker on an EC2 instance running Ubuntu 22.04.
4+
#
5+
6+
sudo apt-get update
7+
sudo apt-get install ca-certificates curl
8+
sudo install -m 0755 -d /etc/apt/keyrings
9+
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
10+
sudo chmod a+r /etc/apt/keyrings/docker.asc
11+
12+
# Add the repository to Apt sources:
13+
echo \
14+
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu\
15+
$(. /etc/os-release&&echo"$VERSION_CODENAME") stable"| \
16+
sudo tee /etc/apt/sources.list.d/docker.list> /dev/null
17+
sudo apt-get update
18+
19+
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
20+
sudo groupadd docker
21+
sudo usermod -aG docker ubuntu

‎pgml-apps/pgml-chat/README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Before you begin, make sure you have the following:
1414
- Python version >=3.8
1515
- (Optional) OpenAI API key
1616

17-
1817
#Getting started
1918
1. Create a virtual environment and install`pgml-chat` using`pip`:
2019
```bash
@@ -104,7 +103,6 @@ model performance, as well as integrated notebooks for rapid iteration. Postgres
104103
If you have any further questions or need more information, please feel free to send an email to team@postgresml.org or join the PostgresML Discord community at https://discord.gg/DmyJP3qJ7U.
105104
```
106105
107-
108106
### Slack
109107
110108
**Setup**
@@ -128,7 +126,6 @@ Once the slack app is running, you can interact with the chatbot on Slack as sho
128126
129127
![Slack Chatbot](./images/slack_screenshot.png)
130128
131-
132129
### Discord
133130
134131
**Setup**
@@ -194,8 +191,6 @@ pip install .
194191
4. Check the [roadmap](#roadmap) for features that you would like to work on.
195192
5. If you are looking for features that are not included here, please open an issue and we will add it to the roadmap.
196193
197-
198-
199194
# Roadmap
200195
- ~~Use a collection for chat history that can be retrieved and used to generate responses.~~
201196
- Support for file formats like rst, html, pdf, docx, etc.

‎pgml-cms/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.md.bak
942 KB
Loading
Loading

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp