diff --git a/pgml-cms/docs/.gitbook/assets/architecture_1.png b/pgml-cms/docs/.gitbook/assets/architecture_1.png new file mode 100644 index 000000000..71044385c Binary files /dev/null and b/pgml-cms/docs/.gitbook/assets/architecture_1.png differ diff --git a/pgml-cms/docs/.gitbook/assets/architecture_2.png b/pgml-cms/docs/.gitbook/assets/architecture_2.png new file mode 100644 index 000000000..5f03d5aca Binary files /dev/null and b/pgml-cms/docs/.gitbook/assets/architecture_2.png differ diff --git a/pgml-cms/docs/.gitbook/assets/architecture_3.png b/pgml-cms/docs/.gitbook/assets/architecture_3.png new file mode 100644 index 000000000..700dfc342 Binary files /dev/null and b/pgml-cms/docs/.gitbook/assets/architecture_3.png differ diff --git a/pgml-cms/docs/.gitbook/assets/performance_1.png b/pgml-cms/docs/.gitbook/assets/performance_1.png new file mode 100644 index 000000000..338c2caf5 Binary files /dev/null and b/pgml-cms/docs/.gitbook/assets/performance_1.png differ diff --git a/pgml-cms/docs/.gitbook/assets/performance_2.png b/pgml-cms/docs/.gitbook/assets/performance_2.png new file mode 100644 index 000000000..4e6b86354 Binary files /dev/null and b/pgml-cms/docs/.gitbook/assets/performance_2.png differ diff --git a/pgml-cms/docs/README.md b/pgml-cms/docs/README.md index bc5ff5462..1d993a933 100644 --- a/pgml-cms/docs/README.md +++ b/pgml-cms/docs/README.md @@ -21,16 +21,18 @@ PostgresML allows you to take advantage of the fundamental relationship between
Machine Learning Infrastructure (2.0) by a16z

PostgresML handles all of the functions described by a16z

