Using BaseModel Docker Image
Running the Solution from a Docker Container
This guide provides instructions on how to run your solution using Docker. There are two methods available:
- Interactive Mode: This method allows you to run the container interactively and execute commands manually within the container.
- Command-Line Interface (CLI) Mode: This method runs the entire process from the command line by providing configuration files directly to Docker.
Method 1: Running Docker Interactively
In this method, you will start the Docker container interactively, giving you a shell inside the container where you can manually execute commands.
Steps:
-
Start the Docker Container:
Use the following command to start the Docker container interactively. ReplaceIMAGE_NAME
with the name of your Docker image andyour_container_name
with the desired name for your container.docker run -it -v /YOUR_SHARE/:/YOUR_SHARE/:z --name your_container_name --gpus all --shm-size 64gb IMAGE_NAME
Explanation of the Command:
-it
: Starts the container in interactive mode with a terminal.-v /YOUR_SHARE/:/YOUR_SHARE/:z
: Mounts the/YOUR_SHARE/
directory from the host to the container.--name your_container_name
: Assigns a name to the container.--gpus all
: Allocates all available GPUs to the container.--shm-size 64gb
: Sets the shared memory size to 64GB.IMAGE_NAME
: The name of your Docker image.
Run Commands Inside the Container:
Once inside the container, you can run the necessary commands. For example:
python pretrain.py --config \<path/to/config.yml> --features-path \<path/to/store/pretrain/artifacts
Method 2: Running Docker from the Command Line
In this method, you will run the entire process from the command line by passing configuration files to Docker.
Steps:
1. Prepare the Configuration File:
Ensure you have your configuration file ready. For this example, the configuration file is located at /data1/config.yaml
.
2. Run the Docker Container with Configuration:
Use the following command to run the Docker container, passing the configuration file. Replace IMAGE_NAME
with the name of your Docker image and your_container_name
with the desired name for your container.
docker run --rm -v /data1/:/data1/:z --name your_container_name --gpus all --shm-size 64gb IMAGE_NAME python pretrain.py --config-path /YOUR_PATH/config.yaml --output-path /YOUR_PATH/output/
Explanation of the Command:
--rm
: Automatically removes the container when it exits.-v /data1/:/data1/:z
: Mounts the/data1/
directory from the host to the container.--name your_container_name
: Assigns a name to the container.--gpus all
: Allocates all available GPUs to the container.--shm-size 64gb
: Sets the shared memory size to 64GB.IMAGE_NAME
: The name of your Docker image.python pretrain.py
: The command to run inside the container - in this case foundation model training step--config-path /YOUR_PATH/config.yaml
: Specifies the path to the configuration file inside the container.--output-path /YOUR_PATH/output/
: Specifies the output directory for the processed results.
By following these methods, you can effectively run your solution using Docker either interactively or via the command line with configuration files. For more detailed information on available commands and configurations, refer to the comprehensive Docker Documentation.
Updated 5 months ago