3

Deploying Watson NLP to IBM Code Engine

 2 years ago
source link: http://heidloff.net/article/deploying-watson-nlp-to-ibm-code-engine/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Deploying Watson NLP to IBM Code Engine

IBM Watson NLP (Natural Language Understanding) and Watson Speech containers can be run locally, on-premises or Kubernetes and OpenShift clusters. Via REST and gRCP APIs AI can easily be embedded in applications. This post describes how to deploy and run Watson NLP on the serverless offering IBM Code Engine.

To set some context, check out the landing page IBM Watson NLP Library for Embed. The Watson NLP containers can be run on different container platforms, they provide REST and gRCP interfaces, they can be extended with custom models and they can easily be embedded in solutions. While this offering is new, the underlaying functionality has been used and optimized for a long time in IBM offerings like the IBM Watson Assistant and NLU (Natural Language Understanding) SaaS services and IBM Cloud Pak for Data.

To try it, a trial is available. The container images are stored in an IBM container registry that is accessed via an IBM Entitlement Key.

Step by Step Instructions

First a custom image needs to be built which includes the NLP runtime and a list of models.

$ docker login cp.icr.io --username cp --password <your-entitlement-key>
$ mkdir models
$ docker run -it --rm -e ACCEPT_LICENSE=true -v `pwd`/models:/app/models cp.icr.io/cp/ai/watson-nlp_syntax_izumo_lang_en_stock:1.0.7
$ ls -la models
$ cat <<EOF >>Dockerfile
FROM cp.icr.io/cp/ai/watson-nlp-runtime:1.0.18
COPY models /app/models
EOF
$ docker build . -t my-watson-nlp-runtime:latest

Next the custom image is pushed to a registry, in this case the IBM Container Registry.

$ ibmcloud plugin install cr
$ ibmcloud login --sso
$ ibmcloud cr region-set global
$ ibmcloud cr namespace-add watson-nlp-demo
$ ibmcloud cr login
$ docker tag my-watson-nlp-runtime:latest icr.io/watson-nlp-demo/my-watson-nlp-runtime:latest
$ docker push icr.io/watson-nlp-demo/my-watson-nlp-runtime:latest

After this the Code Engine project is created.

$ ibmcloud plugin install code-engine
$ ibmcloud target -r us-south -g default
$ ibmcloud ce project create --name watson-nlp-demo
$ ibmcloud ce project select --name watson-nlp-demo

To access the container registry from Code Engine, a secret is created. This can be done manually or programmatically.

Finally the serverless application can be created.

$ ibmcloud ce application create \
--name watson-nlp-runtime \
--port 8080 \
--min-scale 1 --max-scale 2 \
--cpu 2 --memory 4G \
--image private.icr.io/watson-nlp-demo/my-watson-nlp-runtime:latest \
--registry-secret ce-auto-icr-private-global \
--env ACCEPT_LICENSE=true
$ ibmcloud ce app list
$ ibmcloud ce app logs --application watson-nlp-runtime
$ ibmcloud ce app events --application watson-nlp-runtime
-H "accept: application/json" \
-H "grpc-metadata-mm-model-id: syntax_izumo_lang_en_stock" \
-H "content-type: application/json" \
-d " { \"rawDocument\": { \"text\": \"It is so easy to embed Watson NLP in applications. Very cool.\" }}"
Screenshot-2022-11-22-at-08.50.03.png

To find out more about Watson NLP and Watson for Embed in general, check out these resources:

Share this:


Recommend

  • 4

    Running IBM Watson NLP locally in Containers IBM announced the general availability of Watson NLP (Natural Language Understanding) and Watson Speech containers which can be run locally, on-p...

  • 8
    • heidloff.net 2 years ago
    • Cache

    Running IBM Watson NLP in Minikube

    Running IBM Watson NLP in Minikube IBM announced the general availability of Watson NLP (Natural Language Understanding) and Watson Speech containers which can be run locally, on-premises or Kubernetes and...

  • 8
    • heidloff.net 2 years ago
    • Cache

    Building custom IBM Watson NLP Images

    Building custom IBM Watson NLP Images IBM announced the general availability of Watson NLP (Natural Language Understanding) and Watson Speech containers which can be run locally, on-premises or Kubernetes and OpenShift c...

  • 6

    Deploying custom Watson NLP Models with Terraform IBM announced the general availability of Watson NLP (Natural Language Understanding) and Watson Speech containers which can be run locally,...

  • 9
    • heidloff.net 2 years ago
    • Cache

    Training IBM Watson NLP Models

    Training IBM Watson NLP Models IBM announced the general availability of Watson NLP (Natural Language Understanding) and Watson Speech containers which can be run locally, on-premises or Kub...

  • 6

    Running and Deploying IBM Watson NLP Containers IBM Watson NLP (Natural Language Understanding) and Watson Speech containers can be run locally, on-premises or Kubernetes and OpenShift clust...

  • 4

    Serving Watson NLP on Kubernetes with KServe ModelMesh IBM Watson NLP (Natural Language Understanding) and Watson Speech containers can be run locally, on-premises or Kubernetes and OpenShif...

  • 11

    Text Classification Sample for IBM Watson NLP This post is the first one of a mini series which describes an AI text classification sample end to end. The sample covers the AI lifecycle, fro...

  • 9

    Deploying custom Watson NLP Text Classification Models This post is part of a mini series which describes an AI text classification sample end to end using Watson NLP (Natural Language Under...

  • 10
    • heidloff.net 2 years ago
    • Cache

    IBM Watson NLP Use Cases

    Posted Feb 16, 2023

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK