DucklingHTTPExtractor correctly extracts entities on local machine but not in RasaX on GCP Instance

I was running a DucklingHTTPExtractor on my local machine it was working totally fine (still is), but when I run it on my GCP VM, it doesn’t correctly extract the entities and convert them (to timestamps and money in my case). In other words, when I type anything into the interactive learning section of the RasaX UI, it does label the correct entities, but it fills the slots with those parts of the text and not the converted values (although it does that on my local machine).

Here’s my pipeline:

pipeline:
  - name: SpacyNLP
  - name: ConveRTTokenizer
  - name: ConveRTFeaturizer
  - name: RegexFeaturizer
  - name: LexicalSyntacticFeaturizer
  - name: CountVectorsFeaturizer
  - name: CountVectorsFeaturizer
    analyzer: "char_wb"
    min_ngram: 1
    max_ngram: 4
  - name: DIETClassifier
    epochs: 100
  - name: SpacyEntityExtractor
    dimensions: ["GPE"]
  - name: DucklingHTTPExtractor
    dimensions: ["time", "amount-of-money", "duration"]
    url: "http://duckling:8000"
  - name: EntitySynonymMapper
  - name: ResponseSelector
    epochs: 100

Here’s whats in my docker-compose.yml:

duckling:
    restart: always
    image: "rasa/duckling:0.1.6.3"
    expose:
      - "8000"
    command: ["duckling-example-exe", "--no-access-log", "--no-error-log"]

Here’s what’s in my docker-compose-override.yml:

version: '3.4'
services:
  app:
    image: 'my_own_custom_image'
    volumes:
      - './actions:/app/actions'
    expose:
      - '5055'
    depends_on:
      - rasa-production

And here’s what I get in the logs when spinning up the duckling_1 server:

duckling_1         | no port specified, defaulting to port 8000
duckling_1         | Listening on http://0.0.0.0:8000

I see that I set the url to http://duckling:8000 and it’s listening on http://0.0.0.0:8000, so is there a way I can specify that? Any suggestions?

Hey @basil-chatha, are there any issues in the rasa-production logs about connecting to duckling?

I see that I set the url to http://duckling:8000 and it’s listening on http://0.0.0.0:8000 , so is there a way I can specify that? Any suggestions?

This should be okay – on the duckling service it is running on localhost. http://duckling:8000 tells rasa to access port 8000 on the duckling service.

@erohmensing Here are my logs from rasa-production:

rasa-production_1  |   self.queues = self._get_queues_from_args(queues, kwargs)
rasa-production_1  | 2020-06-02 00:56:42 ERROR    pika.adapters.utils.io_services_utils  - Socket failed to connect
: <socket.socket fd=21, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.224.8',
 35832)>; error=111 (Connection refused)
rasa-production_1  | 2020-06-02 00:56:42 ERROR    pika.adapters.utils.connection_workflow  - TCP Connection attempt
 failed: ConnectionRefusedError(111, 'Connection refused'); dest=(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STRE
AM: 1>, 6, '', ('192.168.224.5', 5672))
rasa-production_1  | 2020-06-02 00:56:42 ERROR    pika.adapters.utils.connection_workflow  - AMQPConnector - report
ing failure: AMQPConnectorSocketConnectError: ConnectionRefusedError(111, 'Connection refused')
rasa-production_1  | 2020-06-02 00:56:47 ERROR    pika.adapters.utils.io_services_utils  - Socket failed to connect
: <socket.socket fd=25, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.224.8',
 35848)>; error=111 (Connection refused)