-These capabilities are primarily provided by two open-source software projects, that may be used independently, but are designed to be used with the rest of the Postgres ecosystem: +These capabilities are primarily provided by two open-source software projects, that may be used independently, but are designed to be used together with the rest of the Postgres ecosystem: -* **pgml** - an open source extension for PostgreSQL. It adds support for GPUs and the latest ML & AI algorithms _inside_ the database with a SQL API and no additional infrastructure, networking latency, or reliability costs -* **PgCat** - an open source pooler for PostgreSQL. It abstracts the scalability and reliability concerns of managing a distributed cluster of Postgres databases. Client applications connect only to the pooler, which handles load balancing, sharding, and failover, outside of any single database server. +* [**pgml**](/docs/api/sql-extension/) - an open source extension for PostgreSQL. It adds support for GPUs and the latest ML & AI algorithms _inside_ the database with a SQL API and no additional infrastructure, networking latency, or reliability costs. +* [**PgCat**](/docs/product/pgcat/) - an open source connection pooler for PostgreSQL. It abstracts the scalability and reliability concerns of managing a distributed cluster of Postgres databases. Client applications connect only to the pooler, which handles load balancing, sharding, and failover, outside of any single database server.
PostgresML architectural diagram
+To learn more about how we designed PostgresML, take a look at our [architecture overview](/docs/resources/architecture/). + ## Client SDK -The PostgresML team also provides [native language SDKs](https://github.com/postgresml/postgresml/tree/master/pgml-sdks/pgml) which implement best practices for common ML & AI applications. The JavaScript and Python SDKs are generated from the a core Rust library, which provides a uniform API, correctness and efficiency across all environments. +The PostgresML team also provides [native language SDKs](/docs/api/client-sdk/) which implement best practices for common ML & AI applications. The JavaScript and Python SDKs are generated from the a core Rust library, which provides a uniform API, correctness and efficiency across all environments. While using the SDK is completely optional, SDK clients can perform advanced machine learning tasks in a single SQL request, without having to transfer additional data, models, hardware or dependencies to the client application. diff --git a/pgml-cms/docs/SUMMARY.md b/pgml-cms/docs/SUMMARY.md index 7543c0fde..6c8d97eb8 100644 --- a/pgml-cms/docs/SUMMARY.md +++ b/pgml-cms/docs/SUMMARY.md @@ -16,8 +16,18 @@ * [Overview](api/apis.md) * [SQL extension](api/sql-extension/README.md) - * [pgml.deploy()](api/sql-extension/pgml.deploy.md) * [pgml.embed()](api/sql-extension/pgml.embed.md) + * [pgml.transform()](api/sql-extension/pgml.transform/README.md) + * [Fill Mask](api/sql-extension/pgml.transform/fill-mask.md) + * [Question Answering](api/sql-extension/pgml.transform/question-answering.md) + * [Summarization](api/sql-extension/pgml.transform/summarization.md) + * [Text Classification](api/sql-extension/pgml.transform/text-classification.md) + * [Text Generation](api/sql-extension/pgml.transform/text-generation.md) + * [Text-to-Text Generation](api/sql-extension/pgml.transform/text-to-text-generation.md) + * [Token Classification](api/sql-extension/pgml.transform/token-classification.md) + * [Translation](api/sql-extension/pgml.transform/translation.md) + * [Zero-shot Classification](api/sql-extension/pgml.transform/zero-shot-classification.md) + * [pgml.deploy()](api/sql-extension/pgml.deploy.md) * [pgml.chunk()](api/sql-extension/pgml.chunk.md) * [pgml.generate()](api/sql-extension/pgml.generate.md) * [pgml.predict()](api/sql-extension/pgml.predict/README.md) @@ -29,16 +39,6 @@ * [Data Pre-processing](api/sql-extension/pgml.train/data-pre-processing.md) * [Hyperparameter Search](api/sql-extension/pgml.train/hyperparameter-search.md) * [Joint Optimization](api/sql-extension/pgml.train/joint-optimization.md) - * [pgml.transform()](api/sql-extension/pgml.transform/README.md) - * [Fill Mask](api/sql-extension/pgml.transform/fill-mask.md) - * [Question Answering](api/sql-extension/pgml.transform/question-answering.md) - * [Summarization](api/sql-extension/pgml.transform/summarization.md) - * [Text Classification](api/sql-extension/pgml.transform/text-classification.md) - * [Text Generation](api/sql-extension/pgml.transform/text-generation.md) - * [Text-to-Text Generation](api/sql-extension/pgml.transform/text-to-text-generation.md) - * [Token Classification](api/sql-extension/pgml.transform/token-classification.md) - * [Translation](api/sql-extension/pgml.transform/translation.md) - * [Zero-shot Classification](api/sql-extension/pgml.transform/zero-shot-classification.md) * [pgml.tune()](api/sql-extension/pgml.tune.md) * [Client SDK](api/client-sdk/README.md) * [Collections](api/client-sdk/collections.md) @@ -79,6 +79,8 @@ ## Resources +* [Architecture](resources/architecture/README.md) + * [Why PostgresML?](resources/architecture/why-postgresml.md) * [FAQs](resources/faqs.md) * [Data Storage & Retrieval](resources/data-storage-and-retrieval/tabular-data.md) * [Tabular data](resources/data-storage-and-retrieval/tabular-data.md) @@ -97,8 +99,6 @@ * [Contributing](resources/developer-docs/contributing.md) * [Distributed Training](resources/developer-docs/distributed-training.md) * [GPU Support](resources/developer-docs/gpu-support.md) - * [Deploying PostgresML](resources/developer-docs/deploying-postgresml/README.md) - * [Monitoring](resources/developer-docs/deploying-postgresml/monitoring.md) * [Self-hosting](resources/developer-docs/self-hosting/README.md) * [Pooler](resources/developer-docs/self-hosting/pooler.md) * [Building from source](resources/developer-docs/self-hosting/building-from-source.md) diff --git a/pgml-cms/docs/api/sql-extension/pgml.embed.md b/pgml-cms/docs/api/sql-extension/pgml.embed.md index ec7c8c2ee..a8f57f9dc 100644 --- a/pgml-cms/docs/api/sql-extension/pgml.embed.md +++ b/pgml-cms/docs/api/sql-extension/pgml.embed.md @@ -6,48 +6,99 @@ description: >- # pgml.embed() -Embeddings are a numeric representation of text. They are used to represent words and sentences as vectors, an array of numbers. Embeddings can be used to find similar pieces of text, by comparing the similarity of the numeric vectors using a distance measure, or they can be used as input features for other machine learning models, since most algorithms can't use text directly. - -Many pretrained LLMs can be used to generate embeddings from text within PostgresML. You can browse all the [models](https://huggingface.co/models?library=sentence-transformers) available to find the best solution on Hugging Face. +The `pgml.embed()` function generates [embeddings](/docs/use-cases/embeddings/) from text, using in-database models downloaded from Hugging Face. Thousands of [open-source models](https://huggingface.co/models?library=sentence-transformers) are available and new and better ones are being published regularly. ## API ```sql pgml.embed( - transformer TEXT, -- huggingface sentence-transformer name - text TEXT, -- input to embed - kwargs JSON -- optional arguments (see below) + transformer TEXT, + "text" TEXT, + kwargs JSON ) ``` -## Example +| Argument | Description | Example | +|----------|-------------|---------| +| transformer | The name of a Hugging Face embedding model. | `intfloat/e5-large-v2` | +| text | The text to embed. This can be a string or the name of a column from a PostgreSQL table. | `'I am your father, Luke'` | +| kwargs | Additional arguments that are passed to the model. | | -Let's use the `pgml.embed` function to generate embeddings for tweets, so we can find similar ones. We will use the `distilbert-base-uncased` model from :hugging: HuggingFace. This model is a small version of the `bert-base-uncased` model. It is a good choice for short texts like tweets. To start, we'll load a dataset that provides tweets classified into different topics. +### Examples -```sql -SELECT pgml.load_dataset('tweet_eval', 'sentiment'); -``` +#### Generate embeddings from text -View some tweets and their topics. +Creating an embedding from text is as simple as calling the function with the text you want to embed: -```sql -SELECT * -FROM pgml.tweet_eval -LIMIT 10; +{% tabs %} +{% tab title="SQL" %} + +```postgresql +SELECT * FROM pgml.embed( + 'intfloat/e5-small', + 'No, that''s not true, that''s impossible.' +) AS star_wars_embedding; ``` -Get a preview of the embeddings for the first 10 tweets. This will also download the model and cache it for reuse, since it's the first time we've used it. +{% endtab %} +{% endtabs %} -```sql -SELECT text, pgml.embed('distilbert-base-uncased', text) -FROM pgml.tweet_eval -LIMIT 10; +#### Generate embeddings from a table + +SQL functions can be used as part of a query to insert, update, or even automatically generate column values of any table: + +{% tabs %} +{% tab title="SQL" %} + +```postgresql +CREATE TABLE star_wars_quotes ( + quote TEXT NOT NULL, + embedding vector(384) GENERATED ALWAYS AS ( + pgml.embed('intfloat/e5-small', quote) + ) STORED +); + +INSERT INTO + star_wars_quotes (quote) +VALUES +('I find your lack of faith disturbing'), +('I''ve got a bad feeling about this.'), +('Do or do not, there is no try.'); ``` -It will take a few minutes to generate the embeddings for the entire dataset. We'll save the results to a new table. +{% endtab %} +{% endtabs %} -```sql -CREATE TABLE tweet_embeddings AS -SELECT text, pgml.embed('distilbert-base-uncased', text) AS embedding -FROM pgml.tweet_eval; +In this example, we're using [generated columns](https://www.postgresql.org/docs/current/ddl-generated-columns.html) to automatically create an embedding of the `quote` column every time the column value is updated. + +#### Using embeddings in queries + +Once you have embeddings, you can use them in queries to find text with similar semantic meaning: + +{% tabs %} +{% tab title="SQL" %} + +```postgresql +SELECT + quote +FROM + star_wars_quotes +ORDER BY + pgml.embed( + 'intfloat/e5-small', + 'Feel the force!', + ) <=> embedding + DESC +LIMIT 1; ``` + +{% endtab %} +{% endtabs %} + +This query will return the quote with the most similar meaning to `'Feel the force!'` by generating an embedding of that quote and comparing it to all other embeddings in the table, using vector cosine similarity as the measure of distance. + +## Performance + +First time `pgml.embed()` is called with a new model, it is downloaded from Hugging Face and saved in the cache directory. Subsequent calls will use the cached model, which is faster, and if the connection to the database is kept open, the model will be reused across multiple queries without being unloaded from memory. + +If a GPU is available, the model will be automatically loaded onto the GPU and the embedding generation will be even faster. diff --git a/pgml-cms/docs/api/sql-extension/pgml.transform/README.md b/pgml-cms/docs/api/sql-extension/pgml.transform/README.md index 67b20322d..101ee0828 100644 --- a/pgml-cms/docs/api/sql-extension/pgml.transform/README.md +++ b/pgml-cms/docs/api/sql-extension/pgml.transform/README.md @@ -17,37 +17,134 @@ layout: # pgml.transform() -PostgresML integrates [🤗 Hugging Face Transformers](https://huggingface.co/transformers) to bring state-of-the-art models into the data layer. There are tens of thousands of pre-trained models with pipelines to turn raw inputs into useful results. Many state of the art deep learning architectures have been published and made available for download. You will want to browse all the [models](https://huggingface.co/models) available to find the perfect solution for your [dataset](https://huggingface.co/dataset) and [task](https://huggingface.co/tasks). +The `pgml.transform()` function is the most powerful feature of PostgresML. It integrates open-source large language models, like Llama, Mixtral, and many more, which allows to perform complex tasks on your data. -We'll demonstrate some of the tasks that are immediately available to users of your database upon installation: [translation](https://github.com/postgresml/postgresml/blob/v2.7.12/pgml-dashboard/content/docs/guides/transformers/pre\_trained\_models.md#translation), [sentiment analysis](https://github.com/postgresml/postgresml/blob/v2.7.12/pgml-dashboard/content/docs/guides/transformers/pre\_trained\_models.md#sentiment-analysis), [summarization](https://github.com/postgresml/postgresml/blob/v2.7.12/pgml-dashboard/content/docs/guides/transformers/pre\_trained\_models.md#summarization), [question answering](https://github.com/postgresml/postgresml/blob/v2.7.12/pgml-dashboard/content/docs/guides/transformers/pre\_trained\_models.md#question-answering) and [text generation](https://github.com/postgresml/postgresml/blob/v2.7.12/pgml-dashboard/content/docs/guides/transformers/pre\_trained\_models.md#text-generation). +The models are downloaded from [🤗 Hugging Face](https://huggingface.co/transformers) which hosts tens of thousands of pre-trained and fine-tuned models for various tasks like text generation, question answering, summarization, text classification, and more. -### Examples +## API -All of the tasks and models demonstrated here can be customized by passing additional arguments to the `Pipeline` initializer or call. You'll find additional links to documentation in the examples below. +The `pgml.transform()` function comes in two flavors, task-based and model-based. -The Hugging Face [`Pipeline`](https://huggingface.co/docs/transformers/main\_classes/pipelines) API is exposed in Postgres via: +### Task-based API -```sql +The task-based API automatically chooses a model to use based on the task: + +```postgresql +pgml.transform( + task TEXT, + args JSONB, + inputs TEXT[] +) +``` + +| Argument | Description | Example | +|----------|-------------|---------| +| task | The name of a natural language processing task. | `text-generation` | +| args | Additional kwargs to pass to the pipeline. | `{"max_new_tokens": 50}` | +| inputs | Array of prompts to pass to the model for inference. | `['Once upon a time...']` | + +#### Example + +{% tabs %} +{% tab title="SQL" %} + +```postgresql +SELECT * +FROM pgml.transform ( + 'translation_en_to_fr', + 'How do I say hello in French?', +); +``` + +{% endtab %} +{% endtabs %} + +### Model-based API + +The model-based API requires the name of the model and the task, passed as a JSON object, which allows it to be more generic: + +```postgresql pgml.transform( - task TEXT OR JSONB, -- task name or full pipeline initializer arguments - call JSONB, -- additional call arguments alongside the inputs - inputs TEXT[] OR BYTEA[] -- inputs for inference + model JSONB, + args JSONB, + inputs TEXT[] ) ``` -This is roughly equivalent to the following Python: +| Argument | Description | Example | +|----------|-------------|---------| +| task | Model configuration, including name and task. | `{"task": "text-generation", "model": "mistralai/Mixtral-8x7B-v0.1"}` | +| args | Additional kwargs to pass to the pipeline. | `{"max_new_tokens": 50}` | +| inputs | Array of prompts to pass to the model for inference. | `['Once upon a time...']` | + +#### Example + +{% tabs %} +{% tab title="SQL" %} + +```postgresql +SELECT pgml.transform( + task => '{ + "task": "text-generation", + "model": "TheBloke/zephyr-7B-beta-GPTQ", + "model_type": "mistral", + "revision": "main", + }'::JSONB, + inputs => ['AI is going to change the world in the following ways:'], + args => '{ + "max_new_tokens": 100 + }'::JSONB +); +``` + +{% endtab %} + +{% tab title="Equivalent Python" %} ```python import transformers def transform(task, call, inputs): return transformers.pipeline(**task)(inputs, **call) + +transform( + { + "task": "text-generation", + "model": "TheBloke/zephyr-7B-beta-GPTQ", + "model_type": "mistral", + "revision": "main", + }, + {"max_new_tokens": 100}, + ['AI is going to change the world in the following ways:'] +) ``` -Most pipelines operate on `TEXT[]` inputs, but some require binary `BYTEA[]` data like audio classifiers. `inputs` can be `SELECT`ed from tables in the database, or they may be passed in directly with the query. The output of this call is a `JSONB` structure that is task specific. See the [Postgres JSON](https://www.postgresql.org/docs/14/functions-json.html) reference for ways to process this output dynamically. +{% endtab %} +{% endtabs %} + + +### Supported tasks + +PostgresML currently supports most NLP tasks available on Hugging Face: + +| Task | Name | Description | +|------|-------------|---------| +| [Fill mask](fill-mask) | `key-mask` | Fill in the blank in a sentence. | +| [Question answering](question-answering) | `question-answering` | Answer a question based on a context. | +| [Summarization](summarization) | `summarization` | Summarize a long text. | +| [Text classification](text-classification) | `text-classification` | Classify a text as positive or negative. | +| [Text generation](text-generation) | `text-generation` | Generate text based on a prompt. | +| [Text-to-text generation](text-to-text-generation) | `text-to-text-generation` | Generate text based on an instruction in the prompt. | +| [Token classification](token-classification) | `token-classification` | Classify tokens in a text. | +| [Translation](translation) | `translation` | Translate text from one language to another. | +| [Zero-shot classification](zero-shot-classification) | `zero-shot-classification` | Classify a text without training data. | + + +## Performance -!!! tip +Much like `pgml.embed()`, the models used in `pgml.transform()` are downloaded from Hugging Face and cached locally. If the connection to the database is kept open, the model remains in memory, which allows for faster inference on subsequent calls. If you want to free up memory, you can close the connection. -Models will be downloaded and stored locally on disk after the first call. They are also cached per connection to improve repeated calls in a single session. To free that memory, you'll need to close your connection. You may want to establish dedicated credentials and connection pools via [pgcat](https://github.com/levkk/pgcat) or [pgbouncer](https://www.pgbouncer.org/) for larger models that have billions of parameters. You may also pass `{"cache": false}` in the JSON `call` args to prevent this behavior. +## Additional resources -!!! +- [Hugging Face datasets](https://huggingface.co/datasets) +- [Hugging Face tasks](https://huggingface.co/tasks) diff --git a/pgml-cms/docs/introduction/getting-started/README.md b/pgml-cms/docs/introduction/getting-started/README.md index df15a1dee..309e0ac64 100644 --- a/pgml-cms/docs/introduction/getting-started/README.md +++ b/pgml-cms/docs/introduction/getting-started/README.md @@ -6,7 +6,7 @@ description: Getting starting with PostgresML, a GPU powered machine learning da A PostgresML deployment consists of multiple components working in concert to provide a complete Machine Learning platform: -* PostgreSQL database, with `pgml`, `pgvector` and many other extensions that add features useful in day-to-day and machine learning use cases +* PostgreSQL database, with [_pgml_](/docs/api/sql-extension/), _pgvector_ and many other extensions that add features useful in day-to-day and machine learning use cases * [PgCat pooler](/docs/product/pgcat/) to load balance thousands of concurrenct client requests across several database instances * A web application to manage deployed models and share experiments analysis with SQL notebooks @@ -16,4 +16,4 @@ We provide a fully managed solution in [our cloud](create-your-database), and do By building PostgresML on top of a mature database, we get reliable backups for model inputs and proven scalability without reinventing the wheel, so that we can focus on providing access to the latest developments in open source machine learning and artificial intelligence. -This guide will help you get started with a generous [free account](create-your-database), that includes access to GPU accelerated models and 5 GB of storage, or you can skip to our [Developer Docs](/docs/resources/developer-docs/quick-start-with-docker) to see how to run PostgresML locally with our Docker image. +This guide will help you get started with a generous [free account](create-your-database), which includes access to GPU accelerated models and 5 GB of storage, or you can skip to our [Developer Docs](/docs/resources/developer-docs/quick-start-with-docker) to see how to run PostgresML locally with our Docker image. diff --git a/pgml-cms/docs/resources/architecture/README.md b/pgml-cms/docs/resources/architecture/README.md new file mode 100644 index 000000000..566bb5a85 --- /dev/null +++ b/pgml-cms/docs/resources/architecture/README.md @@ -0,0 +1,44 @@ +# PostgresML architecture + +PostgresML is an extension for the PostgreSQL database server. It operates inside the database, using the same hardware to perform machine learning tasks. + +## PostgreSQL foundation + +PostgreSQL is a process-based database server. It handles multiple connections by forking the main process, which creates OS-level isolation between clients. + +
+ PostgreSQL architecture +
PostgreSQL architecture
+
+ +The main process allocates a block of shared memory, and grants all client processes direct access. Shared memory is used to store data retrieved from disk, so different clients can re-use the same data for different queries. + +Data access is controlled with lightweight locking and transaction-based multi-version concurrency control (MVCC). Each client gets its own version of the entire database, which remains consistent for the duration of the transaction. + +This architecture is perfect for machine learning. + +## PostgresML open-source extension + +A process-based architecture is perfect for multi-tenant machine learning applications. Each client connection loads its own libraries and models, serves them to the client, and removes all traces of them when the connection is closed. + +
+ PostgresML models +
PostgresML models
+
+ +Since PostgreSQL shares data between clients, the expensive part of retrieving data is optimized, while the relatively inexpensive part of loading models into memory is automated and isolated. MVCC ensures that models trained in the database are consistent: no new data is added or removed during training. + +### Optimizations + +Most classical machine learning models are small: an average XGBoost model could be only a few megabytes, which is easy to load into memory for each connection process. LLMs like Mistral and Llama can range anywhere between a few gigabytes to hundreds of gigabytes, and most machines can only afford to load one instance at a time. + +To share models between multiple clients, PostgresML, just like PostgreSQL, takes advantage of a connection pooler. We've built our own, called [PgCat](/docs/product/pgcat/), which supports load balancing, sharding, and many more enterprise-grade features. + +
+ Connection pooling +
Connection pooling
+
+ +Pooling connections allows thousands of clients to reuse one PostgreSQL server connection. That server connection loads one instance of a LLM and shares it with all clients, one transaction at a time. + +If the machine has enough RAM and GPU memory, more instances of the model can be loaded by allowing more than one server connection. PgCat will route client queries at random and evenly load balance the queries across all available LLM instances. diff --git a/pgml-cms/docs/resources/architecture/why-postgresml.md b/pgml-cms/docs/resources/architecture/why-postgresml.md new file mode 100644 index 000000000..dda1f0bbe --- /dev/null +++ b/pgml-cms/docs/resources/architecture/why-postgresml.md @@ -0,0 +1,35 @@ +# Why PostgresML? + +PostgresML offers a unique and modern architecture which replaces service-based machine learning applications with a single database. The benefits of this approach are measurable in performance, ease of use, and data integrity. + +## Service-based architecture + +Most applications today are built using services. In the extreme case, microservices with singular purpose are employed to achieve additional separation of concerns. + +For an application to use a machine learning model, it is typical to build and maintain separate services and data synchronization pipelines. This requires machine learning engineers to work in Python to build and deploy their models separately from the application. + +
+ Before PostgresML +
Service-based machine learning architecture
+
+ +### Impact + +Building on top of service-based architecture has major performance disadvantages. Any task that falls outside the domain of a specific engineering team, like machine learning, will require additional communication between teams, and additional services to be built and maintained. + +Communication between services is done with stateless protocols like gRPC or HTTP, which require additional context to process a request, fetched from a database or a cache. Since communication happens over the network, serialization and deserialization of the request and response is required, costing additional time and resources. + +The diagram above illustrates the work required to service **each** user request. With below-linear scaling characteristics and increasing brittleness, this architecture eventually breaks down and costs engineering time and resources. + + +## PostgresML architecture + +PostgresML simplifies things. By moving machine learning models to the database, we eliminate the need for an additional feature store, data synchronization, inference services, and the need for RPC calls requiring (de)serialization and network latency & reliability costs. + +
+ After PostgresML +
PostgresML architecture
+
+ + +For a detailed overview of how PostgresML works, take a look at our [architecture documentation](/docs/resources/architecture/). diff --git a/pgml-cms/docs/resources/developer-docs/deploying-postgresml/README.md b/pgml-cms/docs/resources/developer-docs/deploying-postgresml/README.md deleted file mode 100644 index ed3c9a4c8..000000000 --- a/pgml-cms/docs/resources/developer-docs/deploying-postgresml/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# Deployment - diff --git a/pgml-cms/docs/resources/developer-docs/deploying-postgresml/monitoring.md b/pgml-cms/docs/resources/developer-docs/deploying-postgresml/monitoring.md deleted file mode 100644 index fbc79e996..000000000 --- a/pgml-cms/docs/resources/developer-docs/deploying-postgresml/monitoring.md +++ /dev/null @@ -1,2 +0,0 @@ -# Monitoring - diff --git a/pgml-cms/docs/resources/developer-docs/installation.md b/pgml-cms/docs/resources/developer-docs/installation.md index 119080bf2..03ae95ece 100644 --- a/pgml-cms/docs/resources/developer-docs/installation.md +++ b/pgml-cms/docs/resources/developer-docs/installation.md @@ -1,6 +1,6 @@ -# Installation +# PostgresML installation -A typical PostgresML deployment consists of two parts: the PostgreSQL extension, and the dashboard web app. The extension provides all the machine learning functionality, and can be used independently. The dashboard provides a system overview for easier management, and notebooks for writing experiments. +The simplest PostgresML deployment consists of two parts: the PostgreSQL extension, and the dashboard web app. The extension provides all the machine learning functionality, and can be used independently. The dashboard provides a system overview for easier management, and SQL notebooks for writing experiments. ## Extension @@ -10,13 +10,13 @@ The extension can be installed by compiling it from source, or if you're using U !!! tip -If you're just looking to try PostgresML without installing it on your system, take a look at our Quick Start with Docker guide. +If you're just looking to try PostgresML without installing it on your system, take a look at our [Quick Start with Docker](quick-start-with-docker) guide. !!! #### Get the source code -To get the source code for PostgresML, you can clone our Github repository: +To get the source code for PostgresML, clone our GitHub repository: ```bash git clone https://github.com/postgresml/postgresml @@ -145,7 +145,7 @@ pgml_test=# SELECT pgml.version(); We like and use pgvector a lot, as documented in our blog posts and examples, to store and search embeddings. You can install pgvector from source pretty easily: ```bash -git clone --branch v0.5.0 https://github.com/pgvector/pgvector && \ +git clone --branch v0.6.0 https://github.com/pgvector/pgvector && \ cd pgvector && \ echo "trusted = true" >> vector.control && \ make && \ @@ -184,15 +184,15 @@ CREATE EXTENSION !!! note -If you're looking to use PostgresML in production, [try our cloud](https://postgresml.org/plans). We support serverless deployments with modern GPUs for startups of all sizes, and dedicated GPU hardware for larger teams that would like to tweak PostgresML to their needs. +If you're looking to use PostgresML in production, [try our cloud](https://postgresml.org/signup). We support serverless deployments with modern GPUs and dedicated hardware if you would like to tweak PostgresML to your needs. !!! For Ubuntu, we compile and ship packages that include everything needed to install and run the extension. At the moment, only Ubuntu 22.04 (Jammy) is supported. -#### Add our sources +#### Add our repository -Add our repository to your system sources: +Add our repository to your system: ```bash echo "deb [trusted=yes] https://apt.postgresml.org $(lsb_release -cs) main" | \ @@ -204,12 +204,12 @@ sudo tee -a /etc/apt/sources.list Update your package lists and install PostgresML: ```bash -export POSTGRES_VERSION=15 +export POSTGRES_VERSION=14 sudo apt update && \ sudo apt install postgresml-${POSTGRES_VERSION} ``` -The `postgresml-15` package includes all the necessary dependencies, including Python packages shipped inside a virtual environment. Your PostgreSQL server is configured automatically. +The `postgresml-14` package includes all the necessary dependencies, including Python packages shipped inside a virtual environment. Your PostgreSQL server is configured automatically. We support PostgreSQL versions 11 through 15, so you can install the one matching your currently installed PostgreSQL version. @@ -218,7 +218,7 @@ We support PostgreSQL versions 11 through 15, so you can install the one matchin If you prefer to manage your own Python environment and dependencies, you can install just the extension: ```bash -export POSTGRES_VERSION=15 +export POSTGRES_VERSION=14 sudo apt install postgresql-pgml-${POSTGRES_VERSION} ``` @@ -229,20 +229,20 @@ pgvector, the extension we use for storing and searching embeddings, needs to be To install pgvector from source, you can simply: ```bash -git clone --branch v0.4.4 https://github.com/pgvector/pgvector && \ +git clone --branch v0.6.0 https://github.com/pgvector/pgvector && \ cd pgvector && \ echo "trusted = true" >> vector.control && \ make && \ make install ``` -### Other Linux +### Other Linuxes -PostgresML will compile and run on pretty much any modern Linux distribution. For a quick example, you can take a look at what we do to build the extension on [Ubuntu](../../../../.github/workflows/package-extension.yml), and modify those steps to work on your distribution. +PostgresML will compile and run on pretty much any modern Linux distribution. For a quick example, you can take a look at what we do to build the extension on [Ubuntu](https://github.com/postgresml/postgresml/blob/master/.github/workflows/ubuntu-packages-and-docker-image.yml), and modify those steps to work on your distribution. #### Get the source code -To get the source code for PostgresML, you can clone our Github repo: +To get the source code for PostgresML, clone our GitHub repository: ```bash git clone https://github.com/postgresml/postgresml @@ -253,7 +253,7 @@ git clone https://github.com/postgresml/postgresml You'll need the following packages installed first. The names are taken from Ubuntu (and other Debian based distros), so you'll need to change them to fit your distribution: ``` -export POSTGRES_VERSION=15 +export POSTGRES_VERSION=14 build-essential clang @@ -303,11 +303,11 @@ cargo pgrx install ## Dashboard -The dashboard is a web app that can be run against any Postgres database which has the extension installed. There is a [Dockerfile](../../../../pgml-dashboard/Dockerfile/) included with the source code if you wish to run it as a container. +The dashboard is a web app that can be run against any Postgres database which has the extension installed. There is a [Dockerfile](https://github.com/postgresml/postgresml/blob/master/pgml-dashboard/Dockerfile) included with the source code if you wish to run it as a container. ### Get the source code -To get our source code, you can clone our Github repo (if you haven't already): +To get our source code, you can clone our GitHub repository (if you haven't already): ```bash git clone clone https://github.com/postgresml/postgresml && \ diff --git a/pgml-dashboard/src/components/tables/small/table/table.scss b/pgml-dashboard/src/components/tables/small/table/table.scss index 341d357eb..ab07ab9f7 100644 --- a/pgml-dashboard/src/components/tables/small/table/table.scss +++ b/pgml-dashboard/src/components/tables/small/table/table.scss @@ -11,7 +11,7 @@ table.table.table-sm { background: transparent; text-transform: uppercase; font-size: 12px; - padding: 12px 0 12px 0; + padding: 12px 12px 12px 0; border-bottom: 1px solid #{$gray-600}; font-weight: #{$font-weight-semibold}; }