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

Commit1a6d73d

Browse files
committed
add base files
1 parente5dae2d commit1a6d73d

File tree

17 files changed

+81193
-162
lines changed

17 files changed

+81193
-162
lines changed

‎.env‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
PG_USER=postgres
2+
PG_PASS=postgres
3+
INIT_DB=pgml
4+
NVIDIA_VISIBLE_DEVICES=all

‎.gitignore‎

Lines changed: 3 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -1,160 +1,3 @@
1-
# Byte-compiled / optimized / DLL files
2-
__pycache__/
3-
*.py[cod]
4-
*$py.class
5-
6-
# C extensions
7-
*.so
8-
9-
# Distribution / packaging
10-
.Python
11-
build/
12-
develop-eggs/
13-
dist/
14-
downloads/
15-
eggs/
16-
.eggs/
17-
lib/
18-
lib64/
19-
parts/
20-
sdist/
21-
var/
22-
wheels/
23-
share/python-wheels/
24-
*.egg-info/
25-
.installed.cfg
26-
*.egg
27-
MANIFEST
28-
29-
# PyInstaller
30-
# Usually these files are written by a python script from a template
31-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32-
*.manifest
33-
*.spec
34-
35-
# Installer logs
36-
pip-log.txt
37-
pip-delete-this-directory.txt
38-
39-
# Unit test / coverage reports
40-
htmlcov/
41-
.tox/
42-
.nox/
43-
.coverage
44-
.coverage.*
45-
.cache
46-
nosetests.xml
47-
coverage.xml
48-
*.cover
49-
*.py,cover
50-
.hypothesis/
51-
.pytest_cache/
52-
cover/
53-
54-
# Translations
55-
*.mo
56-
*.pot
57-
58-
# Django stuff:
59-
*.log
60-
local_settings.py
61-
db.sqlite3
62-
db.sqlite3-journal
63-
64-
# Flask stuff:
65-
instance/
66-
.webassets-cache
67-
68-
# Scrapy stuff:
69-
.scrapy
70-
71-
# Sphinx documentation
72-
docs/_build/
73-
74-
# PyBuilder
75-
.pybuilder/
76-
target/
77-
78-
# Jupyter Notebook
79-
.ipynb_checkpoints
80-
81-
# IPython
82-
profile_default/
83-
ipython_config.py
84-
85-
# pyenv
86-
# For a library or package, you might want to ignore these files since the code is
87-
# intended to run in multiple environments; otherwise, check them in:
88-
# .python-version
89-
90-
# pipenv
91-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94-
# install all needed dependencies.
95-
#Pipfile.lock
96-
97-
# poetry
98-
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99-
# This is especially recommended for binary packages to ensure reproducibility, and is more
100-
# commonly ignored for libraries.
101-
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102-
#poetry.lock
103-
104-
# pdm
105-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106-
#pdm.lock
107-
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108-
# in version control.
109-
# https://pdm.fming.dev/#use-with-ide
110-
.pdm.toml
111-
112-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113-
__pypackages__/
114-
115-
# Celery stuff
116-
celerybeat-schedule
117-
celerybeat.pid
118-
119-
# SageMath parsed files
120-
*.sage.py
121-
122-
# Environments
123-
.env
124-
.venv
125-
env/
126-
venv/
127-
ENV/
128-
env.bak/
129-
venv.bak/
130-
131-
# Spyder project settings
132-
.spyderproject
133-
.spyproject
134-
135-
# Rope project settings
136-
.ropeproject
137-
138-
# mkdocs documentation
139-
/site
140-
141-
# mypy
142-
.mypy_cache/
143-
.dmypy.json
144-
dmypy.json
145-
146-
# Pyre type checker
147-
.pyre/
148-
149-
# pytype static type analyzer
150-
.pytype/
151-
152-
# Cython debug symbols
153-
cython_debug/
154-
155-
# PyCharm
156-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158-
# and can be added to the global gitignore or merged into this file. For a more nuclear
159-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160-
#.idea/
1+
.vscode/
2+
node_modules/
3+
.env-local

‎LICENSE‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 AthennaMind
3+
Copyright (c) 2024 AthennaMind Authors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

‎Makefile‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
DOCKER :=$(shell command -v docker 2> /dev/null)
2+
3+
4+
.PHONY: build
5+
6+
build:
7+
ifndefDOCKER
8+
$(error "docker is not available; please install it")
9+
endif
10+
$(DOCKER) build -f containers/pgml/Dockerfile -t pgml:latest containers/pgml/
11+
$(DOCKER) build -f containers/pgml-dashboard/Dockerfile -t pgml:latest containers/pgml-dashboard/

