Skip to content

Commit

Permalink
Merge pull request #230 from InnopolisUni/demo_sent
Browse files Browse the repository at this point in the history
Fixed errors and improved Dockerfiles
  • Loading branch information
BarzaH authored Aug 29, 2024
2 parents cd42ba5 + e3221ed commit 43a29b2
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 57 deletions.
25 changes: 10 additions & 15 deletions DockerfileMED
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
FROM pytorch/pytorch:1.11.0-cuda11.3-cudnn8-runtime

ENV UI_TITLE="Фреймворк для Медицины"
ENV WANDB_DISABLED="true"

RUN apt-get update && apt-get upgrade -y
RUN apt-get install ffmpeg libsm6 libxext6 -y
RUN apt-get install curl -y
RUN pip3 install --upgrade pip
# works with 1.2.2
RUN export PYTHONPATH=. && export PATH=$PATH
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install ffmpeg libsm6 libxext6 curl iotop -y \
&& rm -rf /var/lib/{apt,dpkg,cache,log}/
RUN pip3 install --upgrade pip pyopenssl cryptography
RUN /bin/bash -c 'curl -sSL https://install.python-poetry.org | python - --version 1.3.0'

COPY . /code
RUN rm -r /code/config/experiments/*
COPY ./config/experiments/demo_prom /code/config/experiments/
COPY ./config/experiments/demo_med /code/config/experiments/
WORKDIR /code

RUN /bin/bash -c '/root/.local/bin/poetry config virtualenvs.create false \
&& /root/.local/bin/poetry lock --no-update && /root/.local/bin/poetry install --no-interaction --no-ansi'
&& /root/.local/bin/poetry lock --no-update && /root/.local/bin/poetry install --no-interaction --no-ansi --no-cache'

WORKDIR /code/dui

RUN python3 -m pip install -U pyopenssl cryptography
RUN apt-get -y install iotop
RUN export PYTHONPATH=.
RUN export PATH=$PATH

ENV UI_TITLE="Фреймворк для Медицины"
ENV WANDB_DISABLED="true"
ENTRYPOINT PYTHONUNBUFFERED=1 python3 app.py
25 changes: 10 additions & 15 deletions DockerfileNM
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
FROM pytorch/pytorch:1.11.0-cuda11.3-cudnn8-runtime

ENV UI_TITLE="Фреймворк для Новых Материалов"
ENV WANDB_DISABLED="true"

RUN apt-get update && apt-get upgrade -y
RUN apt-get install ffmpeg libsm6 libxext6 -y
RUN apt-get install curl -y
RUN pip3 install --upgrade pip
# works with 1.2.2
RUN export PYTHONPATH=. && export PATH=$PATH
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install ffmpeg libsm6 libxext6 curl iotop -y \
&& rm -rf /var/lib/{apt,dpkg,cache,log}/
RUN pip3 install --upgrade pip pyopenssl cryptography
RUN /bin/bash -c 'curl -sSL https://install.python-poetry.org | python - --version 1.3.0'

COPY . /code
RUN rm -r /code/config/experiments/*
COPY ./config/experiments/demo_prom /code/config/experiments/
COPY ./config/experiments/demo_nm /code/config/experiments/
WORKDIR /code

RUN /bin/bash -c '/root/.local/bin/poetry config virtualenvs.create false \
&& /root/.local/bin/poetry lock --no-update && /root/.local/bin/poetry install --no-interaction --no-ansi'
&& /root/.local/bin/poetry lock --no-update && /root/.local/bin/poetry install --no-interaction --no-ansi --no-cache'

WORKDIR /code/dui

RUN python3 -m pip install -U pyopenssl cryptography
RUN apt-get -y install iotop
RUN export PYTHONPATH=.
RUN export PATH=$PATH

ENV UI_TITLE="Фреймворк для Новых Материалов"
ENV WANDB_DISABLED="true"
ENTRYPOINT PYTHONUNBUFFERED=1 python3 app.py
23 changes: 9 additions & 14 deletions DockerfilePROM
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
FROM pytorch/pytorch:1.11.0-cuda11.3-cudnn8-runtime

ENV UI_TITLE="Фреймворк для Промышленности"
ENV WANDB_DISABLED="true"

RUN apt-get update && apt-get upgrade -y
RUN apt-get install ffmpeg libsm6 libxext6 -y
RUN apt-get install curl -y
RUN pip3 install --upgrade pip
# works with 1.2.2
RUN export PYTHONPATH=. && export PATH=$PATH
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install ffmpeg libsm6 libxext6 curl iotop -y \
&& rm -rf /var/lib/{apt,dpkg,cache,log}/
RUN pip3 install --upgrade pip pyopenssl cryptography
RUN /bin/bash -c 'curl -sSL https://install.python-poetry.org | python - --version 1.3.0'

COPY . /code
Expand All @@ -16,13 +14,10 @@ COPY ./config/experiments/demo_prom /code/config/experiments/
WORKDIR /code

RUN /bin/bash -c '/root/.local/bin/poetry config virtualenvs.create false \
&& /root/.local/bin/poetry lock --no-update && /root/.local/bin/poetry install --no-interaction --no-ansi'
&& /root/.local/bin/poetry lock --no-update && /root/.local/bin/poetry install --no-interaction --no-ansi --no-cache'

WORKDIR /code/dui

RUN python3 -m pip install -U pyopenssl cryptography
RUN apt-get -y install iotop
RUN export PYTHONPATH=.
RUN export PATH=$PATH

ENV UI_TITLE="Фреймворк для Промышленности"
ENV WANDB_DISABLED="true"
ENTRYPOINT PYTHONUNBUFFERED=1 python3 app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
defaults:
- override /models: semantic-segmentation/unet
- override /datasets: semantic-segmentation/segmentation_brain.yaml
- override /augmentations_train: none #segmentation_stroke.yaml
- override /augmentations_train: none
- override /augmentations_val: none
- override /augmentations_test: none
- override /losses: segmentation_losses.yaml
Expand All @@ -12,7 +12,7 @@ project: "segmentation"
task: "image-segmentation"
random_seed: 42
stop_param: 10
epochs: 300
epochs: 35
weights_freq: 1
batch_size: 10
ckpt_path: https://api.blackhole.ai.innopolis.university/pretrained/segmentation_unet_brain.pt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ accelerator: gpu
batch_size: 16
ckpt_path: https://api.blackhole.ai.innopolis.university/pretrained/prom/fruits/new_baseline.pt
defaults:
- override /models: detection/yolov5
- override /models: detection/yolov5fruits_pretrain
- override /datasets: detection/detection_rotten_fruits
epochs: 100
gpus: 3
device: 0
epochs: 10
project: rotten_fruits
random_seed: 43
task: image-detection
Expand Down
4 changes: 4 additions & 0 deletions config/models/detection/yolov5fruits_pretrain.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
_target_: ultralytics.YOLO
description: yolov5 by ultralytics
model: yolov5xu
name: yolov5
27 changes: 20 additions & 7 deletions dui/assets/dui.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ let tooltipDict = {
"gpus": "Количество видеокарт, которые можно использовать",
"in_channels": "Количество входных каналов в модель. Например для RGB изображения - 3",
"devices": "Номера видеокарт, которые можно использовать",
"device": "Номера видеокарт, которые можно использовать(YOLO)",
"learning_rate": "Скорость обучения модели",

"models": "Расширение или изменение параметров модели",
Expand Down Expand Up @@ -422,10 +423,17 @@ function onKeyFieldChange(callback) {
}(keyFields[i]);
}
}

function processKeyFieldChange(keyfield){
changeSpan(keyfield);
addEditionButtonOnOverridePresence(keyfield);
}
function changeSpan(keyfield){
let tooltiptext = keyfield.parentNode.getElementsByClassName("tooltiptext")[0];
tooltiptext.textContent = tooltipDict[keyfield.value];
try{
let tooltiptext = keyfield.parentNode.getElementsByClassName("tooltiptext")[0];
tooltiptext.textContent = tooltipDict[keyfield.value];
}catch (e){
console.log(e)
}
}

function addEditionButtonOnOverridePresence(keyfield){
Expand Down Expand Up @@ -655,8 +663,8 @@ function set_editionpg_callbacks(){
onDeleteParameterRowClick(deleteParameterRow);
onAddParameterRowClick(addParameterRow);
onSaveConfigButtonClick(saveConfig);
onKeyFieldChange(addEditionButtonOnOverridePresence);
onKeyFieldChange(changeSpan);

onKeyFieldChange(processKeyFieldChange);

onEditButtonClick(openModalWindowOnEditButtonClick);
onInputFieldClick();
Expand All @@ -677,8 +685,13 @@ function set_editionpg_callbacks(){

let keyfields = document.getElementsByClassName("keyfield");
for(let k of keyfields){
let tooltiptext = k.parentNode.getElementsByClassName("tooltiptext")[0];
tooltiptext.textContent = tooltipDict[k.value];
try {
let tooltiptext = k.parentNode.getElementsByClassName("tooltiptext")[0];
tooltiptext.textContent = tooltipDict[k.value];
}
catch (e){
console.log(e)
}
};


Expand Down
2 changes: 2 additions & 0 deletions dui/pages/config_edition.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ def layout(config_name=None):
dash.html.Option("accelerator"),
dash.html.Option("gpus"),
dash.html.Option("devices"),
dash.html.Option("device"),
dash.html.Option("ckpt_path"),
],
id="parameters")]))

Expand Down
4 changes: 3 additions & 1 deletion dui/pages/config_saving.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
@flaskapp.route("/save_config", methods = ['GET', 'POST'])
def layout():
request_body = request.json
with open(configs_path / request_body["config_name"], "w+") as stream:
config_name = str(request_body["config_name"])
config_name += ".yaml" if not config_name.endswith(".yaml") else ""
with open(configs_path / config_name, "w+") as stream:
try:
if "experiments/" in str(request_body["config_name"]):
s = "# @package _global_\n" + yaml.dump(request_body["html"], allow_unicode=True,
Expand Down

0 comments on commit 43a29b2

Please sign in to comment.