debatelab/deepa2

View on GitHub
notebooks/DeepA2ServeExample.ipynb

Summary

Maintainability
Test Coverage
{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "DeepA2ServeExample.ipynb",
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "# Serving Multiangular DeepA2 Datasets as T2T (`csv`)"
      ],
      "metadata": {
        "id": "8VNfJcnKLBGt"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "Install `deepa2`:"
      ],
      "metadata": {
        "id": "ltFoMuQQLQZH"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "!pip install deepa2"
      ],
      "metadata": {
        "id": "0bycVy4yyv1L"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "Configuration:"
      ],
      "metadata": {
        "id": "QVxoOHJGLULp"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "import yaml\n",
        "\n",
        "config = {\n",
        "    \"sources\": [\n",
        "        {\n",
        "            \"path\": \"debatelab/deepa2\",\n",
        "            \"data_files\": {\n",
        "                \"train\": [\n",
        "                          \"aaac01/train/train.parquet\",\n",
        "                          \"aaac02/train/train.parquet\",\n",
        "                ],\n",
        "                \"validation\": [\n",
        "                          \"aaac01/validation/validation.parquet\",\n",
        "                          \"aaac02/validation/validation.parquet\",\n",
        "                ],\n",
        "                \"test\": [\n",
        "                          \"aaac01/test/test.parquet\",\n",
        "                          \"aaac02/test/test.parquet\",                         \n",
        "                ]\n",
        "            }\n",
        "        },\n",
        "    ],\n",
        "    \"export_format\": \"csv\",\n",
        "    \"export_path\": \"t2t\",\n",
        "    \"generative_modes\": [\n",
        "        {\"name\": \"e => a\"},\n",
        "        {\"name\": \"s => a\"},\n",
        "    ]\n",
        "}\n",
        "\n",
        "with open(r'config.yml', 'w') as file:\n",
        "    yaml.dump(config, file)"
      ],
      "metadata": {
        "id": "cU7zW5y1DKSx"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "Serve:"
      ],
      "metadata": {
        "id": "6XmUbIyBLXZU"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "!deepa2 serve --configfile ./config.yml"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "7g1HHKrm4ihO",
        "outputId": "f928e236-e0c6-4a0b-9643-96ea37c6319e"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "Check:"
      ],
      "metadata": {
        "id": "SaITjUDkLbl-"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "!ls t2t"
      ],
      "metadata": {
        "id": "bGB4JZI0Lhmg"
      },
      "execution_count": null,
      "outputs": []
    }
  ]
}