无法加载模型,从 docker-compose 初始化 DIETClassifier 图表时出错

发布于 2025-01-09 17:31:35 字数 1975 浏览 0 评论 0原文

https://github.com/RasaHQ/rasa/blob/ main/docker/docker-compose.yml 我无法使用 docker-compose 加载我的模型,它为节点“run_DIET”提供初始化图形组件,

version: '3.0'

services:
  rasa:
    image: rasa/rasa:3.0.8-full
    networks: ['rasa-network']
    ports:
    - "5005:5005"
    volumes:
    - "./formbot/:/app/"
    environment:
      MPLCONFIGDIR: "/tmp/"
    command:
    - run
    - --enable-api  
    - --cors   
    - "*"  

  action_server:
    image: rasa/rasa-sdk:latest
    networks: ['rasa-network']
    ports:
    - "5055:5055"
    volumes:
    - "./formbot/actions:/app/actions"

  duckling:
    image: rasa/duckling:latest
    networks: ['rasa-network']
    ports:
    - "8000:8000"

networks: {rasa-network: {}}

这是日志

Attaching to test-doc_duckling_1, test-doc_action_server_1, test-doc_rasa_1
action_server_1  | 2022-02-13 05:39:25 INFO     rasa_sdk.endpoint  - Starting action endpoint server...
action_server_1  | 2022-02-13 05:39:25 INFO     rasa_sdk.executor  - Registered function for 'validate_restaurant_form'.
action_server_1  | 2022-02-13 05:39:25 INFO     rasa_sdk.endpoint  - Action endpoint is up and running on http://0.0.0.0:5055
duckling_1       | Listening on http://0.0.0.0:8000
rasa_1           | 2022-02-13 05:39:28 INFO     root  - Starting Rasa server on http://0.0.0.0:5005
rasa_1           | 2022-02-13 05:39:30 INFO     rasa.core.processor  - Loading model models/20220212-205144-small-slider.tar.gz...
rasa_1           | 2022-02-13 05:39:30 ERROR    rasa.core.agent  - Could not load model due to Error initializing graph component for node 'run_DIETClassifier4'..
rasa_1           | 2022-02-13 05:39:30 INFO     root  - Rasa server is up and running.

问题参考:https://github.com/RasaHQ/rasa/issues/10883

https://github.com/RasaHQ/rasa/blob/main/docker/docker-compose.yml
I cannot load my model using docker-compose, it is giving an initializing graph component for node 'run_DIET'

version: '3.0'

services:
  rasa:
    image: rasa/rasa:3.0.8-full
    networks: ['rasa-network']
    ports:
    - "5005:5005"
    volumes:
    - "./formbot/:/app/"
    environment:
      MPLCONFIGDIR: "/tmp/"
    command:
    - run
    - --enable-api  
    - --cors   
    - "*"  

  action_server:
    image: rasa/rasa-sdk:latest
    networks: ['rasa-network']
    ports:
    - "5055:5055"
    volumes:
    - "./formbot/actions:/app/actions"

  duckling:
    image: rasa/duckling:latest
    networks: ['rasa-network']
    ports:
    - "8000:8000"

networks: {rasa-network: {}}

here is the log

Attaching to test-doc_duckling_1, test-doc_action_server_1, test-doc_rasa_1
action_server_1  | 2022-02-13 05:39:25 INFO     rasa_sdk.endpoint  - Starting action endpoint server...
action_server_1  | 2022-02-13 05:39:25 INFO     rasa_sdk.executor  - Registered function for 'validate_restaurant_form'.
action_server_1  | 2022-02-13 05:39:25 INFO     rasa_sdk.endpoint  - Action endpoint is up and running on http://0.0.0.0:5055
duckling_1       | Listening on http://0.0.0.0:8000
rasa_1           | 2022-02-13 05:39:28 INFO     root  - Starting Rasa server on http://0.0.0.0:5005
rasa_1           | 2022-02-13 05:39:30 INFO     rasa.core.processor  - Loading model models/20220212-205144-small-slider.tar.gz...
rasa_1           | 2022-02-13 05:39:30 ERROR    rasa.core.agent  - Could not load model due to Error initializing graph component for node 'run_DIETClassifier4'..
rasa_1           | 2022-02-13 05:39:30 INFO     root  - Rasa server is up and running.

issue reference: https://github.com/RasaHQ/rasa/issues/10883

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦毁影碎の 2025-01-16 17:31:35

可能的问题是模型文件将从 /tmp 引用组件依赖项。并在使用预构建容器(rasa/rasa:3.0.8-full 容器)修补时导致模型变得异常。

作为一种解决方法,我们可以在将工作目录克隆到预构建容器中后完全训练模型,该容器会生成一个包含其所有内容的新模型满足依赖关系

添加docker文件

FROM rasa/rasa:3.0.6-full

RUN rasa init --no-prompt
USER root
WORKDIR /app
COPY . .

RUN rasa train
RUN chmod +x /app/scripts/*

ENTRYPOINT []

CMD /app/scripts/start_services.sh

和scripts/start_services.sh

rasa run --model /app/models --enable-api --cors "*" --debug \
        --endpoints /app/endpoints.yml \
        -p 8080

The probable issue is the model file that would be referencing component dependencies from /tmp. and causing the model to go rogue when patched with prebuild containers (rasa/rasa:3.0.8-full containers)

As a workaround, we can fully train the model after cloning the workdir into prebuilt containers which generate altogether a new model with all its dependencies met

Adding the docker file

FROM rasa/rasa:3.0.6-full

RUN rasa init --no-prompt
USER root
WORKDIR /app
COPY . .

RUN rasa train
RUN chmod +x /app/scripts/*

ENTRYPOINT []

CMD /app/scripts/start_services.sh

and scripts/start_services.sh

rasa run --model /app/models --enable-api --cors "*" --debug \
        --endpoints /app/endpoints.yml \
        -p 8080
幽蝶幻影 2025-01-16 17:31:35

对我有用的解决方案是正常初始化 docker 容器,无需 shell 脚本。 rasa 服务器运行后,我在终端中执行“docker compose run wattbot_rasa train”,以便在容器内训练模型。我的例子中的错误是,我在 Windows 中训练了预先存在的模型,而容器是基于 Linux 的,所以这不起作用...通过在 docker 容器内训练模型,它再次工作,我不必运行任何 shell 脚本:)
这可能不是最好的解决方案,但 shell 脚本不太适合我,所以我将其留在这里,以防其他人也遇到同样的错误

The solution that worked for me was to initialize the docker containers normally, without a shell script. Once the rasa server is running, I executed "docker compose run wattbot_rasa train" in the terminal, so that there´s a model that was trained INSIDE the container. The error in my case was that I trained the preexisting models in windows and the containers were linux based, so that didn´t work... by training the model inside the docker container, it worked again and I didn´t have to run any shell scripts :)
It probably isn´t the best solution, but the shell script didn´t quite work for me, so I´m leaving this here in case someone else is also struggling with the same error ????????‍♂️

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文