docker file to train model with desired cuda and cudnn

This commit is contained in:
vahidrezanezhad 2025-06-25 18:24:16 +02:00
parent d6ccb83bf5
commit ce4219e517
3 changed files with 84 additions and 1 deletions

29
Dockerfile Normal file
View file

@ -0,0 +1,29 @@
# Use NVIDIA base image
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04
# Set the working directory
WORKDIR /app
# Set environment variable for GitPython
ENV GIT_PYTHON_REFRESH=quiet
# Install Python and pip
RUN apt-get update && apt-get install -y --fix-broken && \
apt-get install -y \
python3 \
python3-pip \
python3-distutils \
python3-setuptools \
python3-wheel && \
rm -rf /var/lib/apt/lists/*
# Copy and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application
COPY . .
# Specify the entry point
CMD ["python3", "train.py", "with", "config_params_docker.json"]

54
config_params_docker.json Normal file
View file

@ -0,0 +1,54 @@
{
"backbone_type" : "nontransformer",
"task": "segmentation",
"n_classes" : 3,
"n_epochs" : 1,
"input_height" : 672,
"input_width" : 448,
"weight_decay" : 1e-6,
"n_batch" : 4,
"learning_rate": 1e-4,
"patches" : false,
"pretraining" : true,
"augmentation" : false,
"flip_aug" : false,
"blur_aug" : true,
"scaling" : true,
"adding_rgb_background": false,
"adding_rgb_foreground": false,
"add_red_textlines": false,
"channels_shuffling": true,
"degrading": true,
"brightening": true,
"binarization" : false,
"scaling_bluring" : false,
"scaling_binarization" : false,
"scaling_flip" : false,
"rotation": false,
"rotation_not_90": true,
"transformer_num_patches_xy": [14, 21],
"transformer_patchsize_x": 1,
"transformer_patchsize_y": 1,
"transformer_projection_dim": 64,
"transformer_mlp_head_units": [128, 64],
"transformer_layers": 1,
"transformer_num_heads": 1,
"transformer_cnn_first": true,
"blur_k" : ["blur","gauss","median"],
"scales" : [0.6, 0.7, 0.8, 0.9],
"brightness" : [1.3, 1.5, 1.7, 2],
"degrade_scales" : [0.2, 0.4],
"flip_index" : [0, 1, -1],
"shuffle_indexes" : [ [0,2,1], [1,2,0], [1,0,2] , [2,1,0]],
"thetha" : [5, -5],
"number_of_backgrounds_per_image": 2,
"continue_training": false,
"index_start" : 0,
"dir_of_start_model" : " ",
"weighted_loss": false,
"is_loss_soft_dice": true,
"data_is_provided": false,
"dir_train": "/entry_point_dir/train",
"dir_eval": "/entry_point_dir/eval",
"dir_output": "/entry_point_dir/output"
}

View file

@ -53,7 +53,7 @@ def get_dirs_or_files(input_data):
return image_input, labels_input
ex = Experiment()
ex = Experiment(save_git_info=False)
@ex.config