跳到主要內容

發表文章

目前顯示的是 12月, 2021的文章

快速建立 NLU 模型

Step 1. 準備環境 conda create --name=rasa-env python=3.8 conda activate rasa-env pip install rasa[full] Step 2. 初始化工作目錄 import rasa from rasa.cli.scaffold import create_initial_project create_initial_project("MY_NLP_PROJECT") import os os.chdir("MY_NLP_PROJECT") Step 3. 開始訓練 rasa train nlu Step 4. 測試 #import rasa from rasa.core.agent import Agent interpreter = Agent.load("./models/nlu-20211213-035921-charitable-score.tar.gz") import asyncio import nest_asyncio nest_asyncio.apply() asyncio.run(interpreter.parse_message("kill"))

Run notebook in Airflow

  The simplest way to achieve this goal is using KubernetesPodOperator to execute papermill command. For example run_notebook = kubernetes_pod_operator.KubernetesPodOperator( task_id=f"run-notebook", name=f"run-notebook", namespace='default', is_delete_operator_pod=True, image_pull_policy="IfNotPresent", startup_timeout_seconds=3600, cmds=['/bin/bash'], arguments=["-c", """ echo y | conda create --name=runenv python=3.8 source /opt/conda/etc/profile.d/conda.sh conda activate runenv conda install ipykernel python -m ipykernel install --user --name=runenv papermill \ "{{dag_run.conf['nbIn']}}" \ "{{dag_run.conf['nbOut']}}" \