Skip to content

Latest commit

 

History

History
79 lines (61 loc) · 3.21 KB

README.md

File metadata and controls

79 lines (61 loc) · 3.21 KB

Keras on OpenPAI

This guide introduces how to run Keras job on OpenPAI. The following contents show some basic Keras examples, other customized Keras code can be run similarly.

Keras tensorflow backend MNIST digit recognition examples

To run Keras examples in OpenPAI, you need to prepare a job configuration file and submit it through webportal.

OpenPAI packaged the docker env required by the job for user to use. User could refer to DOCKER.md to customize this example docker env. If user have built a customized image and pushed it to Docker Hub, replace our pre-built image pai.example.keras.tensorflow with your own.

Here're some configuration file examples:

{
    "jobName": "keras_tensorflow_backend_mnist",
    "image": "openpai/pai.example.keras.tensorflow",
    "taskRoles": [
        {
            "name": "mnist",
            "taskNumber": 1,
            "cpuNumber": 4,
            "memoryMB": 8192,
            "gpuNumber": 1,
            "command": "python mnist_cnn.py"
        }
    ]
}

Keras cntk backend MNIST digit recognition examples

{
    "jobName": "keras_cntk_backend_mnist",
    "image": "openpai/pai.example.keras.cntk",
    "taskRoles": [
        {
            "name": "mnist",
            "taskNumber": 1,
            "cpuNumber": 4,
            "memoryMB": 8192,
            "gpuNumber": 1,
            "command": "python mnist_cnn.py"
        }
    ]
}

For more details on how to write a job configuration file, please refer to job tutorial.

Note:

Since PAI runs Keras jobs in Docker, the trainning speed on PAI should be similar to speed on host.

We provide two stable docker images by adding the data to the images. If you want to use them, add stable tag to the image name: openpai/pai.example.keras.cntk:stable or openpai/pai.example.keras.tensorflow:stable.