https://github.com/prgrmcode/transferlearningwithdocker
This is a AI classification project using PyTorch and 2 classes. We use trained model in a Flask application and show the AI classification prediction results on web page. Also using two Docker containers with base images from Nvidia's nvidia/cuda from Docker hub.
https://github.com/prgrmcode/transferlearningwithdocker
ai docker-compose gpu torch
Last synced: 3 months ago
JSON representation
This is a AI classification project using PyTorch and 2 classes. We use trained model in a Flask application and show the AI classification prediction results on web page. Also using two Docker containers with base images from Nvidia's nvidia/cuda from Docker hub.
- Host: GitHub
- URL: https://github.com/prgrmcode/transferlearningwithdocker
- Owner: prgrmcode
- License: apache-2.0
- Created: 2023-12-06T12:01:07.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-23T00:55:56.000Z (over 1 year ago)
- Last Synced: 2024-12-27T14:41:38.567Z (5 months ago)
- Topics: ai, docker-compose, gpu, torch
- Language: Python
- Homepage:
- Size: 172 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### to get the requirements.txt file in conda env:
pip list --format=freeze > requirements.txt
---
## Prerequisite:
- Install and run _[Docker Desktop](https://hub.docker.com/)_ on Windows before executing 'docker' commands
# Docker Containers:
## Training Container:
### Build the training container
```
docker build -t transfer_train-container -f Dockerfile_train .
```### check gpus on training container
docker run --gpus 1 -ti transfer_train-container nvidia-smi
### Run the training container
- in unix terminal:
docker run --gpus 1 -v $(pwd)/data:/home/prgrmcode/app/data -ti --name train-container transfer_train-container
- in windows command prompt:
```
docker run --gpus 1 -v "%cd%/data:/home/prgrmcode/app/data" -ti --name train-container transfer_train-container
```-- number of gpus, -v --volume mounts first folder from local machine to the folder in docker container, -ti target image, command(python3 .py)
## Application Container:
### Build the application container
```
docker build -t transfer_app-container -f Dockerfile_app .
```### Run the application container
```
docker run -it --gpus 1 -p 5000:5000 --name app-container transfer_app-container bash
```---
---
# With Docker compose:
Run everything easily from docker-compose.yml file with one command
## To create and run new training and app container together:
```
docker-compose up
```### When train and app container are up and running, you can navigate to:
- **[localhost:5000](http://localhost:5000/)**
- [app predictions](application/localhost.png)
## Create and run a new training container:
```
docker-compose up --no-deps --build transfer_train-container
```## Create and run a new app container for hosting the application:
```
docker-compose up --build transfer_app-container
```## To start / reuse the existing training container:
```
docker-compose start transfer_train-container
```## To start / reuse the existing app container:
```
docker-compose start transfer_app-container
```## If docker uses too much disk space, run:
```
docker system prune
```---