Skip to content

Commit

Permalink
update docker
Browse files Browse the repository at this point in the history
  • Loading branch information
AaLexUser committed Dec 27, 2024
1 parent bddf9e0 commit 5f2f350
Show file tree
Hide file tree
Showing 8 changed files with 601 additions and 790 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,7 @@ chroma/
# AutoMLAgent
exec_out/
_experiments/
results/
results/

# Docker
docker/docker_caches/
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
DC = docker compose
EXEC = docker exec -it
APP_FILE = docker/docker-compose.yml
APP_CONTAINER = app
ENV = --env-file .env
SH = /bin/bash

.PHONY: build
build:
${DC} ${ENV} -f ${APP_FILE} up -w --build

.PHONY: up
up:
${DC} ${ENV} -f ${APP_FILE} up -w

.PHONY: down
down:
${DC} -f ${APP_FILE} down

.PHONY: appsh
app-sh:
${EXEC} -it ${APP_CONTAINER} ${SH}
app-py:
${EXEC} -it ${APP_CONTAINER} poetry shell

streamlit-st:
python -m streamlit run libs/fedotllm/streamlit-app.py --server.port=8080 --server.address=0.0.0.0
60 changes: 28 additions & 32 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,37 @@
FROM python:3.10-slim

# Arguments for the new user
ARG NB_USER=fedya
ARG NB_UID=1000

# Set the environment variables and create a new user
ENV USER=${NB_USER}
ENV NB_UID=${NB_UID}
ENV HOME="/home/${NB_USER}"
ENV WORK=${HOME}/work

RUN adduser --disabled-password \
--gecos "Default user" \
--uid ${NB_UID} \
${NB_USER}

# Install the required packages
WORKDIR ${HOME}
RUN apt-get update && \
apt-get --no-install-recommends install -yq \
libgomp1 \
libhdf5-dev \
FROM python:3.10-slim AS builder

RUN apt-get update && apt-get install \
--no-install-suggests \
--no-install-recommends \
-y \
build-essential \
curl \
python3-venv \
python3-pip \
&& rm -rf /var/lib/apt/lists/*

COPY requirements.txt requirements.txt
RUN pip3 install --upgrade pip && pip3 install -r requirements.txt
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_CREATE=false \
POETRY_CACHE_DIR='/var/cache/pypoetry' \
POETRY_HOME='/usr/local' \
POETRY_VERSION=1.8.5

WORKDIR /app

RUN curl -sSL https://install.python-poetry.org | POETRY_VERSION=${POETRY_VERSION} python3 -

COPY . ${WORK}
COPY poetry.lock pyproject.toml /app/

# Switch to new user and start the Jupyter notebook
USER root
RUN chown -R ${NB_UID} ${HOME}
RUN poetry install --no-interaction --no-ansi

USER ${NB_USER}
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/docker_caches/.bash_history" \
&& echo "$SNIPPET" >> "/root/.bashrc"

COPY . .

ENTRYPOINT ["python3", "-m"]
CMD ["jupyter", "notebook", "--port=8888", "--no-browser", "--ip=0.0.0.0"]
32 changes: 27 additions & 5 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
version: '3'
name: fedotllm
services:
jupyter-fedotllm:
app:
build:
context: ../
dockerfile: docker/Dockerfile
restart: always
container_name: app
command: "tail -f /dev/null"
ports:
- "8800:8888"
- "8080:8080"
env_file:
- ../.env
platform: linux/amd64
volumes:
- ../:/home/fedya/work
- ../.cache/pip-docker:/home/fedya/.cache/pip
- ./docker_caches:/docker_caches
develop:
watch:
- action: sync
path: ../
target: /app
ignore:
- ../pyproject.toml
- ./
- action: rebuild
path: .
target: /app/docker
ignore:
- ./docker_caches
- ./dev.Dockerfile
- ./README.md
- action: rebuild
path: ../pyproject.toml
8 changes: 4 additions & 4 deletions libs/fedotllm/settings/config.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[config]
#model = "gpt-4o"
model = "llama-3.3-70b-versatile"
base_url = "https://api.groq.com/openai/v1"
#base_url = "https://models.inference.ai.azure.com"
model = "gpt-4o"
#model = "llama-3.3-70b-versatile"
#base_url = "https://api.groq.com/openai/v1"
base_url = "https://models.inference.ai.azure.com"
#base_url="http://0.0.0.0:4000"
#base_url="http://127.0.0.1:11434"
output_dir = "exec_out"
Expand Down
2 changes: 1 addition & 1 deletion libs/fedotllm/streamlit-app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from web.frontend import fragments as fg
from fedotllm.web.frontend import fragments as fg


def main():
Expand Down
1,252 changes: 509 additions & 743 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "fedotllm"
version = "0.1.0"
description = "LLM-based prototype for nexgen AutoML"
authors = ["Alexey Lapin <a.[email protected]>"]
authors = ["Alexey Lapin <a.[email protected]>"]
license = "BSD 3-Clause"
readme = "README.md"
packages = [
Expand All @@ -18,7 +18,6 @@ python = "~3.10.0"
fedot = "^0.7.3.2"
thegolem = "^0.4.0"
giotto-tda = "0.6.0"
ripser = "0.6.4"

# Data processing
pandas = "^2.2.3"
Expand Down Expand Up @@ -56,10 +55,8 @@ dynaconf = "^3.2.6"
watchdog = "^6.0.0"
loguru = "^0.7.3"
autoflake = "^2.3.1"
langfuse = "^2.56.0"
requests = "^2.32.3"
tenacity = "^9.0.0"
langchain-ollama = "^0.2.1"
fastapi = "^0.115.6"

[tool.poetry.group.dev.dependencies]
Expand Down

0 comments on commit 5f2f350

Please sign in to comment.