‎README.md‎

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,85 @@
11
#postgresml-docker
2-
Run PostgresML + goodies in one command
2+
3+
Run[PostgresML](https://postgresml.org),[TimescaleDB]() and[pgAdmin](https://www.pgadmin.org) in one command. This repository contains a`docker-compose` file to run a PostgresML database with TimescaleDB and a PgAdmin instance. The stack is configured to use the[NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) to enable GPU support for the PostgresML database. Additionally there are bulgarian dictionaries that provide full text search support for the Bulgarian language that can be spicy combined with the functionality that PostgresML provides to achieve wonderful stuff.
4+
5+
**`TimescaleDB currently is not included in the stack. It will be added in the future.`**
6+
7+
##Table of Contents
8+
9+
-[Requirements](#requirements)
10+
-[Usage](#usage)
11+
-[System Requirements](#system-requirements)
12+
-[Cleanup](#cleanup)
13+
14+
##Requirements
15+
16+
-[Nvidia Cuda](https://developer.nvidia.com/cuda-downloads)
17+
18+
-[Nvidia Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html)
19+
20+
Install the NVIDIA Container Toolkit on Ubuntu 22.04
21+
22+
```shell
23+
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey| sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
24+
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list| \
25+
sed's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g'| \
26+
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
27+
28+
sudo apt-get update
29+
sudo apt-get install -y nvidia-container-toolkit
30+
```
31+
32+
##Usage
33+
34+
```shell
35+
git clone https://github.com/athennamind/postgresml-docker.git
36+
cd postgresml-docker
37+
```
38+
39+
Before running the containers, take a look at the`.env` file and adjust the values to your needs. By default the stack is configured to use all available GPUs as specified in`NVIDIA_VISIBLE_DEVICES`. If you have a single GPU, you can leave the default value. For multiple GPUs please refer to the[Docker Documentation](https://docs.docker.com/compose/gpu-support/) to pin specific GPUs.
40+
41+
```shell
42+
vim .env
43+
# ..........
44+
docker compose up -d
45+
# wait for the containers to start
46+
docker compose logs -f
47+
```
48+
49+
- Validate that we are all good
50+
51+
```shell
52+
dockerexec -it pgml psql -U postgres -d pgml -c"SELECT pgml.xgboost_version();"
53+
54+
xgboost_version
55+
-----------------
56+
1.62
57+
(1 row)
58+
```
59+
60+
- Open your browser and navigate to`http://localhost:8000` to access the PostgresML dashboard/ui/whatever.
61+
- Open your browser and navigate to`http://localhost:8001` to access the PgAdmin instance.
62+
63+
If you want to tweak the postgres config, do by editing the`configs/pgml/postgressql.conf` file. Do not forget to restart the compose after.
64+
65+
##System Requirements
66+
67+
This compose was used on the following system:
68+
69+
- Ubuntu 22.04
70+
- Docker version 25.0.4, build 1a576c5
71+
- 16GB of RAM
72+
- 8 CPU cores
73+
- 2x NVIDIA RTX 3090
74+
- 1TB Local SSD Storage
75+
76+
Please always consider benchmark and adjusting the resources to your needs, especially if you are going to run this compose in a production environment.
77+
78+
##Cleanup
79+
80+
To stop and remove the containers and volumes, run the following command:
81+
82+
```shell
83+
docker compose down
84+
docker volume ls| grep"postgresml-docker"| awk'{print $2}'| grep -v"VOLUME"| xargs docker volume rm -f
85+
```

‎configs/pgml/init.sql‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
ALTER ROLE postgresSET search_path TO public,pgml;
2+
3+
CREATE EXTENSION IF NOT EXISTS pgml;
4+
5+
CREATETEXT SEARCH CONFIGURATION bulgarian (COPY= simple);
6+
CREATETEXT SEARCH DICTIONARY bulgarian_ispell (
7+
TEMPLATE= ispell,
8+
DictFile= bulgarian,
9+
AffFile= bulgarian,
10+
StopWords= bulgarian
11+
);
12+
CREATETEXT SEARCH DICTIONARY bulgarian_simple (
13+
TEMPLATE=pg_catalog.simple,
14+
STOPWORDS= bulgarian
15+
);
16+
ALTERTEXT SEARCH CONFIGURATION bulgarian
17+
ALTER MAPPING FOR asciiword, asciihword, hword, hword_part, word
18+
WITH bulgarian_ispell, bulgarian_simple;

‎configs/pgml/postgresql.conf‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# -----------------------------
2+
# PostgreSQL configuration file
3+
# -----------------------------
4+
5+
6+
listen_addresses = '0.0.0.0'
7+
port = 5432
8+
max_connections = 300
9+
superuser_reserved_connections = 5
10+
shared_buffers = 4GB
11+
effective_cache_size = 12GB
12+
maintenance_work_mem = 2GB
13+
checkpoint_completion_target = 0.9
14+
wal_buffers = 16MB
15+
default_statistics_target = 500
16+
random_page_cost = 1.1
17+
effective_io_concurrency = 200
18+
work_mem = 1747kB
19+
huge_pages = off
20+
min_wal_size = 4GB
21+
max_wal_size = 16GB
22+
max_worker_processes = 8
23+
max_parallel_workers_per_gather = 4
24+
max_parallel_workers = 8
25+
max_parallel_maintenance_workers = 4
26+
ssl = off
27+
unix_socket_directories = '/var/run/postgresql'
28+
dynamic_shared_memory_type = posix
29+
log_timezone = 'UTC'
30+
datestyle = 'iso, mdy'
31+
timezone = 'UTC'
32+
lc_messages = 'en_US.utf8'
33+
lc_monetary = 'en_US.utf8'
34+
lc_numeric = 'en_US.utf8'
35+
lc_time = 'en_US.utf8'
36+
default_text_search_config = 'pg_catalog.english'
37+
shared_preload_libraries = 'pgml,pg_stat_statements'
38+
pgml.venv = '/var/lib/postgresml-python/pgml-venv'
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM ubuntu:22.04
2+
3+
ENV PG_ML_VERSION 2.8.2
4+
5+
RUN set -eux; \
6+
apt-get update -y; \
7+
apt-get install -y \
8+
lsb-release curl ca-certificates gnupg coreutils sudo openssl; \
9+
echo"deb [trusted=yes] https://apt.postgresml.org $(lsb_release -cs) main" > /etc/apt/sources.list.d/postgresml.list; \
10+
echo"deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list; \
11+
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null; \
12+
apt-get update -y; \
13+
apt-get install -y \
14+
git postgresml-dashboard=${PG_ML_VERSION};
15+
16+
CMD ["/usr/bin/pgml-dashboard"]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp