File size: 27,434 Bytes
e528490
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": [],
      "gpuType": "T4"
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    },
    "accelerator": "GPU"
  },
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "# Multiple-choice question"
      ],
      "metadata": {
        "id": "bjbqHUTuNFyd"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "# 1. Install Litelines"
      ],
      "metadata": {
        "id": "B8jIr1KAKQWF"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "id": "cvgtiC0Kcl-z"
      },
      "outputs": [],
      "source": [
        "%pip install --quiet --upgrade litelines"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "## 2. Download a model and its tokenizer"
      ],
      "metadata": {
        "id": "-dLJS16ZNy97"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# Use cuda for faster inference\n",
        "import torch\n",
        "\n",
        "device = torch.device(\"cuda\") if torch.cuda.is_available() else torch.device(\"cpu\")\n",
        "assert device == torch.device(\"cuda\"), \"In the Runtime tab, please Change runtime type to GPU\""
      ],
      "metadata": {
        "id": "68zKdmOQcqLo"
      },
      "execution_count": 2,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "from transformers import AutoModelForCausalLM, AutoTokenizer\n",
        "\n",
        "MODEL_ID = \"Qwen/Qwen2.5-0.5B-Instruct\"\n",
        "tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)\n",
        "model = AutoModelForCausalLM.from_pretrained(MODEL_ID).to(device)"
      ],
      "metadata": {
        "id": "U-a-w5jwc6Xg"
      },
      "execution_count": 3,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "## 3. Prepare the inputs to the LLM"
      ],
      "metadata": {
        "id": "ohUnAx9NJ7AV"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "user_input = \"\"\"Which key combination exits Vim?\n",
        "\n",
        "A) Ctrl+X\n",
        "B) Esc then :q!\n",
        "C) Alt+F4\n",
        "\"\"\"\n",
        "messages = [{\"role\": \"user\", \"content\": user_input}]\n",
        "inputs = tokenizer.apply_chat_template(\n",
        "    messages,\n",
        "    add_generation_prompt=True,\n",
        "    return_tensors=\"pt\",\n",
        "    return_dict=True\n",
        ").to(model.device)"
      ],
      "metadata": {
        "id": "Y8RtiZ7UefUx"
      },
      "execution_count": 4,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "## 4. Define a processor through a regular expression"
      ],
      "metadata": {
        "id": "9LaJrh0PKkcn"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from litelines.transformers import SchemaProcessor\n",
        "\n",
        "processor = SchemaProcessor(response_format=r\"A\\.|B\\.|C\\.\", tokenizer=tokenizer)\n",
        "processor.show_graph()"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 331
        },
        "id": "sVx6IzInKHoL",
        "outputId": "6b6a373e-91cd-48ce-ed31-e198d2584dce"
      },
      "execution_count": 5,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<IPython.core.display.SVG object>"
            ],
            "image/svg+xml": "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"401pt\" height=\"232pt\" viewBox=\"0.00 0.00 401.00 232.00\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 228)\">\n<title>%3</title>\n<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-228 397,-228 397,4 -4,4\"/>\n<text text-anchor=\"middle\" x=\"92\" y=\"-208.8\" font-family=\"Times,serif\" font-size=\"14.00\">Allowed Paths</text>\n<text text-anchor=\"middle\" x=\"92\" y=\"-193.8\" font-family=\"Times,serif\" font-size=\"14.00\">Regular expression: A\\.|B\\.|C\\.</text>\n<!-- 0 -->\n<g id=\"node1\" class=\"node\">\n<title>0</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"109\" cy=\"-83\" rx=\"18\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"109\" y=\"-79.3\" font-family=\"Times,serif\" font-size=\"14.00\">0</text>\n</g>\n<!-- 1 -->\n<g id=\"node2\" class=\"node\">\n<title>1</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"238\" cy=\"-148\" rx=\"18\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"238\" y=\"-144.3\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n</g>\n<!-- 0&#45;&gt;1 -->\n<g id=\"edge2\" class=\"edge\">\n<title>0-&gt;1</title>\n<path fill=\"none\" stroke=\"black\" d=\"M118.83,-98.31C125,-107.68 134.08,-119.14 145,-126 164.59,-138.31 190.49,-143.74 209.81,-146.13\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"209.48,-149.61 219.79,-147.16 210.21,-142.65 209.48,-149.61\"/>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"145.5,-165 145.5,-186 165.5,-186 165.5,-165 145.5,-165\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"145.5,-165 145.5,-186 165.5,-186 165.5,-165 145.5,-165\"/>\n<text text-anchor=\"start\" x=\"150\" y=\"-171.8\" font-family=\"Times,serif\" font-size=\"14.00\">id</text>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"165.5,-165 165.5,-186 202.5,-186 202.5,-165 165.5,-165\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"165.5,-165 165.5,-186 202.5,-186 202.5,-165 165.5,-165\"/>\n<text text-anchor=\"start\" x=\"168.5\" y=\"-171.8\" font-family=\"Times,serif\" font-size=\"14.00\">token</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"145.5,-144 145.5,-165 165.5,-165 165.5,-144 145.5,-144\"/>\n<text text-anchor=\"start\" x=\"148.5\" y=\"-150.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#00b4d8\">34</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"165.5,-144 165.5,-165 202.5,-165 202.5,-144 165.5,-144\"/>\n<text text-anchor=\"start\" x=\"179\" y=\"-150.8\" font-family=\"Times,serif\" font-size=\"14.00\">C</text>\n</g>\n<!-- 2 -->\n<g id=\"node3\" class=\"node\">\n<title>2</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"238\" cy=\"-83\" rx=\"18\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"238\" y=\"-79.3\" font-family=\"Times,serif\" font-size=\"14.00\">2</text>\n</g>\n<!-- 0&#45;&gt;2 -->\n<g id=\"edge3\" class=\"edge\">\n<title>0-&gt;2</title>\n<path fill=\"none\" stroke=\"black\" d=\"M127.13,-83C148.24,-83 184.4,-83 209.44,-83\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"209.74,-86.5 219.74,-83 209.74,-79.5 209.74,-86.5\"/>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"145.5,-104 145.5,-125 165.5,-125 165.5,-104 145.5,-104\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"145.5,-104 145.5,-125 165.5,-125 165.5,-104 145.5,-104\"/>\n<text text-anchor=\"start\" x=\"150\" y=\"-110.8\" font-family=\"Times,serif\" font-size=\"14.00\">id</text>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"165.5,-104 165.5,-125 202.5,-125 202.5,-104 165.5,-104\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"165.5,-104 165.5,-125 202.5,-125 202.5,-104 165.5,-104\"/>\n<text text-anchor=\"start\" x=\"168.5\" y=\"-110.8\" font-family=\"Times,serif\" font-size=\"14.00\">token</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"145.5,-83 145.5,-104 165.5,-104 165.5,-83 145.5,-83\"/>\n<text text-anchor=\"start\" x=\"148.5\" y=\"-89.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#00b4d8\">33</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"165.5,-83 165.5,-104 202.5,-104 202.5,-83 165.5,-83\"/>\n<text text-anchor=\"start\" x=\"179\" y=\"-89.8\" font-family=\"Times,serif\" font-size=\"14.00\">B</text>\n</g>\n<!-- 3 -->\n<g id=\"node4\" class=\"node\">\n<title>3</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"238\" cy=\"-18\" rx=\"18\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"238\" y=\"-14.3\" font-family=\"Times,serif\" font-size=\"14.00\">3</text>\n</g>\n<!-- 0&#45;&gt;3 -->\n<g id=\"edge4\" class=\"edge\">\n<title>0-&gt;3</title>\n<path fill=\"none\" stroke=\"black\" d=\"M117.98,-67.39C124.03,-57.17 133.28,-44.38 145,-37 164.45,-24.75 190.36,-20.23 209.73,-18.64\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"209.96,-22.13 219.73,-18.03 209.53,-15.15 209.96,-22.13\"/>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"145.5,-58 145.5,-79 165.5,-79 165.5,-58 145.5,-58\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"145.5,-58 145.5,-79 165.5,-79 165.5,-58 145.5,-58\"/>\n<text text-anchor=\"start\" x=\"150\" y=\"-64.8\" font-family=\"Times,serif\" font-size=\"14.00\">id</text>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"165.5,-58 165.5,-79 202.5,-79 202.5,-58 165.5,-58\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"165.5,-58 165.5,-79 202.5,-79 202.5,-58 165.5,-58\"/>\n<text text-anchor=\"start\" x=\"168.5\" y=\"-64.8\" font-family=\"Times,serif\" font-size=\"14.00\">token</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"145.5,-37 145.5,-58 165.5,-58 165.5,-37 145.5,-37\"/>\n<text text-anchor=\"start\" x=\"148.5\" y=\"-43.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#00b4d8\">32</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"165.5,-37 165.5,-58 202.5,-58 202.5,-37 165.5,-37\"/>\n<text text-anchor=\"start\" x=\"179\" y=\"-43.8\" font-family=\"Times,serif\" font-size=\"14.00\">A</text>\n</g>\n<!-- 4 -->\n<g id=\"node5\" class=\"node\">\n<title>4</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"371\" cy=\"-83\" rx=\"18\" ry=\"18\"/>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"371\" cy=\"-83\" rx=\"22\" ry=\"22\"/>\n<text text-anchor=\"middle\" x=\"371\" y=\"-79.3\" font-family=\"Times,serif\" font-size=\"14.00\">4</text>\n</g>\n<!-- 1&#45;&gt;4 -->\n<g id=\"edge5\" class=\"edge\">\n<title>1-&gt;4</title>\n<path fill=\"none\" stroke=\"black\" d=\"M256.07,-146.94C275.44,-145.08 307.4,-139.97 331,-126 338.44,-121.6 345.27,-115.32 351.07,-108.91\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"354.08,-110.77 357.83,-100.86 348.72,-106.27 354.08,-110.77\"/>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"274.5,-165 274.5,-186 294.5,-186 294.5,-165 274.5,-165\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"274.5,-165 274.5,-186 294.5,-186 294.5,-165 274.5,-165\"/>\n<text text-anchor=\"start\" x=\"279\" y=\"-171.8\" font-family=\"Times,serif\" font-size=\"14.00\">id</text>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"294.5,-165 294.5,-186 331.5,-186 331.5,-165 294.5,-165\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"294.5,-165 294.5,-186 331.5,-186 331.5,-165 294.5,-165\"/>\n<text text-anchor=\"start\" x=\"297.5\" y=\"-171.8\" font-family=\"Times,serif\" font-size=\"14.00\">token</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"274.5,-144 274.5,-165 294.5,-165 294.5,-144 274.5,-144\"/>\n<text text-anchor=\"start\" x=\"277.5\" y=\"-150.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#00b4d8\">13</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"294.5,-144 294.5,-165 331.5,-165 331.5,-144 294.5,-144\"/>\n<text text-anchor=\"start\" x=\"311\" y=\"-150.8\" font-family=\"Times,serif\" font-size=\"14.00\">.</text>\n</g>\n<!-- 2&#45;&gt;4 -->\n<g id=\"edge6\" class=\"edge\">\n<title>2-&gt;4</title>\n<path fill=\"none\" stroke=\"black\" d=\"M256.13,-83C277.09,-83 313.01,-83 338.9,-83\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"338.97,-86.5 348.97,-83 338.97,-79.5 338.97,-86.5\"/>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"274.5,-104 274.5,-125 294.5,-125 294.5,-104 274.5,-104\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"274.5,-104 274.5,-125 294.5,-125 294.5,-104 274.5,-104\"/>\n<text text-anchor=\"start\" x=\"279\" y=\"-110.8\" font-family=\"Times,serif\" font-size=\"14.00\">id</text>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"294.5,-104 294.5,-125 331.5,-125 331.5,-104 294.5,-104\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"294.5,-104 294.5,-125 331.5,-125 331.5,-104 294.5,-104\"/>\n<text text-anchor=\"start\" x=\"297.5\" y=\"-110.8\" font-family=\"Times,serif\" font-size=\"14.00\">token</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"274.5,-83 274.5,-104 294.5,-104 294.5,-83 274.5,-83\"/>\n<text text-anchor=\"start\" x=\"277.5\" y=\"-89.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#00b4d8\">13</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"294.5,-83 294.5,-104 331.5,-104 331.5,-83 294.5,-83\"/>\n<text text-anchor=\"start\" x=\"311\" y=\"-89.8\" font-family=\"Times,serif\" font-size=\"14.00\">.</text>\n</g>\n<!-- 3&#45;&gt;4 -->\n<g id=\"edge7\" class=\"edge\">\n<title>3-&gt;4</title>\n<path fill=\"none\" stroke=\"black\" d=\"M256.13,-18.25C275.56,-19.25 307.58,-23.1 331,-37 339.15,-41.84 346.42,-49.01 352.4,-56.26\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"349.97,-58.84 358.82,-64.67 355.54,-54.6 349.97,-58.84\"/>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"274.5,-58 274.5,-79 294.5,-79 294.5,-58 274.5,-58\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"274.5,-58 274.5,-79 294.5,-79 294.5,-58 274.5,-58\"/>\n<text text-anchor=\"start\" x=\"279\" y=\"-64.8\" font-family=\"Times,serif\" font-size=\"14.00\">id</text>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"294.5,-58 294.5,-79 331.5,-79 331.5,-58 294.5,-58\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"294.5,-58 294.5,-79 331.5,-79 331.5,-58 294.5,-58\"/>\n<text text-anchor=\"start\" x=\"297.5\" y=\"-64.8\" font-family=\"Times,serif\" font-size=\"14.00\">token</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"274.5,-37 274.5,-58 294.5,-58 294.5,-37 274.5,-37\"/>\n<text text-anchor=\"start\" x=\"277.5\" y=\"-43.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#00b4d8\">13</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"294.5,-37 294.5,-58 331.5,-58 331.5,-37 294.5,-37\"/>\n<text text-anchor=\"start\" x=\"311\" y=\"-43.8\" font-family=\"Times,serif\" font-size=\"14.00\">.</text>\n</g>\n<g id=\"node6\" class=\"node\">\n<title/>\n</g>\n<!-- &#45;&gt;0 -->\n<g id=\"edge1\" class=\"edge\">\n<title>-&gt;0</title>\n<path fill=\"none\" stroke=\"black\" d=\"M54.19,-83C62.65,-83 72.05,-83 80.6,-83\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"80.83,-86.5 90.83,-83 80.83,-79.5 80.83,-86.5\"/>\n</g>\n</g>\n</svg>"
          },
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "## 5. Generate a structured response"
      ],
      "metadata": {
        "id": "UUkc7wXcOQlN"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "generated = model.generate(**inputs, logits_processor=[processor], temperature=0.1)\n",
        "print(f\"Response: {tokenizer.decode(generated[0][inputs['input_ids'].shape[-1]:-1])}\")"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "4oIHOm-rMdG0",
        "outputId": "d64d1505-aa01-4498-85fe-acc0112126c5"
      },
      "execution_count": 6,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Response: B.\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "## 6. Visualize the selected path"
      ],
      "metadata": {
        "id": "7ANqIJQ_M9fH"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "processor.show_graph()"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 331
        },
        "id": "Pqo5AVexMnJ6",
        "outputId": "471d79a3-b43a-4f12-c756-32eecfb596e4"
      },
      "execution_count": 7,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<IPython.core.display.SVG object>"
            ],
            "image/svg+xml": "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"401pt\" height=\"232pt\" viewBox=\"0.00 0.00 401.00 232.00\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 228)\">\n<title>%3</title>\n<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-228 397,-228 397,4 -4,4\"/>\n<text text-anchor=\"middle\" x=\"92\" y=\"-208.8\" font-family=\"Times,serif\" font-size=\"14.00\">Allowed Paths</text>\n<text text-anchor=\"middle\" x=\"92\" y=\"-193.8\" font-family=\"Times,serif\" font-size=\"14.00\">Regular expression: A\\.|B\\.|C\\.</text>\n<!-- 0 -->\n<g id=\"node1\" class=\"node\">\n<title>0</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"109\" cy=\"-83\" rx=\"18\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"109\" y=\"-79.3\" font-family=\"Times,serif\" font-size=\"14.00\">0</text>\n</g>\n<!-- 1 -->\n<g id=\"node2\" class=\"node\">\n<title>1</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"238\" cy=\"-148\" rx=\"18\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"238\" y=\"-144.3\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n</g>\n<!-- 0&#45;&gt;1 -->\n<g id=\"edge2\" class=\"edge\">\n<title>0-&gt;1</title>\n<path fill=\"none\" stroke=\"black\" d=\"M118.83,-98.31C125,-107.68 134.08,-119.14 145,-126 164.59,-138.31 190.49,-143.74 209.81,-146.13\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"209.48,-149.61 219.79,-147.16 210.21,-142.65 209.48,-149.61\"/>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"145.5,-165 145.5,-186 165.5,-186 165.5,-165 145.5,-165\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"145.5,-165 145.5,-186 165.5,-186 165.5,-165 145.5,-165\"/>\n<text text-anchor=\"start\" x=\"150\" y=\"-171.8\" font-family=\"Times,serif\" font-size=\"14.00\">id</text>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"165.5,-165 165.5,-186 202.5,-186 202.5,-165 165.5,-165\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"165.5,-165 165.5,-186 202.5,-186 202.5,-165 165.5,-165\"/>\n<text text-anchor=\"start\" x=\"168.5\" y=\"-171.8\" font-family=\"Times,serif\" font-size=\"14.00\">token</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"145.5,-144 145.5,-165 165.5,-165 165.5,-144 145.5,-144\"/>\n<text text-anchor=\"start\" x=\"148.5\" y=\"-150.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#00b4d8\">34</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"165.5,-144 165.5,-165 202.5,-165 202.5,-144 165.5,-144\"/>\n<text text-anchor=\"start\" x=\"179\" y=\"-150.8\" font-family=\"Times,serif\" font-size=\"14.00\">C</text>\n</g>\n<!-- 2 -->\n<g id=\"node3\" class=\"node\">\n<title>2</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"238\" cy=\"-83\" rx=\"18\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"238\" y=\"-79.3\" font-family=\"Times,serif\" font-size=\"14.00\">2</text>\n</g>\n<!-- 0&#45;&gt;2 -->\n<g id=\"edge3\" class=\"edge\">\n<title>0-&gt;2</title>\n<path fill=\"none\" stroke=\"red\" stroke-width=\"3\" d=\"M127.13,-83C148.24,-83 184.4,-83 209.44,-83\"/>\n<polygon fill=\"red\" stroke=\"red\" stroke-width=\"3\" points=\"209.74,-86.5 219.74,-83 209.74,-79.5 209.74,-86.5\"/>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"145.5,-104 145.5,-125 165.5,-125 165.5,-104 145.5,-104\"/>\n<polygon fill=\"none\" stroke=\"red\" points=\"145.5,-104 145.5,-125 165.5,-125 165.5,-104 145.5,-104\"/>\n<text text-anchor=\"start\" x=\"150\" y=\"-110.8\" font-family=\"Times,serif\" font-size=\"14.00\">id</text>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"165.5,-104 165.5,-125 202.5,-125 202.5,-104 165.5,-104\"/>\n<polygon fill=\"none\" stroke=\"red\" points=\"165.5,-104 165.5,-125 202.5,-125 202.5,-104 165.5,-104\"/>\n<text text-anchor=\"start\" x=\"168.5\" y=\"-110.8\" font-family=\"Times,serif\" font-size=\"14.00\">token</text>\n<polygon fill=\"none\" stroke=\"red\" points=\"145.5,-83 145.5,-104 165.5,-104 165.5,-83 145.5,-83\"/>\n<text text-anchor=\"start\" x=\"148.5\" y=\"-89.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#00b4d8\">33</text>\n<polygon fill=\"none\" stroke=\"red\" points=\"165.5,-83 165.5,-104 202.5,-104 202.5,-83 165.5,-83\"/>\n<text text-anchor=\"start\" x=\"179\" y=\"-89.8\" font-family=\"Times,serif\" font-size=\"14.00\">B</text>\n</g>\n<!-- 3 -->\n<g id=\"node4\" class=\"node\">\n<title>3</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"238\" cy=\"-18\" rx=\"18\" ry=\"18\"/>\n<text text-anchor=\"middle\" x=\"238\" y=\"-14.3\" font-family=\"Times,serif\" font-size=\"14.00\">3</text>\n</g>\n<!-- 0&#45;&gt;3 -->\n<g id=\"edge4\" class=\"edge\">\n<title>0-&gt;3</title>\n<path fill=\"none\" stroke=\"black\" d=\"M117.98,-67.39C124.03,-57.17 133.28,-44.38 145,-37 164.45,-24.75 190.36,-20.23 209.73,-18.64\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"209.96,-22.13 219.73,-18.03 209.53,-15.15 209.96,-22.13\"/>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"145.5,-58 145.5,-79 165.5,-79 165.5,-58 145.5,-58\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"145.5,-58 145.5,-79 165.5,-79 165.5,-58 145.5,-58\"/>\n<text text-anchor=\"start\" x=\"150\" y=\"-64.8\" font-family=\"Times,serif\" font-size=\"14.00\">id</text>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"165.5,-58 165.5,-79 202.5,-79 202.5,-58 165.5,-58\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"165.5,-58 165.5,-79 202.5,-79 202.5,-58 165.5,-58\"/>\n<text text-anchor=\"start\" x=\"168.5\" y=\"-64.8\" font-family=\"Times,serif\" font-size=\"14.00\">token</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"145.5,-37 145.5,-58 165.5,-58 165.5,-37 145.5,-37\"/>\n<text text-anchor=\"start\" x=\"148.5\" y=\"-43.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#00b4d8\">32</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"165.5,-37 165.5,-58 202.5,-58 202.5,-37 165.5,-37\"/>\n<text text-anchor=\"start\" x=\"179\" y=\"-43.8\" font-family=\"Times,serif\" font-size=\"14.00\">A</text>\n</g>\n<!-- 4 -->\n<g id=\"node5\" class=\"node\">\n<title>4</title>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"371\" cy=\"-83\" rx=\"18\" ry=\"18\"/>\n<ellipse fill=\"none\" stroke=\"black\" cx=\"371\" cy=\"-83\" rx=\"22\" ry=\"22\"/>\n<text text-anchor=\"middle\" x=\"371\" y=\"-79.3\" font-family=\"Times,serif\" font-size=\"14.00\">4</text>\n</g>\n<!-- 1&#45;&gt;4 -->\n<g id=\"edge5\" class=\"edge\">\n<title>1-&gt;4</title>\n<path fill=\"none\" stroke=\"black\" d=\"M256.07,-146.94C275.44,-145.08 307.4,-139.97 331,-126 338.44,-121.6 345.27,-115.32 351.07,-108.91\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"354.08,-110.77 357.83,-100.86 348.72,-106.27 354.08,-110.77\"/>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"274.5,-165 274.5,-186 294.5,-186 294.5,-165 274.5,-165\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"274.5,-165 274.5,-186 294.5,-186 294.5,-165 274.5,-165\"/>\n<text text-anchor=\"start\" x=\"279\" y=\"-171.8\" font-family=\"Times,serif\" font-size=\"14.00\">id</text>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"294.5,-165 294.5,-186 331.5,-186 331.5,-165 294.5,-165\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"294.5,-165 294.5,-186 331.5,-186 331.5,-165 294.5,-165\"/>\n<text text-anchor=\"start\" x=\"297.5\" y=\"-171.8\" font-family=\"Times,serif\" font-size=\"14.00\">token</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"274.5,-144 274.5,-165 294.5,-165 294.5,-144 274.5,-144\"/>\n<text text-anchor=\"start\" x=\"277.5\" y=\"-150.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#00b4d8\">13</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"294.5,-144 294.5,-165 331.5,-165 331.5,-144 294.5,-144\"/>\n<text text-anchor=\"start\" x=\"311\" y=\"-150.8\" font-family=\"Times,serif\" font-size=\"14.00\">.</text>\n</g>\n<!-- 2&#45;&gt;4 -->\n<g id=\"edge6\" class=\"edge\">\n<title>2-&gt;4</title>\n<path fill=\"none\" stroke=\"red\" stroke-width=\"3\" d=\"M256.13,-83C277.09,-83 313.01,-83 338.9,-83\"/>\n<polygon fill=\"red\" stroke=\"red\" stroke-width=\"3\" points=\"338.97,-86.5 348.97,-83 338.97,-79.5 338.97,-86.5\"/>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"274.5,-104 274.5,-125 294.5,-125 294.5,-104 274.5,-104\"/>\n<polygon fill=\"none\" stroke=\"red\" points=\"274.5,-104 274.5,-125 294.5,-125 294.5,-104 274.5,-104\"/>\n<text text-anchor=\"start\" x=\"279\" y=\"-110.8\" font-family=\"Times,serif\" font-size=\"14.00\">id</text>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"294.5,-104 294.5,-125 331.5,-125 331.5,-104 294.5,-104\"/>\n<polygon fill=\"none\" stroke=\"red\" points=\"294.5,-104 294.5,-125 331.5,-125 331.5,-104 294.5,-104\"/>\n<text text-anchor=\"start\" x=\"297.5\" y=\"-110.8\" font-family=\"Times,serif\" font-size=\"14.00\">token</text>\n<polygon fill=\"none\" stroke=\"red\" points=\"274.5,-83 274.5,-104 294.5,-104 294.5,-83 274.5,-83\"/>\n<text text-anchor=\"start\" x=\"277.5\" y=\"-89.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#00b4d8\">13</text>\n<polygon fill=\"none\" stroke=\"red\" points=\"294.5,-83 294.5,-104 331.5,-104 331.5,-83 294.5,-83\"/>\n<text text-anchor=\"start\" x=\"311\" y=\"-89.8\" font-family=\"Times,serif\" font-size=\"14.00\">.</text>\n</g>\n<!-- 3&#45;&gt;4 -->\n<g id=\"edge7\" class=\"edge\">\n<title>3-&gt;4</title>\n<path fill=\"none\" stroke=\"black\" d=\"M256.13,-18.25C275.56,-19.25 307.58,-23.1 331,-37 339.15,-41.84 346.42,-49.01 352.4,-56.26\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"349.97,-58.84 358.82,-64.67 355.54,-54.6 349.97,-58.84\"/>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"274.5,-58 274.5,-79 294.5,-79 294.5,-58 274.5,-58\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"274.5,-58 274.5,-79 294.5,-79 294.5,-58 274.5,-58\"/>\n<text text-anchor=\"start\" x=\"279\" y=\"-64.8\" font-family=\"Times,serif\" font-size=\"14.00\">id</text>\n<polygon fill=\"#ffebcd\" stroke=\"transparent\" points=\"294.5,-58 294.5,-79 331.5,-79 331.5,-58 294.5,-58\"/>\n<polygon fill=\"none\" stroke=\"black\" points=\"294.5,-58 294.5,-79 331.5,-79 331.5,-58 294.5,-58\"/>\n<text text-anchor=\"start\" x=\"297.5\" y=\"-64.8\" font-family=\"Times,serif\" font-size=\"14.00\">token</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"274.5,-37 274.5,-58 294.5,-58 294.5,-37 274.5,-37\"/>\n<text text-anchor=\"start\" x=\"277.5\" y=\"-43.8\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#00b4d8\">13</text>\n<polygon fill=\"none\" stroke=\"black\" points=\"294.5,-37 294.5,-58 331.5,-58 331.5,-37 294.5,-37\"/>\n<text text-anchor=\"start\" x=\"311\" y=\"-43.8\" font-family=\"Times,serif\" font-size=\"14.00\">.</text>\n</g>\n<g id=\"node6\" class=\"node\">\n<title/>\n</g>\n<!-- &#45;&gt;0 -->\n<g id=\"edge1\" class=\"edge\">\n<title>-&gt;0</title>\n<path fill=\"none\" stroke=\"black\" d=\"M54.19,-83C62.65,-83 72.05,-83 80.6,-83\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"80.83,-86.5 90.83,-83 80.83,-79.5 80.83,-86.5\"/>\n</g>\n</g>\n</svg>"
          },
          "metadata": {}
        }
      ]
    }
  ]
}