pai/examples/keras
Manuel Möhlmann 7461d3091a Fixed typos (#1607) 2018-11-05 13:54:36 +08:00
..
DOCKER.md refactor job-tutorial folder to examples (#1360) 2018-09-14 09:05:34 +08:00
Dockerfile.example.keras.cntk_backend Yuqian/unstable example fix (#1474) 2018-10-11 15:00:30 +08:00
Dockerfile.example.keras.tensorflow_backend Yuqian/unstable example fix (#1474) 2018-10-11 15:00:30 +08:00
README.md Fixed typos (#1607) 2018-11-05 13:54:36 +08:00
keras.cntk_backend.mnist.json Yuqian/unstable example fix (#1474) 2018-10-11 15:00:30 +08:00
keras.tensorflow_backend.mnist.json Yuqian/unstable example fix (#1474) 2018-10-11 15:00:30 +08:00

README.md

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:

mnist_tensorflow_backend

{
    "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

mnist_cntk_backend

{
    "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 training 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.