Table of Contents generated with DocToc
The model directory need to be prepared. In this tutorial, we use examples/PMML-model as the model.
$ tree ./examples/PMML-model
PMML-model
├── model
│ └── single_audit_mlp.pmml
└── ormbfile.yaml
ormbfile.yaml
is required in the model directory:
$ cat ./examples/PMML-model/ormbfile.yaml
author: "Ce Gao <gaoce@caicloud.io>"
format: PMML
In this case, we set the author and format field of the model.
We need to login to a remote registry. We can run the command to setup a local Docker registry:
$ docker run -it --rm -p 5000:5000 registry
WARN[0000] No HTTP secret provided - generated random secret. This may cause problems with uploads if multiple registries are behind a load-balancer. To provide a shared secret, fill in http.secret in the configuration file or set the REGISTRY_HTTP_SECRET environment variable. go.version=go1.11.2 instance.id=3a703617-a91b-4735-a4f2-43bf7c80f027 service=registry version=v2.7.1
INFO[0000] redis not configured go.version=go1.11.2 instance.id=3a703617-a91b-4735-a4f2-43bf7c80f027 service=registry version=v2.7.1
INFO[0000] Starting upload purge in 33m0s go.version=go1.11.2 instance.id=3a703617-a91b-4735-a4f2-43bf7c80f027 service=registry version=v2.7.1
INFO[0000] using inmemory blob descriptor cache go.version=go1.11.2 instance.id=3a703617-a91b-4735-a4f2-43bf7c80f027 service=registry version=v2.7.1
INFO[0000] listening on [::]:5000 go.version=go1.11.2 instance.id=3a703617-a91b-4735-a4f2-43bf7c80f027 service=registry version=v2.7.1
Now we can save the model to cache in the local file system.
$ ormb save ./examples/PMML-model localhost:5000/ormb/pmml:v1
ref: localhost:5000/ormb/pmml:v1
digest: c41f49e5d49d301d58b9b37590c833f2a85c3d083e09b680735f190fbdb8158a
size: 6.1 KiB
v1: saved
After we store the model in the local cache, we can push it to a remote registry.
$ ormb push localhost:5000/ormb/pmml:v1
The push refers to repository [localhost:5000/ormb/pmml]
ref: localhost:5000/ormb/pmml:v1
digest: c41f49e5d49d301d58b9b37590c833f2a85c3d083e09b680735f190fbdb8158a
size: 6.1 KiB
v1: pushed to remote (1 layer, 6.1 KiB total)
We can remove the model from the local cache, then try to pull it from the remote registry.
$ rm -rf cache/
$ ormb pull localhost:5000/ormb/pmml:v1
v1: Pulling from localhost:5000/ormb/pmml
ref: localhost:5000/ormb/pmml:v1
digest: c41f49e5d49d301d58b9b37590c833f2a85c3d083e09b680735f190fbdb8158a
size: 6.1 KiB
Status: Downloaded newer model for localhost:5000/ormb/pmml:v1
We can export the model from the local cache to the target directory.
$ ormb export localhost:5000/ormb/pmml:v1
ref: localhost:5000/ormb/pmml:v1
digest: c41f49e5d49d301d58b9b37590c833f2a85c3d083e09b680735f190fbdb8158a
size: 6.1 KiB
$ ls ./model
single_audit_mlp.pmml