rasa-production_1  | 2020-06-02 00:56:47 ERROR    pika.adapters.utils.connection_workflow  - TCP Connection attempt
 failed: ConnectionRefusedError(111, 'Connection refused'); dest=(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STRE
AM: 1>, 6, '', ('192.168.224.5', 5672))
rasa-production_1  | 2020-06-02 00:56:47 ERROR    pika.adapters.utils.connection_workflow  - AMQPConnector - report
ing failure: AMQPConnectorSocketConnectError: ConnectionRefusedError(111, 'Connection refused')
rasa-production_1  | 2020-06-02 00:57:56.741686: E tensorflow/stream_executor/cuda/cuda_driver.cc:351] failed call 
to cuInit: UNKNOWN ERROR (303)
rasa-production_1  | 2020-06-02 00:58:57 ERROR    rasa.core.brokers.pika  - Could not open Pika channel at host 'ra
bbit'. Failed with error: Channel is closed.

I have a feeling that the reason I’m getting different results on my local machine than on the GCP VM might be that I didn’t use a docker image on my local machine. I downloaded Duckling using the Facebook/duckling github repo whereas the docker image for Rasa/duckling uses the Rasa/duckling fork of Duckling, which might not have the same rules as the Facebook version? Not sure though.

Below is an example of text that works correctly on my local machine but not in the Interactive Learning section of the RasaX UI on my GCP VM: When I run the message “$2000-3000” using rasa shell nlu, I get the following output:

"entities": [
    {
      "start": 0,
      "end": 5,
      "text": "$2000",
      "value": 2000,
      "confidence": 1.0,
      "additional_info": {
        "value": 2000,
        "type": "value",
        "unit": "$"
      },
      "entity": "amount-of-money",
      "extractor": "DucklingHTTPExtractor"
    },
    {
      "start": 1,
      "end": 10,
      "text": "2000-3000",
      "value": {
        "to": 3000,
        "from": 2000
      },
      "confidence": 1.0,
      "additional_info": {
        "to": {
          "value": 3000,
          "unit": "unknown"
        },
        "from": {
          "value": 2000,
          "unit": "unknown"
        },
        "type": "interval"
      },
      "entity": "amount-of-money",
      "extractor": "DucklingHTTPExtractor"
    }
  ]

But when I run the same in the Interactive Learning section of the RasaX UI on my GCP VM, I don’t get any of these entities. In fact, it doesn’t even catch the same text as an entity.

When you say

I don’t get any of these entities. In fact, it doesn’t even catch the same text as an entity. What are you seeing in rasa x?

I don’t think it has to do with local vs image, as i’ve gotten the local to work okay.

Below is what I see in the interactive learning section of Rasa X with the text $2000-3000

Usually when it extracts an amount-of-money entity you’ll see inform{“amount-of-money”:some value} Like when I type $2000:

My local environment catches $2000-3000 as an amount-of-money entity, though

Okay now i understand. That’s interesting, I’m not sure. Let me try running the docker image and see what the output is

Locally i am still picking up entities (though different than the ones you are picking up):

$2000-3000
{
  "intent": {
    "name": "inform",
    "confidence": 0.9900633096694946
  },
  "entities": [
    {
      "start": 1,
      "end": 5,
      "text": "2000",
      "value": 2000,
      "confidence": 1.0,
      "additional_info": {
        "value": 2000,
        "type": "value"
      },
      "entity": "number",
      "extractor": "DucklingHTTPExtractor"
    },
    {
      "start": 5,
      "end": 10,
      "text": "-3000",
      "value": -3000,
      "confidence": 1.0,
      "additional_info": {
        "value": -3000,
        "type": "value"
      },
      "entity": "number",
      "extractor": "DucklingHTTPExtractor"
    }
  ],

Can you try turning on debug mode and looking at the rasa-production logs to see what they report as entities picked up?

How do I turn on debug mode using docker?

In the docker-compose setup, it would involve adding --debug to the command in x-rasa-services:

x-rasa-services: &default-rasa-service
  restart: always
  image: "rasa/rasa:${RASA_VERSION}-full"
  expose:
    - "5005"
  command: >
    x
    --no-prompt
    --production
    --config-endpoint http://rasa-x:5002/api/config?token=${RASA_X_TOKEN}
    --port 5005
    --jwt-method HS256
    --jwt-secret ${JWT_SECRET}
    --auth-token '${RASA_TOKEN}'
    --cors "*"