{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "U2ll54gJt3hR" }, "source": [ "# 머신 러닝 교과서 3판" ] }, { "cell_type": "markdown", "metadata": { "id": "f6CoM_jTt3hS" }, "source": [ "# 16장 - 순환 신경망으로 순차 데이터 모델링 (1/2)" ] }, { "cell_type": "markdown", "metadata": { "id": "FAhOxXi8t3hT" }, "source": [ "**아래 링크를 통해 이 노트북을 주피터 노트북 뷰어(nbviewer.jupyter.org)로 보거나 구글 코랩(colab.research.google.com)에서 실행할 수 있습니다.**\n", "\n", "\n", " \n", " \n", "
\n", " 주피터 노트북 뷰어로 보기\n", " \n", " 구글 코랩(Colab)에서 실행하기\n", "
" ] }, { "cell_type": "markdown", "metadata": { "id": "ivB0ZSFGt3hT" }, "source": [ "### 목차" ] }, { "cell_type": "markdown", "metadata": { "id": "57dQGeStt3hT" }, "source": [ "- 순차 데이터 소개\n", " - 순차 데이터 모델링: 순서를 고려한다\n", " - 시퀀스 표현\n", " - 시퀀스 모델링의 종류\n", "- 시퀀스 모델링을 위한 RNN\n", " - RNN 반복 구조 이해하기\n", " - RNN의 활성화 출력 계산\n", " - 은닉 순환과 출력 순환\n", " - 긴 시퀀스 학습의 어려움\n", " - LSTM 셀\n", "- 텐서플로로 시퀀스 모델링을 위한 RNN 구현하기\n", " - 첫 번째 프로젝트: IMDb 영화 리뷰 감성 분석\n", " - 영화 리뷰 데이터 준비\n", " - 문장 인코딩을 위한 임베딩 층\n", " - RNN 모델 만들기\n", " - 감성 분석 작업을 위한 RNN 모델 만들기" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2020-12-31T14:52:56.448296Z", "iopub.status.busy": "2020-12-31T14:52:56.447399Z", "iopub.status.idle": "2020-12-31T14:52:56.450102Z", "shell.execute_reply": "2020-12-31T14:52:56.450840Z" }, "id": "SHqvUk9kt3hT" }, "outputs": [], "source": [ "from IPython.display import Image" ] }, { "cell_type": "markdown", "metadata": { "id": "Wr5StFyQt3hT" }, "source": [ "# 순차 데이터 소개\n", "## 순차 데이터 모델링: 순서를 고려한다\n", "## 시퀀스 표현" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 283 }, "execution": { "iopub.execute_input": "2020-12-31T14:52:56.456190Z", "iopub.status.busy": "2020-12-31T14:52:56.455553Z", "iopub.status.idle": "2020-12-31T14:52:56.463431Z", "shell.execute_reply": "2020-12-31T14:52:56.464269Z" }, "id": "k1c-6p52t3hU", "outputId": "47d2fa04-ac6f-40f4-90d8-036ab92a396a" }, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "execution_count": 2 } ], "source": [ "Image(url='https://git.io/JLdVm', width=700)" ] }, { "cell_type": "markdown", "metadata": { "id": "QL3g5J07t3hU" }, "source": [ "## 시퀀스 모델링의 종류" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 427 }, "execution": { "iopub.execute_input": "2020-12-31T14:52:56.470205Z", "iopub.status.busy": "2020-12-31T14:52:56.469239Z", "iopub.status.idle": "2020-12-31T14:52:56.510740Z", "shell.execute_reply": "2020-12-31T14:52:56.510046Z" }, "id": "Qe4WgH2Ot3hU", "outputId": "614daf60-6fac-4308-98f5-283ecb4ad73f" }, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "execution_count": 3 } ], "source": [ "Image(url='https://git.io/JLdVO', width=700)" ] }, { "cell_type": "markdown", "metadata": { "id": "Z5XrGPuht3hU" }, "source": [ "# 시퀀스 모델링을 위한 RNN\n", "## RNN 반복 구조 이해하기" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 312 }, "execution": { "iopub.execute_input": "2020-12-31T14:52:56.516239Z", "iopub.status.busy": "2020-12-31T14:52:56.515511Z", "iopub.status.idle": "2020-12-31T14:52:56.521165Z", "shell.execute_reply": "2020-12-31T14:52:56.520502Z" }, "id": "YrVhGKS0t3hV", "outputId": "3f34feae-2b13-4944-ea51-77b0b2e8d9c8" }, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "execution_count": 4 } ], "source": [ "Image(url='https://git.io/JLdV3', width=700)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 614 }, "execution": { "iopub.execute_input": "2020-12-31T14:52:56.525160Z", "iopub.status.busy": "2020-12-31T14:52:56.524521Z", "iopub.status.idle": "2020-12-31T14:52:56.530736Z", "shell.execute_reply": "2020-12-31T14:52:56.531285Z" }, "id": "_L2SXQ0Bt3hV", "outputId": "3eb49f57-80f3-4b17-df2b-4015ac2d3c4b" }, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "execution_count": 5 } ], "source": [ "Image(url='https://git.io/JLdVs', width=700)" ] }, { "cell_type": "markdown", "metadata": { "id": "Dv07BsIEt3hV" }, "source": [ "## RNN의 활성화 출력 계산" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 295 }, "execution": { "iopub.execute_input": "2020-12-31T14:52:56.535282Z", "iopub.status.busy": "2020-12-31T14:52:56.534647Z", "iopub.status.idle": "2020-12-31T14:52:56.540928Z", "shell.execute_reply": "2020-12-31T14:52:56.540327Z" }, "id": "KxnXQiRSt3hV", "outputId": "a753ba40-5be7-4a78-d8a0-ac3f79b7141f" }, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "execution_count": 6 } ], "source": [ "Image(url='https://git.io/JLdVC', width=700)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 373 }, "execution": { "iopub.execute_input": "2020-12-31T14:52:56.544851Z", "iopub.status.busy": "2020-12-31T14:52:56.544209Z", "iopub.status.idle": "2020-12-31T14:52:56.551185Z", "shell.execute_reply": "2020-12-31T14:52:56.551727Z" }, "id": "c7_mK8qVt3hV", "outputId": "f30e36d3-6213-4629-f4a0-1f746008d384" }, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "execution_count": 7 } ], "source": [ "Image(url='https://git.io/JLdVW', width=700)" ] }, { "cell_type": "markdown", "metadata": { "id": "u8Jumkd0t3hW" }, "source": [ "## 은닉 순환과 출력 순환" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 603 }, "execution": { "iopub.execute_input": "2020-12-31T14:52:56.555805Z", "iopub.status.busy": "2020-12-31T14:52:56.555162Z", "iopub.status.idle": "2020-12-31T14:52:56.561794Z", "shell.execute_reply": "2020-12-31T14:52:56.562334Z" }, "id": "iuGEUtnYt3hW", "outputId": "e4f61e63-ae24-48eb-dcf4-8b038fa424e7" }, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "execution_count": 8 } ], "source": [ "Image(url='https://git.io/JLdV8', width=700)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T14:52:56.568669Z", "iopub.status.busy": "2020-12-31T14:52:56.568012Z", "iopub.status.idle": "2020-12-31T14:52:58.384001Z", "shell.execute_reply": "2020-12-31T14:52:58.383269Z" }, "id": "Wvo3vxr8t3hW", "outputId": "145b1fca-232a-44a8-ee58-e67b448f87d5" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "W_xh 크기: (5, 2)\n", "W_oo 크기: (2, 2)\n", "b_h 크기: (2,)\n" ] } ], "source": [ "import tensorflow as tf\n", "tf.random.set_seed(1)\n", "\n", "rnn_layer = tf.keras.layers.SimpleRNN(\n", " units=2, use_bias=True,\n", " return_sequences=True)\n", "rnn_layer.build(input_shape=(None, None, 5))\n", "\n", "w_xh, w_oo, b_h = rnn_layer.weights\n", "\n", "print('W_xh 크기:', w_xh.shape)\n", "print('W_oo 크기:', w_oo.shape)\n", "print('b_h 크기:', b_h.shape)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T14:52:58.395104Z", "iopub.status.busy": "2020-12-31T14:52:58.394214Z", "iopub.status.idle": "2020-12-31T14:52:58.414734Z", "shell.execute_reply": "2020-12-31T14:52:58.414063Z" }, "id": "THMnNQoEt3hW", "outputId": "e9dca2d2-a0e4-4c66-ee3e-ffb1b055923d", "scrolled": true }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "타임 스텝 0 =>\n", " 입력 : [[1. 1. 1. 1. 1.]]\n", " 은닉 : [[0.96635884 0.9771539 ]]\n", " 출력 (수동) : [[0.7470998 0.7518313]]\n", " SimpleRNN 출력 : [0.7470998 0.7518313]\n", "\n", "타임 스텝 1 =>\n", " 입력 : [[2. 2. 2. 2. 2.]]\n", " 은닉 : [[1.9327177 1.9543078]]\n", " 출력 (수동) : [[0.99347186 0.89415705]]\n", " SimpleRNN 출력 : [0.99347186 0.89415705]\n", "\n", "타임 스텝 2 =>\n", " 입력 : [[3. 3. 3. 3. 3.]]\n", " 은닉 : [[2.8990765 2.9314618]]\n", " 출력 (수동) : [[0.99937034 0.9767568 ]]\n", " SimpleRNN 출력 : [0.99937034 0.9767568 ]\n", "\n" ] } ], "source": [ "x_seq = tf.convert_to_tensor(\n", " [[1.0]*5, [2.0]*5, [3.0]*5],\n", " dtype=tf.float32)\n", "\n", "\n", "## SimepleRNN의 출력:\n", "output = rnn_layer(tf.reshape(x_seq, shape=(1, 3, 5)))\n", "\n", "## 수동으로 출력 계산하기:\n", "out_man = []\n", "for t in range(len(x_seq)):\n", " xt = tf.reshape(x_seq[t], (1, 5))\n", " print('타임 스텝 {} =>'.format(t))\n", " print(' 입력 :', xt.numpy())\n", "\n", " ht = tf.matmul(xt, w_xh) + b_h\n", " print(' 은닉 :', ht.numpy())\n", "\n", " if t>0:\n", " prev_o = out_man[t-1]\n", " else:\n", " prev_o = tf.zeros(shape=(ht.shape))\n", "\n", " ot = ht + tf.matmul(prev_o, w_oo)\n", " ot = tf.math.tanh(ot)\n", " out_man.append(ot)\n", " print(' 출력 (수동) :', ot.numpy())\n", " print(' SimpleRNN 출력 :'.format(t), output[0][t].numpy())\n", " print()" ] }, { "cell_type": "markdown", "metadata": { "id": "oTJJZpjUt3hX" }, "source": [ "## 긴 시퀀스 학습의 어려움" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 352 }, "execution": { "iopub.execute_input": "2020-12-31T14:52:58.419575Z", "iopub.status.busy": "2020-12-31T14:52:58.418902Z", "iopub.status.idle": "2020-12-31T14:52:58.424237Z", "shell.execute_reply": "2020-12-31T14:52:58.423554Z" }, "id": "BrsADvYht3hX", "outputId": "c6320490-adcb-474f-e1f2-f68c0f9f31eb" }, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "execution_count": 11 } ], "source": [ "Image(url='https://git.io/JLdV4', width=700)" ] }, { "cell_type": "markdown", "metadata": { "id": "RtDltN0gt3hX" }, "source": [ "## LSTM 셀" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 382 }, "execution": { "iopub.execute_input": "2020-12-31T14:52:58.429035Z", "iopub.status.busy": "2020-12-31T14:52:58.428310Z", "iopub.status.idle": "2020-12-31T14:52:58.438957Z", "shell.execute_reply": "2020-12-31T14:52:58.439507Z" }, "id": "6YpVdbeTt3hX", "outputId": "c7dea33e-cef8-401d-815b-213b6e2a3195" }, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "execution_count": 12 } ], "source": [ "Image(url='https://git.io/JLdVR', width=700)" ] }, { "cell_type": "markdown", "metadata": { "id": "qNOM8cBit3hX" }, "source": [ "# 텐서플로로 시퀀스 모델링을 위한 RNN 구현하기\n", "## 첫 번째 프로젝트: IMDb 영화 리뷰 감성 분석\n", "### 영화 리뷰 데이터 준비" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "execution": { "iopub.execute_input": "2020-12-31T14:52:58.443781Z", "iopub.status.busy": "2020-12-31T14:52:58.443146Z", "iopub.status.idle": "2020-12-31T14:52:58.776050Z", "shell.execute_reply": "2020-12-31T14:52:58.775357Z" }, "id": "EDdVCNv5t3hY" }, "outputs": [], "source": [ "import tensorflow as tf\n", "import tensorflow_datasets as tfds\n", "import numpy as np\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "gUgiOmnUv7DQ", "outputId": "2f905bde-20fd-4815-e246-76aaee72f0d2" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "--2023-11-10 06:02:41-- https://github.com/rickiepark/python-machine-learning-book-3rd-edition/raw/master/ch08/movie_data.csv.gz\n", "Resolving github.com (github.com)... 192.30.255.112\n", "Connecting to github.com (github.com)|192.30.255.112|:443... connected.\n", "HTTP request sent, awaiting response... 302 Found\n", "Location: https://raw.githubusercontent.com/rickiepark/python-machine-learning-book-3rd-edition/master/ch08/movie_data.csv.gz [following]\n", "--2023-11-10 06:02:41-- https://raw.githubusercontent.com/rickiepark/python-machine-learning-book-3rd-edition/master/ch08/movie_data.csv.gz\n", "Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.110.133, ...\n", "Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443... connected.\n", "HTTP request sent, awaiting response... 200 OK\n", "Length: 26521894 (25M) [application/octet-stream]\n", "Saving to: ‘../ch08/movie_data.csv.gz’\n", "\n", "../ch08/movie_data. 100%[===================>] 25.29M 142MB/s in 0.2s \n", "\n", "2023-11-10 06:02:41 (142 MB/s) - ‘../ch08/movie_data.csv.gz’ saved [26521894/26521894]\n", "\n" ] } ], "source": [ "# 코랩에서 실행하는 경우 다음 코드를 실행하세요.\n", "!mkdir ../ch08\n", "!wget https://github.com/rickiepark/python-machine-learning-book-3rd-edition/raw/master/ch08/movie_data.csv.gz -O ../ch08/movie_data.csv.gz" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "execution": { "iopub.execute_input": "2020-12-31T14:52:58.786349Z", "iopub.status.busy": "2020-12-31T14:52:58.785414Z", "iopub.status.idle": "2020-12-31T14:53:00.001551Z", "shell.execute_reply": "2020-12-31T14:53:00.002307Z" }, "id": "9HcKmMPmt3hY" }, "outputs": [], "source": [ "import os\n", "import gzip\n", "import shutil\n", "\n", "\n", "with gzip.open('../ch08/movie_data.csv.gz', 'rb') as f_in, open('movie_data.csv', 'wb') as f_out:\n", " shutil.copyfileobj(f_in, f_out)" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 206 }, "execution": { "iopub.execute_input": "2020-12-31T14:53:00.009102Z", "iopub.status.busy": "2020-12-31T14:53:00.008204Z", "iopub.status.idle": "2020-12-31T14:53:00.445362Z", "shell.execute_reply": "2020-12-31T14:53:00.444609Z" }, "id": "I-9BuHr_t3hY", "outputId": "d7acb197-d14b-4a11-92e4-7b9c337cfc7d" }, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ " review sentiment\n", "49995 OK, lets start with the best. the building. al... 0\n", "49996 The British 'heritage film' industry is out of... 0\n", "49997 I don't even know where to begin on this one. ... 0\n", "49998 Richard Tyler is a little boy who is scared of... 0\n", "49999 I waited long to watch this movie. Also becaus... 1" ], "text/html": [ "\n", "
\n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
reviewsentiment
49995OK, lets start with the best. the building. al...0
49996The British 'heritage film' industry is out of...0
49997I don't even know where to begin on this one. ...0
49998Richard Tyler is a little boy who is scared of...0
49999I waited long to watch this movie. Also becaus...1
\n", "
\n", "
\n", "\n", "
\n", " \n", "\n", " \n", "\n", " \n", "
\n", "\n", "\n", "
\n", " \n", "\n", "\n", "\n", " \n", "
\n", "
\n", "
\n" ] }, "metadata": {}, "execution_count": 16 } ], "source": [ "df = pd.read_csv('movie_data.csv', encoding='utf-8')\n", "\n", "df.tail()" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T14:53:00.520021Z", "iopub.status.busy": "2020-12-31T14:53:00.519118Z", "iopub.status.idle": "2020-12-31T14:53:00.531067Z", "shell.execute_reply": "2020-12-31T14:53:00.530180Z" }, "id": "kpF_RvlVt3hY", "outputId": "2aae24b2-2372-4a08-a0db-a182de46fcbc" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "b'In 1974, the teenager Martha Moxley (Maggie Grace)' 1\n", "b'OK... so... I really like Kris Kristofferson and h' 0\n", "b'***SPOILER*** Do not read this, if you think about' 0\n" ] } ], "source": [ "# 단계 1: 데이터셋 만들기\n", "target = df.pop('sentiment')\n", "\n", "ds_raw = tf.data.Dataset.from_tensor_slices(\n", " (df.values, target.values))\n", "\n", "## 확인:\n", "for ex in ds_raw.take(3):\n", " tf.print(ex[0].numpy()[0][:50], ex[1])" ] }, { "cell_type": "markdown", "metadata": { "id": "8IBmW08tt3hY" }, "source": [ " * **훈련/검증/테스트 분할**" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "execution": { "iopub.execute_input": "2020-12-31T14:53:00.537026Z", "iopub.status.busy": "2020-12-31T14:53:00.536266Z", "iopub.status.idle": "2020-12-31T14:53:00.540439Z", "shell.execute_reply": "2020-12-31T14:53:00.539876Z" }, "id": "89xqs9SXt3hZ" }, "outputs": [], "source": [ "tf.random.set_seed(1)\n", "\n", "ds_raw = ds_raw.shuffle(\n", " 50000, reshuffle_each_iteration=False)\n", "\n", "ds_raw_test = ds_raw.take(25000)\n", "ds_raw_train_valid = ds_raw.skip(25000)\n", "ds_raw_train = ds_raw_train_valid.take(20000)\n", "ds_raw_valid = ds_raw_train_valid.skip(20000)" ] }, { "cell_type": "markdown", "metadata": { "id": "8eB8MAjOt3hZ" }, "source": [ " * **Tokenizer와 Encoder**\n", " * `tfds.deprecated.text.Tokenizer`: https://www.tensorflow.org/datasets/api_docs/python/tfds/deprecated/text/Tokenizer\n", " * `tfds.deprecated.text.TokenTextEncoder`: https://www.tensorflow.org/datasets/api_docs/python/tfds/deprecated/text/TokenTextEncoder" ] }, { "cell_type": "markdown", "metadata": { "id": "hzP-YuF3t3hZ" }, "source": [ " * **시퀀스 인코딩: 각 시퀀스에서 마지막 100개 원소만 유지하기**" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T14:53:00.547157Z", "iopub.status.busy": "2020-12-31T14:53:00.546406Z", "iopub.status.idle": "2020-12-31T14:53:04.613801Z", "shell.execute_reply": "2020-12-31T14:53:04.612898Z" }, "id": "zH3IFCust3hZ", "outputId": "8c237c2c-d946-483a-ca49-4741c9d9b1fa", "scrolled": true }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "어휘 사전 크기: 87007\n" ] } ], "source": [ "## 단계 2: 고유 토큰(단어) 찾기\n", "from collections import Counter\n", "\n", "try:\n", " tokenizer = tfds.features.text.Tokenizer()\n", "except AttributeError:\n", " tokenizer = tfds.deprecated.text.Tokenizer()\n", "\n", "token_counts = Counter()\n", "\n", "for example in ds_raw_train:\n", " tokens = tokenizer.tokenize(example[0].numpy()[0])\n", " token_counts.update(tokens)\n", "\n", "print('어휘 사전 크기:', len(token_counts))" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T14:53:04.657429Z", "iopub.status.busy": "2020-12-31T14:53:04.637210Z", "iopub.status.idle": "2020-12-31T14:53:04.747652Z", "shell.execute_reply": "2020-12-31T14:53:04.746754Z" }, "id": "yzd68Ikut3hZ", "outputId": "5971fe2f-422a-498a-cffe-5e57ed7592ff" }, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "[232, 9, 270, 1123]" ] }, "metadata": {}, "execution_count": 20 } ], "source": [ "## 단계 3: 고유 토큰을 정수로 인코딩하기\n", "try:\n", " encoder = tfds.features.text.TokenTextEncoder(token_counts)\n", "except AttributeError:\n", " encoder = tfds.deprecated.text.TokenTextEncoder(token_counts)\n", "\n", "example_str = 'This is an example!'\n", "encoder.encode(example_str)" ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "execution": { "iopub.execute_input": "2020-12-31T14:53:04.753242Z", "iopub.status.busy": "2020-12-31T14:53:04.752412Z", "iopub.status.idle": "2020-12-31T14:53:04.755655Z", "shell.execute_reply": "2020-12-31T14:53:04.754832Z" }, "id": "o2_YKm8bt3ha" }, "outputs": [], "source": [ "## 단계 3-A: 변환 함수 정의하기\n", "def encode(text_tensor, label):\n", " text = text_tensor.numpy()[0]\n", " encoded_text = encoder.encode(text)\n", " return encoded_text, label\n", "\n", "## 단계 3-B: 인코딩 함수를 텐서플로 연산으로 감싸기\n", "def encode_map_fn(text, label):\n", " return tf.py_function(encode, inp=[text, label],\n", " Tout=(tf.int64, tf.int64))" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T14:53:04.766645Z", "iopub.status.busy": "2020-12-31T14:53:04.766238Z", "iopub.status.idle": "2020-12-31T14:53:05.315769Z", "shell.execute_reply": "2020-12-31T14:53:05.316485Z" }, "id": "frJTGpBxt3ha", "outputId": "e2263c3c-1b49-4d14-84d9-8504be743b7b" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "시퀀스 길이: (24,)\n", "시퀀스 길이: (179,)\n", "시퀀스 길이: (262,)\n", "시퀀스 길이: (535,)\n", "시퀀스 길이: (130,)\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "(,\n", " )" ] }, "metadata": {}, "execution_count": 22 } ], "source": [ "ds_train = ds_raw_train.map(encode_map_fn)\n", "ds_valid = ds_raw_valid.map(encode_map_fn)\n", "ds_test = ds_raw_test.map(encode_map_fn)\n", "\n", "tf.random.set_seed(1)\n", "for example in ds_train.shuffle(1000).take(5):\n", " print('시퀀스 길이:', example[0].shape)\n", "\n", "example" ] }, { "cell_type": "markdown", "metadata": { "id": "JoiIum3jt3ha" }, "source": [ " * **batch() 대 padded_batch()**" ] }, { "cell_type": "markdown", "metadata": { "id": "YdUNeW8rt3ha" }, "source": [ "```python\n", "\n", "# 에러 발생\n", "BATCH_SIZE = 32\n", "train_data = all_encoded_data.batch(BATCH_SIZE)\n", "\n", "next(iter(train_data))\n", "\n", "# 이 코드는 에러를 발생시킵니다\n", "# 이 데이터셋에는 .batch()를 적용할 수 없습니다\n", "```" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T14:53:05.323061Z", "iopub.status.busy": "2020-12-31T14:53:05.322063Z", "iopub.status.idle": "2020-12-31T14:53:05.568975Z", "shell.execute_reply": "2020-12-31T14:53:05.568087Z" }, "id": "tXrml4TEt3ha", "outputId": "eb620d07-148e-4aa7-a453-57c3d188465d" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "개별 샘플 크기: (119,)\n", "개별 샘플 크기: (688,)\n", "개별 샘플 크기: (308,)\n", "개별 샘플 크기: (204,)\n", "개별 샘플 크기: (326,)\n", "개별 샘플 크기: (240,)\n", "개별 샘플 크기: (127,)\n", "개별 샘플 크기: (453,)\n", "배치 차원: (4, 688)\n", "배치 차원: (4, 453)\n" ] } ], "source": [ "## 일부 데이터 추출하기\n", "ds_subset = ds_train.take(8)\n", "for example in ds_subset:\n", " print('개별 샘플 크기:', example[0].shape)\n", "\n", "## 배치 데이터 만들기\n", "ds_batched = ds_subset.padded_batch(\n", " 4, padded_shapes=([-1], []))\n", "\n", "for batch in ds_batched:\n", " print('배치 차원:', batch[0].shape)" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "execution": { "iopub.execute_input": "2020-12-31T14:53:05.575398Z", "iopub.status.busy": "2020-12-31T14:53:05.574415Z", "iopub.status.idle": "2020-12-31T14:53:05.579834Z", "shell.execute_reply": "2020-12-31T14:53:05.579134Z" }, "id": "a2A9ol3Jt3hb" }, "outputs": [], "source": [ "## 배치 데이터 만들기\n", "train_data = ds_train.padded_batch(\n", " 32, padded_shapes=([-1],[]))\n", "\n", "valid_data = ds_valid.padded_batch(\n", " 32, padded_shapes=([-1],[]))\n", "\n", "test_data = ds_test.padded_batch(\n", " 32, padded_shapes=([-1],[]))" ] }, { "cell_type": "markdown", "metadata": { "id": "qUybBb3zt3hb" }, "source": [ "### 문장 인코딩을 위한 임베딩 층\n", "\n", " * `input_dim`: 단어 개수, 즉 최대 정수 인덱스 + 1.\n", " * `output_dim`:\n", " * `input_length`: (패딩된) 시퀀스 길이\n", " * 예를 들어, `'This is an example' -> [0, 0, 0, 0, 0, 0, 3, 1, 8, 9]` \n", " => input_lenght는 10\n", "\n", " * 이 층을 호출할 때 입력으로 정수값을 받습니다. 임베딩 층이 정수를 `[output_dim]` 크기의 실수 벡터로 변환합니다\n", " * 입력 크기가 `[BATCH_SIZE]`이면 출력 크기는 `[BATCH_SIZE, output_dim]`가 됩니다\n", " * 입력 크기가 `[BATCH_SIZE, 10]`이면 출력 크기는 `[BATCH_SIZE, 10, output_dim]`가 됩니다" ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 579 }, "execution": { "iopub.execute_input": "2020-12-31T14:53:05.584719Z", "iopub.status.busy": "2020-12-31T14:53:05.584041Z", "iopub.status.idle": "2020-12-31T14:53:05.593015Z", "shell.execute_reply": "2020-12-31T14:53:05.592348Z" }, "id": "8i2mrfBWt3hb", "outputId": "8d546e94-e451-48ea-846a-bf626baa3875" }, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "execution_count": 25 } ], "source": [ "Image(url='https://git.io/JLdV0', width=700)" ] }, { "cell_type": "code", "execution_count": 26, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T14:53:05.601333Z", "iopub.status.busy": "2020-12-31T14:53:05.600692Z", "iopub.status.idle": "2020-12-31T14:53:05.618008Z", "shell.execute_reply": "2020-12-31T14:53:05.617346Z" }, "id": "esPfmEMMt3hb", "outputId": "efbd4692-b5cd-4528-ea7f-fcd8ce0c9e4a" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Model: \"sequential\"\n", "_________________________________________________________________\n", " Layer (type) Output Shape Param # \n", "=================================================================\n", " embed-layer (Embedding) (None, 20, 6) 600 \n", " \n", "=================================================================\n", "Total params: 600 (2.34 KB)\n", "Trainable params: 600 (2.34 KB)\n", "Non-trainable params: 0 (0.00 Byte)\n", "_________________________________________________________________\n" ] } ], "source": [ "from tensorflow.keras.layers import Embedding\n", "\n", "\n", "model = tf.keras.Sequential()\n", "\n", "model.add(Embedding(input_dim=100,\n", " output_dim=6,\n", " input_length=20,\n", " name='embed-layer'))\n", "\n", "model.summary()" ] }, { "cell_type": "markdown", "metadata": { "id": "rqwKaKkqt3hb" }, "source": [ "### RNN 모델 만들기\n", "\n", "* **케라스 RNN 층:**\n", " * `tf.keras.layers.SimpleRNN(units, return_sequences=False)`\n", " * `tf.keras.layers.LSTM(..)`\n", " * `tf.keras.layers.GRU(..)`\n", " * `tf.keras.layers.Bidirectional()`\n", "\n", "* **`return_sequenes=?` 결정하기**\n", " * 다층 RNN이면 마지막 층을 제외하고 모든 RNN 층을 `return_sequenes=True`로 지정합니다\n", " * 마지막 RNN 층은 문제의 종류에 따라 결정됩니다:\n", " * 다대다: -> `return_sequences=True`\n", " * 다대일: -> `return_sequenes=False`" ] }, { "cell_type": "code", "execution_count": 27, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T14:53:05.626167Z", "iopub.status.busy": "2020-12-31T14:53:05.625414Z", "iopub.status.idle": "2020-12-31T14:53:05.706279Z", "shell.execute_reply": "2020-12-31T14:53:05.707065Z" }, "id": "oy4iAXCHt3hc", "outputId": "efc37584-a02c-47e0-9a63-1b42574dcff9" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Model: \"sequential_1\"\n", "_________________________________________________________________\n", " Layer (type) Output Shape Param # \n", "=================================================================\n", " embedding (Embedding) (None, None, 32) 32000 \n", " \n", " simple_rnn_1 (SimpleRNN) (None, None, 32) 2080 \n", " \n", " simple_rnn_2 (SimpleRNN) (None, 32) 2080 \n", " \n", " dense (Dense) (None, 1) 33 \n", " \n", "=================================================================\n", "Total params: 36193 (141.38 KB)\n", "Trainable params: 36193 (141.38 KB)\n", "Non-trainable params: 0 (0.00 Byte)\n", "_________________________________________________________________\n" ] } ], "source": [ "## SimpleRNN 층으로 RNN 모델 만들기\n", "from tensorflow.keras import Sequential\n", "from tensorflow.keras.layers import Embedding\n", "from tensorflow.keras.layers import SimpleRNN\n", "from tensorflow.keras.layers import Dense\n", "\n", "model = Sequential()\n", "model.add(Embedding(1000, 32))\n", "model.add(SimpleRNN(32, return_sequences=True))\n", "model.add(SimpleRNN(32))\n", "model.add(Dense(1))\n", "model.summary()" ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T14:53:05.715529Z", "iopub.status.busy": "2020-12-31T14:53:05.714882Z", "iopub.status.idle": "2020-12-31T14:53:06.010097Z", "shell.execute_reply": "2020-12-31T14:53:06.009262Z" }, "id": "hP_dd6GUt3hc", "outputId": "7bfeac8b-4c0a-4f08-c9c9-319a473c544b" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Model: \"sequential_2\"\n", "_________________________________________________________________\n", " Layer (type) Output Shape Param # \n", "=================================================================\n", " embedding_1 (Embedding) (None, None, 32) 320000 \n", " \n", " lstm (LSTM) (None, None, 32) 8320 \n", " \n", " lstm_1 (LSTM) (None, 32) 8320 \n", " \n", " dense_1 (Dense) (None, 1) 33 \n", " \n", "=================================================================\n", "Total params: 336673 (1.28 MB)\n", "Trainable params: 336673 (1.28 MB)\n", "Non-trainable params: 0 (0.00 Byte)\n", "_________________________________________________________________\n" ] } ], "source": [ "## LSTM 층으로 RNN 모델 만들기\n", "from tensorflow.keras.layers import LSTM\n", "\n", "\n", "model = Sequential()\n", "model.add(Embedding(10000, 32))\n", "model.add(LSTM(32, return_sequences=True))\n", "model.add(LSTM(32))\n", "model.add(Dense(1))\n", "model.summary()" ] }, { "cell_type": "code", "execution_count": 29, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T14:53:06.020415Z", "iopub.status.busy": "2020-12-31T14:53:06.018360Z", "iopub.status.idle": "2020-12-31T14:53:06.272493Z", "shell.execute_reply": "2020-12-31T14:53:06.271598Z" }, "id": "6UQfBf4yt3hc", "outputId": "6b2f8565-d4cc-4482-8212-00ff65a2c487" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Model: \"sequential_3\"\n", "_________________________________________________________________\n", " Layer (type) Output Shape Param # \n", "=================================================================\n", " embedding_2 (Embedding) (None, None, 32) 320000 \n", " \n", " gru (GRU) (None, None, 32) 6336 \n", " \n", " gru_1 (GRU) (None, 32) 6336 \n", " \n", " dense_2 (Dense) (None, 1) 33 \n", " \n", "=================================================================\n", "Total params: 332705 (1.27 MB)\n", "Trainable params: 332705 (1.27 MB)\n", "Non-trainable params: 0 (0.00 Byte)\n", "_________________________________________________________________\n" ] } ], "source": [ "## GRU 층으로 RNN 모델 만들기\n", "from tensorflow.keras.layers import GRU\n", "\n", "model = Sequential()\n", "model.add(Embedding(10000, 32))\n", "model.add(GRU(32, return_sequences=True))\n", "model.add(GRU(32))\n", "model.add(Dense(1))\n", "model.summary()" ] }, { "cell_type": "markdown", "metadata": { "id": "TFSW6uDst3hc" }, "source": [ "### 감성 분석 작업을 위한 RNN 모델 만들기" ] }, { "cell_type": "code", "execution_count": 30, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T14:53:06.298278Z", "iopub.status.busy": "2020-12-31T14:53:06.297321Z", "iopub.status.idle": "2020-12-31T15:31:18.726835Z", "shell.execute_reply": "2020-12-31T15:31:18.727434Z" }, "id": "FszX7_Qft3hc", "outputId": "54c4c6cf-8923-4986-d7ca-45a67ab8c3fb" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Model: \"sequential_4\"\n", "_________________________________________________________________\n", " Layer (type) Output Shape Param # \n", "=================================================================\n", " embed-layer (Embedding) (None, None, 20) 1740180 \n", " \n", " bidir-lstm (Bidirectional) (None, 128) 43520 \n", " \n", " dense_3 (Dense) (None, 64) 8256 \n", " \n", " dense_4 (Dense) (None, 1) 65 \n", " \n", "=================================================================\n", "Total params: 1792021 (6.84 MB)\n", "Trainable params: 1792021 (6.84 MB)\n", "Non-trainable params: 0 (0.00 Byte)\n", "_________________________________________________________________\n", "Epoch 1/10\n", "625/625 [==============================] - 145s 220ms/step - loss: 0.6439 - accuracy: 0.5989 - val_loss: 0.6189 - val_accuracy: 0.6930\n", "Epoch 2/10\n", "625/625 [==============================] - 44s 71ms/step - loss: 0.4293 - accuracy: 0.8034 - val_loss: 0.4391 - val_accuracy: 0.8138\n", "Epoch 3/10\n", "625/625 [==============================] - 45s 72ms/step - loss: 0.2220 - accuracy: 0.9161 - val_loss: 0.4540 - val_accuracy: 0.8336\n", "Epoch 4/10\n", "625/625 [==============================] - 45s 71ms/step - loss: 0.1189 - accuracy: 0.9625 - val_loss: 0.5119 - val_accuracy: 0.8344\n", "Epoch 5/10\n", "625/625 [==============================] - 45s 71ms/step - loss: 0.0674 - accuracy: 0.9798 - val_loss: 0.5506 - val_accuracy: 0.8444\n", "Epoch 6/10\n", "625/625 [==============================] - 46s 74ms/step - loss: 0.0503 - accuracy: 0.9854 - val_loss: 0.6473 - val_accuracy: 0.8124\n", "Epoch 7/10\n", "625/625 [==============================] - 45s 72ms/step - loss: 0.0418 - accuracy: 0.9875 - val_loss: 0.7181 - val_accuracy: 0.8300\n", "Epoch 8/10\n", "625/625 [==============================] - 44s 70ms/step - loss: 0.0475 - accuracy: 0.9854 - val_loss: 0.8262 - val_accuracy: 0.7650\n", "Epoch 9/10\n", "625/625 [==============================] - 45s 72ms/step - loss: 0.0304 - accuracy: 0.9910 - val_loss: 0.7237 - val_accuracy: 0.8272\n", "Epoch 10/10\n", "625/625 [==============================] - 44s 70ms/step - loss: 0.0156 - accuracy: 0.9958 - val_loss: 0.8161 - val_accuracy: 0.8180\n", "782/782 [==============================] - 34s 44ms/step - loss: 0.7992 - accuracy: 0.8179\n", "테스트 정확도: 81.79%\n" ] } ], "source": [ "embedding_dim = 20\n", "vocab_size = len(token_counts) + 2\n", "\n", "tf.random.set_seed(1)\n", "\n", "## 모델 생성\n", "bi_lstm_model = tf.keras.Sequential([\n", " tf.keras.layers.Embedding(\n", " input_dim=vocab_size,\n", " output_dim=embedding_dim,\n", " name='embed-layer'),\n", "\n", " tf.keras.layers.Bidirectional(\n", " tf.keras.layers.LSTM(64, name='lstm-layer'),\n", " name='bidir-lstm'),\n", "\n", " tf.keras.layers.Dense(64, activation='relu'),\n", "\n", " tf.keras.layers.Dense(1, activation='sigmoid')\n", "])\n", "\n", "bi_lstm_model.summary()\n", "\n", "## 컴파일과 훈련:\n", "bi_lstm_model.compile(\n", " optimizer=tf.keras.optimizers.Adam(1e-3),\n", " loss=tf.keras.losses.BinaryCrossentropy(from_logits=False),\n", " metrics=['accuracy'])\n", "\n", "history = bi_lstm_model.fit(\n", " train_data,\n", " validation_data=valid_data,\n", " epochs=10)\n", "\n", "## 테스트 데이터에서 평가\n", "test_results= bi_lstm_model.evaluate(test_data)\n", "print('테스트 정확도: {:.2f}%'.format(test_results[1]*100))" ] }, { "cell_type": "code", "execution_count": 31, "metadata": { "execution": { "iopub.execute_input": "2020-12-31T15:31:18.733388Z", "iopub.status.busy": "2020-12-31T15:31:18.732717Z", "iopub.status.idle": "2020-12-31T15:31:19.095760Z", "shell.execute_reply": "2020-12-31T15:31:19.096539Z" }, "id": "yAYzzBm2t3hd", "outputId": "afb55e94-bfc6-46b3-9612-c2549788fdef", "colab": { "base_uri": "https://localhost:8080/" } }, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "/usr/local/lib/python3.10/dist-packages/keras/src/engine/training.py:3079: UserWarning: You are saving your model as an HDF5 file via `model.save()`. This file format is considered legacy. We recommend using instead the native Keras format, e.g. `model.save('my_model.keras')`.\n", " saving_api.save_model(\n" ] } ], "source": [ "if not os.path.exists('models'):\n", " os.mkdir('models')\n", "\n", "\n", "bi_lstm_model.save('models/Bidir-LSTM-full-length-seq.h5')" ] }, { "cell_type": "markdown", "metadata": { "id": "bOGhajp5t3hd" }, "source": [ " * **짧은 시퀀스에 SimpleRNN 적용하기**" ] }, { "cell_type": "code", "execution_count": 32, "metadata": { "execution": { "iopub.execute_input": "2020-12-31T15:31:19.114411Z", "iopub.status.busy": "2020-12-31T15:31:19.113501Z", "iopub.status.idle": "2020-12-31T15:31:19.116108Z", "shell.execute_reply": "2020-12-31T15:31:19.115368Z" }, "id": "TDbCSxpIt3hd" }, "outputs": [], "source": [ "def preprocess_datasets(\n", " ds_raw_train,\n", " ds_raw_valid,\n", " ds_raw_test,\n", " max_seq_length=None,\n", " batch_size=32):\n", "\n", " ## 단계 1: (데이터셋 만들기 이미 완료)\n", " ## 단계 2: 고유 토큰 찾기\n", " try:\n", " tokenizer = tfds.features.text.Tokenizer()\n", " except AttributeError:\n", " tokenizer = tfds.deprecated.text.Tokenizer()\n", "\n", " token_counts = Counter()\n", "\n", " for example in ds_raw_train:\n", " tokens = tokenizer.tokenize(example[0].numpy()[0])\n", " if max_seq_length is not None:\n", " tokens = tokens[-max_seq_length:]\n", " token_counts.update(tokens)\n", "\n", " print('어휘 사전 크기:', len(token_counts))\n", "\n", "\n", " ## 단계 3: 텍스트 인코딩하기\n", " try:\n", " encoder = tfds.features.text.TokenTextEncoder(token_counts)\n", " except AttributeError:\n", " encoder = tfds.deprecated.text.TokenTextEncoder(token_counts)\n", "\n", " def encode(text_tensor, label):\n", " text = text_tensor.numpy()[0]\n", " encoded_text = encoder.encode(text)\n", " if max_seq_length is not None:\n", " encoded_text = encoded_text[-max_seq_length:]\n", " return encoded_text, label\n", "\n", " def encode_map_fn(text, label):\n", " return tf.py_function(encode, inp=[text, label],\n", " Tout=(tf.int64, tf.int64))\n", "\n", " ds_train = ds_raw_train.map(encode_map_fn)\n", " ds_valid = ds_raw_valid.map(encode_map_fn)\n", " ds_test = ds_raw_test.map(encode_map_fn)\n", "\n", " ## 단계 4: 배치 데이터 만들기\n", " train_data = ds_train.padded_batch(\n", " batch_size, padded_shapes=([-1],[]))\n", "\n", " valid_data = ds_valid.padded_batch(\n", " batch_size, padded_shapes=([-1],[]))\n", "\n", " test_data = ds_test.padded_batch(\n", " batch_size, padded_shapes=([-1],[]))\n", "\n", " return (train_data, valid_data,\n", " test_data, len(token_counts))" ] }, { "cell_type": "code", "execution_count": 33, "metadata": { "execution": { "iopub.execute_input": "2020-12-31T15:31:19.128046Z", "iopub.status.busy": "2020-12-31T15:31:19.127068Z", "iopub.status.idle": "2020-12-31T15:31:19.129259Z", "shell.execute_reply": "2020-12-31T15:31:19.129831Z" }, "id": "JVuxsNTRt3hd" }, "outputs": [], "source": [ "def build_rnn_model(embedding_dim, vocab_size,\n", " recurrent_type='SimpleRNN',\n", " n_recurrent_units=64,\n", " n_recurrent_layers=1,\n", " bidirectional=True):\n", "\n", " tf.random.set_seed(1)\n", "\n", " # 모델 생성\n", " model = tf.keras.Sequential()\n", "\n", " model.add(\n", " Embedding(\n", " input_dim=vocab_size,\n", " output_dim=embedding_dim,\n", " name='embed-layer')\n", " )\n", "\n", " for i in range(n_recurrent_layers):\n", " return_sequences = (i < n_recurrent_layers-1)\n", "\n", " if recurrent_type == 'SimpleRNN':\n", " recurrent_layer = SimpleRNN(\n", " units=n_recurrent_units,\n", " return_sequences=return_sequences,\n", " name='simprnn-layer-{}'.format(i))\n", " elif recurrent_type == 'LSTM':\n", " recurrent_layer = LSTM(\n", " units=n_recurrent_units,\n", " return_sequences=return_sequences,\n", " name='lstm-layer-{}'.format(i))\n", " elif recurrent_type == 'GRU':\n", " recurrent_layer = GRU(\n", " units=n_recurrent_units,\n", " return_sequences=return_sequences,\n", " name='gru-layer-{}'.format(i))\n", "\n", " if bidirectional:\n", " recurrent_layer = Bidirectional(\n", " recurrent_layer, name='bidir-'+recurrent_layer.name)\n", "\n", " model.add(recurrent_layer)\n", "\n", " model.add(tf.keras.layers.Dense(64, activation='relu'))\n", " model.add(tf.keras.layers.Dense(1, activation='sigmoid'))\n", "\n", " return model" ] }, { "cell_type": "code", "execution_count": 34, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T15:31:19.135494Z", "iopub.status.busy": "2020-12-31T15:31:19.134630Z", "iopub.status.idle": "2020-12-31T15:31:23.127554Z", "shell.execute_reply": "2020-12-31T15:31:23.127922Z" }, "id": "WaDu41Pht3hd", "outputId": "a17a23a2-71f2-4e3f-b69a-1104061d7d01" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "어휘 사전 크기: 58063\n", "Model: \"sequential_5\"\n", "_________________________________________________________________\n", " Layer (type) Output Shape Param # \n", "=================================================================\n", " embed-layer (Embedding) (None, None, 20) 1161300 \n", " \n", " bidir-simprnn-layer-0 (Bid (None, 128) 10880 \n", " irectional) \n", " \n", " dense_5 (Dense) (None, 64) 8256 \n", " \n", " dense_6 (Dense) (None, 1) 65 \n", " \n", "=================================================================\n", "Total params: 1180501 (4.50 MB)\n", "Trainable params: 1180501 (4.50 MB)\n", "Non-trainable params: 0 (0.00 Byte)\n", "_________________________________________________________________\n" ] } ], "source": [ "from tensorflow.keras.layers import Bidirectional\n", "\n", "\n", "batch_size = 32\n", "embedding_dim = 20\n", "max_seq_length = 100\n", "\n", "train_data, valid_data, test_data, n = preprocess_datasets(\n", " ds_raw_train, ds_raw_valid, ds_raw_test,\n", " max_seq_length=max_seq_length,\n", " batch_size=batch_size\n", ")\n", "\n", "\n", "vocab_size = n + 2\n", "\n", "rnn_model = build_rnn_model(\n", " embedding_dim, vocab_size,\n", " recurrent_type='SimpleRNN',\n", " n_recurrent_units=64,\n", " n_recurrent_layers=1,\n", " bidirectional=True)\n", "\n", "rnn_model.summary()" ] }, { "cell_type": "code", "execution_count": 35, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T15:31:23.140595Z", "iopub.status.busy": "2020-12-31T15:31:23.140192Z", "iopub.status.idle": "2020-12-31T15:37:30.416144Z", "shell.execute_reply": "2020-12-31T15:37:30.416906Z" }, "id": "Q43zdoSVt3hd", "outputId": "c258a2c7-4693-42e9-f40a-be48d8e241a3" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Epoch 1/10\n", "625/625 [==============================] - 179s 282ms/step - loss: 0.6877 - accuracy: 0.5437 - val_loss: 0.5733 - val_accuracy: 0.7176\n", "Epoch 2/10\n", "625/625 [==============================] - 138s 221ms/step - loss: 0.4811 - accuracy: 0.7659 - val_loss: 0.4919 - val_accuracy: 0.7892\n", "Epoch 3/10\n", "625/625 [==============================] - 138s 221ms/step - loss: 0.2658 - accuracy: 0.8935 - val_loss: 0.6333 - val_accuracy: 0.6632\n", "Epoch 4/10\n", "625/625 [==============================] - 138s 221ms/step - loss: 0.1993 - accuracy: 0.9232 - val_loss: 0.5770 - val_accuracy: 0.8108\n", "Epoch 5/10\n", "625/625 [==============================] - 137s 219ms/step - loss: 0.1453 - accuracy: 0.9499 - val_loss: 0.6287 - val_accuracy: 0.7758\n", "Epoch 6/10\n", "625/625 [==============================] - 138s 221ms/step - loss: 0.0857 - accuracy: 0.9726 - val_loss: 0.7515 - val_accuracy: 0.7644\n", "Epoch 7/10\n", "625/625 [==============================] - 138s 220ms/step - loss: 0.0500 - accuracy: 0.9849 - val_loss: 0.9449 - val_accuracy: 0.6744\n", "Epoch 8/10\n", "625/625 [==============================] - 142s 227ms/step - loss: 0.1503 - accuracy: 0.9416 - val_loss: 1.0362 - val_accuracy: 0.6554\n", "Epoch 9/10\n", "625/625 [==============================] - 138s 220ms/step - loss: 0.1151 - accuracy: 0.9556 - val_loss: 0.8802 - val_accuracy: 0.7124\n", "Epoch 10/10\n", "625/625 [==============================] - 139s 222ms/step - loss: 0.0735 - accuracy: 0.9754 - val_loss: 0.7908 - val_accuracy: 0.7338\n" ] } ], "source": [ "rnn_model.compile(optimizer=tf.keras.optimizers.Adam(1e-3),\n", " loss=tf.keras.losses.BinaryCrossentropy(from_logits=False),\n", " metrics=['accuracy'])\n", "\n", "\n", "history = rnn_model.fit(\n", " train_data,\n", " validation_data=valid_data,\n", " epochs=10)" ] }, { "cell_type": "code", "execution_count": 36, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T15:37:30.422212Z", "iopub.status.busy": "2020-12-31T15:37:30.421332Z", "iopub.status.idle": "2020-12-31T15:37:51.102354Z", "shell.execute_reply": "2020-12-31T15:37:51.102953Z" }, "id": "WaiatV_It3he", "outputId": "6c705491-256d-4505-bcd0-066be6041a1f" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "782/782 [==============================] - 33s 42ms/step - loss: 0.7589 - accuracy: 0.7413\n" ] } ], "source": [ "results = rnn_model.evaluate(test_data)" ] }, { "cell_type": "code", "execution_count": 37, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T15:37:51.108896Z", "iopub.status.busy": "2020-12-31T15:37:51.108181Z", "iopub.status.idle": "2020-12-31T15:37:51.112037Z", "shell.execute_reply": "2020-12-31T15:37:51.111337Z" }, "id": "x6QyEwQSt3he", "outputId": "539fbf50-b1eb-483a-c79a-2a0d9004b2d7" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "테스트 정확도: 74.13%\n" ] } ], "source": [ "print('테스트 정확도: {:.2f}%'.format(results[1]*100))" ] }, { "cell_type": "markdown", "metadata": { "id": "KjPp6Koit3he" }, "source": [ "## 연습문제:\n", "\n", "### 전체 길이를 사용한 시퀀스에 단방향 SimpleRNN 적용하기" ] }, { "cell_type": "code", "execution_count": 38, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T15:37:51.118653Z", "iopub.status.busy": "2020-12-31T15:37:51.118013Z", "iopub.status.idle": "2020-12-31T15:37:55.390222Z", "shell.execute_reply": "2020-12-31T15:37:55.389585Z" }, "id": "VDMMjV1xt3he", "outputId": "230055c9-fe09-437d-e816-467812a56d66" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "어휘 사전 크기: 87007\n", "Model: \"sequential_6\"\n", "_________________________________________________________________\n", " Layer (type) Output Shape Param # \n", "=================================================================\n", " embed-layer (Embedding) (None, None, 20) 1740180 \n", " \n", " simprnn-layer-0 (SimpleRNN (None, 64) 5440 \n", " ) \n", " \n", " dense_7 (Dense) (None, 64) 4160 \n", " \n", " dense_8 (Dense) (None, 1) 65 \n", " \n", "=================================================================\n", "Total params: 1749845 (6.68 MB)\n", "Trainable params: 1749845 (6.68 MB)\n", "Non-trainable params: 0 (0.00 Byte)\n", "_________________________________________________________________\n" ] } ], "source": [ "batch_size = 32\n", "embedding_dim = 20\n", "max_seq_length = None\n", "\n", "train_data, valid_data, test_data, n = preprocess_datasets(\n", " ds_raw_train, ds_raw_valid, ds_raw_test,\n", " max_seq_length=max_seq_length,\n", " batch_size=batch_size\n", ")\n", "\n", "\n", "vocab_size = n + 2\n", "\n", "rnn_model = build_rnn_model(\n", " embedding_dim, vocab_size,\n", " recurrent_type='SimpleRNN',\n", " n_recurrent_units=64,\n", " n_recurrent_layers=1,\n", " bidirectional=False)\n", "\n", "rnn_model.summary()" ] }, { "cell_type": "code", "execution_count": 39, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T15:37:55.402376Z", "iopub.status.busy": "2020-12-31T15:37:55.401627Z", "iopub.status.idle": "2020-12-31T15:59:01.339172Z", "shell.execute_reply": "2020-12-31T15:59:01.338258Z" }, "id": "eR8OJjstt3he", "outputId": "c29dcb50-7070-4396-a942-02210edef6a8" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Epoch 1/10\n", "625/625 [==============================] - 584s 932ms/step - loss: 0.7014 - accuracy: 0.5005 - val_loss: 0.6964 - val_accuracy: 0.4984\n", "Epoch 2/10\n", "625/625 [==============================] - 527s 843ms/step - loss: 0.6991 - accuracy: 0.4997 - val_loss: 0.6929 - val_accuracy: 0.5126\n", "Epoch 3/10\n", "625/625 [==============================] - 525s 841ms/step - loss: 0.6967 - accuracy: 0.4943 - val_loss: 0.6929 - val_accuracy: 0.5126\n", "Epoch 4/10\n", "625/625 [==============================] - 521s 833ms/step - loss: 0.6956 - accuracy: 0.4969 - val_loss: 0.6930 - val_accuracy: 0.5128\n", "Epoch 5/10\n", "625/625 [==============================] - 523s 837ms/step - loss: 0.6949 - accuracy: 0.4981 - val_loss: 0.6929 - val_accuracy: 0.5136\n", "Epoch 6/10\n", "625/625 [==============================] - 524s 839ms/step - loss: 0.6944 - accuracy: 0.5021 - val_loss: 0.6927 - val_accuracy: 0.5138\n", "Epoch 7/10\n", "625/625 [==============================] - 521s 834ms/step - loss: 0.6931 - accuracy: 0.5062 - val_loss: 0.6922 - val_accuracy: 0.5136\n", "Epoch 8/10\n", "625/625 [==============================] - 526s 841ms/step - loss: 0.6913 - accuracy: 0.5061 - val_loss: 0.6918 - val_accuracy: 0.5134\n", "Epoch 9/10\n", "625/625 [==============================] - 532s 851ms/step - loss: 0.6862 - accuracy: 0.5076 - val_loss: 0.6953 - val_accuracy: 0.5144\n", "Epoch 10/10\n", "625/625 [==============================] - 539s 862ms/step - loss: 0.6813 - accuracy: 0.5101 - val_loss: 0.7008 - val_accuracy: 0.5090\n" ] } ], "source": [ "rnn_model.compile(optimizer=tf.keras.optimizers.Adam(1e-3),\n", " loss=tf.keras.losses.BinaryCrossentropy(from_logits=False),\n", " metrics=['accuracy'])\n", "\n", "history = rnn_model.fit(\n", " train_data,\n", " validation_data=valid_data,\n", " epochs=10)" ] }, { "cell_type": "markdown", "metadata": { "id": "-P9l6HEHt3he" }, "source": [ "# 부록" ] }, { "cell_type": "markdown", "metadata": { "id": "bAw6wJ0jt3hf" }, "source": [ "### A -- 데이터셋을 만드는 다른 방법: tensorflow_datasets 사용하기" ] }, { "cell_type": "code", "execution_count": 40, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 849, "referenced_widgets": [ "2aa9fec7496843228cfac256f0fbeddd", "be5c8dfc4aa1495a8ffa620decdc5d90", "9969df7be01642ffb952ef9474bd9a45", "fb5d61bda65a4897946d4508fe79eab9", "9eec8615a4ff451da5ae153f1d5a7441", "7398bcb6d217483e953ba54376201877", "c6589c65419a415da73be47b9b14badb", "ab9c7276077249b995d0afba9112b007", "e5f8ecb76e9a4c19bc79b891e0389761", "08a9ad77fc964b14a93925b051138813", "56c790859b9f45ffb5a663b2cbca66ee", "a454303a6eda459988b23015272ed260", "05d73cc0282c4e168cf842d7c40665ec", "c6a77eec62b5474aa41e0ae6598de1ad", "b094b8d4493d495193e2977ff1de2f96", "930bc4bda4ae47e3b77126870347f19a", "a69fe679f8ac4d4fbcbda3ec9fae8637", "2067508dea5b4f8f91b981a7b99aeef0", "3540ac1153e14848b46ac0d779d1c7fe", "005710fda84a4483b1034e27d9635475", "5b54db05a91a408491dd97d0fe9a5b72", "767067fb267842de8c648da96240ff32", "6dbceadbef5c496f9bcdf4b4a83f1ae2", "2128b99f292a426f80e09b4ed9736a57", "cdebaa40f0c94a8f9be31533b6aff2ee", "ba36be5316294a10b13cc706f66fd687", "362c8e10dae74cd29bfdf411d030eb2d", "ba7a7895f94340feb2371715a3d461e1", "812e4caf96024c5687467825531c8e71", "6c3fa5a7569544adb0daae7f4fdf251b", "5335dca0c70942e0bfcf81503f03f770", "8a33443d06f94bb29e6d32bdf26fa9d1", "ca68fbe10e3e4bd795ec2578f9e84525", "12184356e65546fba10a52162f1d27e8", "7a6b6b42ea504aff92efc7508696ee89", "87c45d8635cb4941b98e22bc7904c56c", "a8599368a7794ffc8acc72e8b1f758ff", "8ff3466c18f844a68205892d57646338", "6d526c868c284afe8229a2321442efbf", "996bf432ae8c416c960c4f51a54d4f75", "7364e6056dea4d599bdffa9a1ed1c816", "e16880fcde604e519caf067f24839358", "ba89b17c899f473a8228fe00e88c66e2", "f3b66e45a7b14172a2df7a77453d9f15", "96b73cdc3f45492f95c369f03ab48344", "28f9117c1b9b41648e61dfb347eacb34", "712eea3152114e8ea86255fe8f48ad92", "b57dffa09ada4f089bf6f58f003b1be7", "7003b331c5ac4eaaa2ff901c19e98495", "b0fdab61269b40bbba7a95915aa6365d", "ad70156839094493ab5f5a3998a5a55f", "5b6fb4c92e7649dfb3bada6fd0e2ddf5", "c34c6f7889274f579f21ea3b2fcf3a14", "d44e41fd65654ba9b2b442ae19ad52a4", "6084cba64b4141678930379a89cb009d", "35b5de06c7184fdcb9c45cd1f67b672d", "e53434474cd44c1b99c0b21c777672ab", "aff3b7cb40a546409d1256924b112391", "5b7fbe2c4d1242e89f8f74429c3b5691", "6ab7e0257ed149c7abacdb0cf87f0f5c", "603bcb56f67b41f0886fd37b99cecfc7", "328e3de78e1e4a15bc734de422b0fb20", "7e0bdd75c68e493298cd29c18995d002", "1588f7200d4b490ca9d10481e26495d4", "6c38c9444cb74bf8b9bbfdb111e9340c", "cf289ebde115479887b4db9cf39e21de", "8b32a71bc2354dccb643ac9dc118d8fd", "4aa02b0c72fe4fce95ef5fe4f700a0f6", "f85b158f374c4a41be31dc239ab01636", "6e532345c1084df2ae286074875eae70", "bbe87ed5bc1644318e7b7e913d56b7f0", "84fb8a30c8a74f40aa0778b2bfd24f51", "336bfce9037546ee8ad6dcd002f2ea80", "7557426d80dc46bfb4bb0f42b9abbd54", "d3d5c35ad2da4f178830a05d266fd4bd", "da7027c0abed4ffb91e9f4c33026541e", "fdc178cc5752479cb4ccc250dce59cf0", "5b259e307826421e936aa9797d1734e2", "d75e165644b442a9833ff7df1e660fa0", "47f1ee8713434829a258488497830c76", "a764751b9dab498c903001b3b8cbfca1", "f7203917f9f0416ab4c5823a322c1ec7", "8f08189c3d8b4e7880a3920ed6112069", "39a04e2bbe684386ac6f70996bfb159d", "e89354fc164541c49be1143f8461aa93", "c5c875c724314844848cefd3dc1b22a4", "ed231bd9e07d4b3f86678f74c1d53449", "5715ac16177840fc8d9dcd6292a2e291", "acce8bd6116c456bb67a2c46935a1677", "adfc506cb94c409f9c9cbcfbefd633b4", "56dd294812194bc9beec1123b15987ee", "ccf1530dc92d40089eef8a21f1745912", "f95c5221e35046a7868154f366f86103", "80c0b3db7afd4275a066c4ca635ad709", "6ff3e49d7f7b4773aace4417d4e2ee42", "5f9b855a3e3b4ed590f9000d1120767b", "7413010291c54ad990d2337dd7fd44b5", "3101b05737c24dda963371c55f28fc03", "6df18f3939654703a48ef564fa92a42a" ] }, "execution": { "iopub.execute_input": "2020-12-31T15:59:01.345251Z", "iopub.status.busy": "2020-12-31T15:59:01.344304Z", "iopub.status.idle": "2020-12-31T16:00:03.995238Z", "shell.execute_reply": "2020-12-31T16:00:03.994443Z" }, "id": "Bm4eEIM7t3hf", "outputId": "6aea6b4a-14dd-492e-a95c-1c4343d43fe0" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "tfds.core.DatasetInfo(\n", " name='imdb_reviews',\n", " full_name='imdb_reviews/plain_text/1.0.0',\n", " description=\"\"\"\n", " Large Movie Review Dataset. This is a dataset for binary sentiment\n", " classification containing substantially more data than previous benchmark\n", " datasets. We provide a set of 25,000 highly polar movie reviews for training,\n", " and 25,000 for testing. There is additional unlabeled data for use as well.\n", " \"\"\",\n", " config_description=\"\"\"\n", " Plain text\n", " \"\"\",\n", " homepage='http://ai.stanford.edu/~amaas/data/sentiment/',\n", " data_dir=PosixGPath('/tmp/tmp0ldve2zatfds'),\n", " file_format=tfrecord,\n", " download_size=80.23 MiB,\n", " dataset_size=Unknown size,\n", " features=FeaturesDict({\n", " 'label': ClassLabel(shape=(), dtype=int64, num_classes=2),\n", " 'text': Text(shape=(), dtype=string),\n", " }),\n", " supervised_keys=('text', 'label'),\n", " disable_shuffling=False,\n", " splits={\n", " 'test': ,\n", " 'train': ,\n", " 'unsupervised': ,\n", " },\n", " citation=\"\"\"@InProceedings{maas-EtAl:2011:ACL-HLT2011,\n", " author = {Maas, Andrew L. and Daly, Raymond E. and Pham, Peter T. and Huang, Dan and Ng, Andrew Y. and Potts, Christopher},\n", " title = {Learning Word Vectors for Sentiment Analysis},\n", " booktitle = {Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies},\n", " month = {June},\n", " year = {2011},\n", " address = {Portland, Oregon, USA},\n", " publisher = {Association for Computational Linguistics},\n", " pages = {142--150},\n", " url = {http://www.aclweb.org/anthology/P11-1015}\n", " }\"\"\",\n", ")\n", "Downloading and preparing dataset 80.23 MiB (download: 80.23 MiB, generated: Unknown size, total: 80.23 MiB) to /root/tensorflow_datasets/imdb_reviews/plain_text/1.0.0...\n" ] }, { "output_type": "display_data", "data": { "text/plain": [ "Dl Completed...: 0 url [00:00, ? url/s]" ], "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "2aa9fec7496843228cfac256f0fbeddd" } }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "Dl Size...: 0 MiB [00:00, ? MiB/s]" ], "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "a454303a6eda459988b23015272ed260" } }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "Generating splits...: 0%| | 0/3 [00:00\n", "[1, 4, 2, 3]\n", "[1, 4, 2, 3, 5, 5, 5, 5, 5, 5]\n" ] } ], "source": [ "vocab_set = {'a', 'b', 'c', 'd'}\n", "encoder = tfds.deprecated.text.TokenTextEncoder(vocab_set)\n", "print(encoder)\n", "\n", "print(encoder.encode(b'a b c d, , : .'))\n", "\n", "print(encoder.encode(b'a b c d e f g h i z'))" ] }, { "cell_type": "markdown", "metadata": { "id": "NY6z1aTit3hg" }, "source": [ "### C -- 케라스로 텍스트 전처리하기" ] }, { "cell_type": "code", "execution_count": 43, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T16:00:04.023781Z", "iopub.status.busy": "2020-12-31T16:00:04.022913Z", "iopub.status.idle": "2020-12-31T16:00:04.028002Z", "shell.execute_reply": "2020-12-31T16:00:04.027228Z" }, "id": "LRO2xhDKt3hg", "outputId": "ef032f92-85a3-4167-d04f-c8436a0fb115" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "[[1, 2, 3, 4], [5, 6, 7, 8]]\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "array([[0, 0, 0, 0, 0, 0, 1, 2, 3, 4],\n", " [0, 0, 0, 0, 0, 0, 5, 6, 7, 8]], dtype=int32)" ] }, "metadata": {}, "execution_count": 43 } ], "source": [ "TOP_K = 200\n", "MAX_LEN = 10\n", "\n", "tokenizer = tf.keras.preprocessing.text.Tokenizer(num_words=TOP_K)\n", "\n", "tokenizer.fit_on_texts(['this is an example', 'je suis en forme '])\n", "sequences = tokenizer.texts_to_sequences(['this is an example', 'je suis en forme '])\n", "print(sequences)\n", "\n", "tf.keras.preprocessing.sequence.pad_sequences(sequences, maxlen=MAX_LEN)" ] }, { "cell_type": "code", "execution_count": 44, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T16:00:04.036271Z", "iopub.status.busy": "2020-12-31T16:00:04.035409Z", "iopub.status.idle": "2020-12-31T16:00:15.234946Z", "shell.execute_reply": "2020-12-31T16:00:15.234078Z" }, "id": "vePZ3UTot3hg", "outputId": "5ba96d38-f6ce-4269-dc03-06a634ec91ee", "scrolled": true }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "25000\n", "(25000, 500)\n" ] } ], "source": [ "TOP_K = 20000\n", "MAX_LEN = 500\n", "\n", "tokenizer = tf.keras.preprocessing.text.Tokenizer(num_words=TOP_K)\n", "\n", "tokenizer.fit_on_texts(\n", " [example['text'].numpy().decode('utf-8')\n", " for example in imdb_train])\n", "\n", "x_train = tokenizer.texts_to_sequences(\n", " [example['text'].numpy().decode('utf-8')\n", " for example in imdb_train])\n", "\n", "print(len(x_train))\n", "\n", "\n", "x_train_padded = tf.keras.preprocessing.sequence.pad_sequences(\n", " x_train, maxlen=MAX_LEN)\n", "\n", "print(x_train_padded.shape)" ] }, { "cell_type": "markdown", "metadata": { "id": "9FYRIc-St3hg" }, "source": [ "### D -- 임베딩" ] }, { "cell_type": "code", "execution_count": 45, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "execution": { "iopub.execute_input": "2020-12-31T16:00:15.250708Z", "iopub.status.busy": "2020-12-31T16:00:15.249808Z", "iopub.status.idle": "2020-12-31T16:00:15.258749Z", "shell.execute_reply": "2020-12-31T16:00:15.257884Z" }, "id": "fEuT0TEut3hh", "outputId": "cfa597fb-cdac-49d3-8394-cd4857df7b39" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "[[0.0285978206 -0.0122499242 -0.0394328944 -0.0145259611]\n", " [-0.016297698 0.0204829238 0.0123164877 0.0303565152]\n", " [-0.0233924985 -0.0107878074 -0.00653867796 0.0383420847]\n", " [0.0457952954 -0.0139975436 0.000184893608 0.0398626]\n", " [-0.00592473894 0.0485283621 0.0443233289 -0.005304683]\n", " [-0.0153851733 0.0370714702 -0.0447837822 0.0241911896]]\n", "TensorShape([6, 4])\n", "[[0.0285978206 -0.0122499242 -0.0394328944 -0.0145259611]]\n" ] } ], "source": [ "from tensorflow.keras.layers import Embedding\n", "\n", "\n", "tf.random.set_seed(1)\n", "embed = Embedding(input_dim=100, output_dim=4)\n", "\n", "inp_arr = np.array([1, 98, 5, 6, 67, 45])\n", "tf.print(embed(inp_arr))\n", "tf.print(embed(inp_arr).shape)\n", "\n", "tf.print(embed(np.array([1])))" ] } ], "metadata": { "accelerator": "GPU", "colab": { "name": "ch16_part1.ipynb", "provenance": [] }, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.3" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "2aa9fec7496843228cfac256f0fbeddd": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_be5c8dfc4aa1495a8ffa620decdc5d90", "IPY_MODEL_9969df7be01642ffb952ef9474bd9a45", "IPY_MODEL_fb5d61bda65a4897946d4508fe79eab9" ], "layout": "IPY_MODEL_9eec8615a4ff451da5ae153f1d5a7441" } }, "be5c8dfc4aa1495a8ffa620decdc5d90": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_7398bcb6d217483e953ba54376201877", "placeholder": "​", "style": "IPY_MODEL_c6589c65419a415da73be47b9b14badb", "value": "Dl Completed...: 100%" } }, "9969df7be01642ffb952ef9474bd9a45": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_ab9c7276077249b995d0afba9112b007", "max": 1, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_e5f8ecb76e9a4c19bc79b891e0389761", "value": 1 } }, "fb5d61bda65a4897946d4508fe79eab9": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_08a9ad77fc964b14a93925b051138813", "placeholder": "​", "style": "IPY_MODEL_56c790859b9f45ffb5a663b2cbca66ee", "value": " 1/1 [00:02<00:00, 2.81s/ url]" } }, "9eec8615a4ff451da5ae153f1d5a7441": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "7398bcb6d217483e953ba54376201877": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "c6589c65419a415da73be47b9b14badb": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "ab9c7276077249b995d0afba9112b007": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": "20px" } }, "e5f8ecb76e9a4c19bc79b891e0389761": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "08a9ad77fc964b14a93925b051138813": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "56c790859b9f45ffb5a663b2cbca66ee": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "a454303a6eda459988b23015272ed260": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_05d73cc0282c4e168cf842d7c40665ec", "IPY_MODEL_c6a77eec62b5474aa41e0ae6598de1ad", "IPY_MODEL_b094b8d4493d495193e2977ff1de2f96" ], "layout": "IPY_MODEL_930bc4bda4ae47e3b77126870347f19a" } }, "05d73cc0282c4e168cf842d7c40665ec": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_a69fe679f8ac4d4fbcbda3ec9fae8637", "placeholder": "​", "style": "IPY_MODEL_2067508dea5b4f8f91b981a7b99aeef0", "value": "Dl Size...: 100%" } }, "c6a77eec62b5474aa41e0ae6598de1ad": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_3540ac1153e14848b46ac0d779d1c7fe", "max": 1, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_005710fda84a4483b1034e27d9635475", "value": 1 } }, "b094b8d4493d495193e2977ff1de2f96": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_5b54db05a91a408491dd97d0fe9a5b72", "placeholder": "​", "style": "IPY_MODEL_767067fb267842de8c648da96240ff32", "value": " 80/80 [00:02<00:00, 44.67 MiB/s]" } }, "930bc4bda4ae47e3b77126870347f19a": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "a69fe679f8ac4d4fbcbda3ec9fae8637": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "2067508dea5b4f8f91b981a7b99aeef0": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "3540ac1153e14848b46ac0d779d1c7fe": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": "20px" } }, "005710fda84a4483b1034e27d9635475": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "5b54db05a91a408491dd97d0fe9a5b72": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "767067fb267842de8c648da96240ff32": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "6dbceadbef5c496f9bcdf4b4a83f1ae2": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_2128b99f292a426f80e09b4ed9736a57", "IPY_MODEL_cdebaa40f0c94a8f9be31533b6aff2ee", "IPY_MODEL_ba36be5316294a10b13cc706f66fd687" ], "layout": "IPY_MODEL_362c8e10dae74cd29bfdf411d030eb2d" } }, "2128b99f292a426f80e09b4ed9736a57": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_ba7a7895f94340feb2371715a3d461e1", "placeholder": "​", "style": "IPY_MODEL_812e4caf96024c5687467825531c8e71", "value": "Generating splits...: 100%" } }, "cdebaa40f0c94a8f9be31533b6aff2ee": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_6c3fa5a7569544adb0daae7f4fdf251b", "max": 3, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_5335dca0c70942e0bfcf81503f03f770", "value": 3 } }, "ba36be5316294a10b13cc706f66fd687": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_8a33443d06f94bb29e6d32bdf26fa9d1", "placeholder": "​", "style": "IPY_MODEL_ca68fbe10e3e4bd795ec2578f9e84525", "value": " 3/3 [00:38<00:00, 13.28s/ splits]" } }, "362c8e10dae74cd29bfdf411d030eb2d": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": "hidden", "width": null } }, "ba7a7895f94340feb2371715a3d461e1": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "812e4caf96024c5687467825531c8e71": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "6c3fa5a7569544adb0daae7f4fdf251b": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "5335dca0c70942e0bfcf81503f03f770": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "8a33443d06f94bb29e6d32bdf26fa9d1": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "ca68fbe10e3e4bd795ec2578f9e84525": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "12184356e65546fba10a52162f1d27e8": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_7a6b6b42ea504aff92efc7508696ee89", "IPY_MODEL_87c45d8635cb4941b98e22bc7904c56c", "IPY_MODEL_a8599368a7794ffc8acc72e8b1f758ff" ], "layout": "IPY_MODEL_8ff3466c18f844a68205892d57646338" } }, "7a6b6b42ea504aff92efc7508696ee89": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_6d526c868c284afe8229a2321442efbf", "placeholder": "​", "style": "IPY_MODEL_996bf432ae8c416c960c4f51a54d4f75", "value": "Generating train examples...: 85%" } }, "87c45d8635cb4941b98e22bc7904c56c": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_7364e6056dea4d599bdffa9a1ed1c816", "max": 25000, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_e16880fcde604e519caf067f24839358", "value": 25000 } }, "a8599368a7794ffc8acc72e8b1f758ff": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_ba89b17c899f473a8228fe00e88c66e2", "placeholder": "​", "style": "IPY_MODEL_f3b66e45a7b14172a2df7a77453d9f15", "value": " 21192/25000 [00:07<00:00, 3939.44 examples/s]" } }, "8ff3466c18f844a68205892d57646338": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": "hidden", "width": null } }, "6d526c868c284afe8229a2321442efbf": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "996bf432ae8c416c960c4f51a54d4f75": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "7364e6056dea4d599bdffa9a1ed1c816": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "e16880fcde604e519caf067f24839358": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "ba89b17c899f473a8228fe00e88c66e2": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "f3b66e45a7b14172a2df7a77453d9f15": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "96b73cdc3f45492f95c369f03ab48344": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_28f9117c1b9b41648e61dfb347eacb34", "IPY_MODEL_712eea3152114e8ea86255fe8f48ad92", "IPY_MODEL_b57dffa09ada4f089bf6f58f003b1be7" ], "layout": "IPY_MODEL_7003b331c5ac4eaaa2ff901c19e98495" } }, "28f9117c1b9b41648e61dfb347eacb34": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_b0fdab61269b40bbba7a95915aa6365d", "placeholder": "​", "style": "IPY_MODEL_ad70156839094493ab5f5a3998a5a55f", "value": "Shuffling /root/tensorflow_datasets/imdb_reviews/plain_text/1.0.0.incompleteCHCH46/imdb_reviews-train.tfrecord*...: 54%" } }, "712eea3152114e8ea86255fe8f48ad92": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_5b6fb4c92e7649dfb3bada6fd0e2ddf5", "max": 25000, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_c34c6f7889274f579f21ea3b2fcf3a14", "value": 25000 } }, "b57dffa09ada4f089bf6f58f003b1be7": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_d44e41fd65654ba9b2b442ae19ad52a4", "placeholder": "​", "style": "IPY_MODEL_6084cba64b4141678930379a89cb009d", "value": " 13554/25000 [00:00<00:00, 135525.59 examples/s]" } }, "7003b331c5ac4eaaa2ff901c19e98495": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": "hidden", "width": null } }, "b0fdab61269b40bbba7a95915aa6365d": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "ad70156839094493ab5f5a3998a5a55f": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "5b6fb4c92e7649dfb3bada6fd0e2ddf5": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "c34c6f7889274f579f21ea3b2fcf3a14": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "d44e41fd65654ba9b2b442ae19ad52a4": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "6084cba64b4141678930379a89cb009d": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "35b5de06c7184fdcb9c45cd1f67b672d": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_e53434474cd44c1b99c0b21c777672ab", "IPY_MODEL_aff3b7cb40a546409d1256924b112391", "IPY_MODEL_5b7fbe2c4d1242e89f8f74429c3b5691" ], "layout": "IPY_MODEL_6ab7e0257ed149c7abacdb0cf87f0f5c" } }, "e53434474cd44c1b99c0b21c777672ab": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_603bcb56f67b41f0886fd37b99cecfc7", "placeholder": "​", "style": "IPY_MODEL_328e3de78e1e4a15bc734de422b0fb20", "value": "Generating test examples...: 89%" } }, "aff3b7cb40a546409d1256924b112391": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_7e0bdd75c68e493298cd29c18995d002", "max": 25000, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_1588f7200d4b490ca9d10481e26495d4", "value": 25000 } }, "5b7fbe2c4d1242e89f8f74429c3b5691": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_6c38c9444cb74bf8b9bbfdb111e9340c", "placeholder": "​", "style": "IPY_MODEL_cf289ebde115479887b4db9cf39e21de", "value": " 22132/25000 [00:05<00:00, 4010.52 examples/s]" } }, "6ab7e0257ed149c7abacdb0cf87f0f5c": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": "hidden", "width": null } }, "603bcb56f67b41f0886fd37b99cecfc7": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "328e3de78e1e4a15bc734de422b0fb20": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "7e0bdd75c68e493298cd29c18995d002": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "1588f7200d4b490ca9d10481e26495d4": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "6c38c9444cb74bf8b9bbfdb111e9340c": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "cf289ebde115479887b4db9cf39e21de": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "8b32a71bc2354dccb643ac9dc118d8fd": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_4aa02b0c72fe4fce95ef5fe4f700a0f6", "IPY_MODEL_f85b158f374c4a41be31dc239ab01636", "IPY_MODEL_6e532345c1084df2ae286074875eae70" ], "layout": "IPY_MODEL_bbe87ed5bc1644318e7b7e913d56b7f0" } }, "4aa02b0c72fe4fce95ef5fe4f700a0f6": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_84fb8a30c8a74f40aa0778b2bfd24f51", "placeholder": "​", "style": "IPY_MODEL_336bfce9037546ee8ad6dcd002f2ea80", "value": "Shuffling /root/tensorflow_datasets/imdb_reviews/plain_text/1.0.0.incompleteCHCH46/imdb_reviews-test.tfrecord*...: 57%" } }, "f85b158f374c4a41be31dc239ab01636": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_7557426d80dc46bfb4bb0f42b9abbd54", "max": 25000, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_d3d5c35ad2da4f178830a05d266fd4bd", "value": 25000 } }, "6e532345c1084df2ae286074875eae70": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_da7027c0abed4ffb91e9f4c33026541e", "placeholder": "​", "style": "IPY_MODEL_fdc178cc5752479cb4ccc250dce59cf0", "value": " 14270/25000 [00:00<00:00, 142687.21 examples/s]" } }, "bbe87ed5bc1644318e7b7e913d56b7f0": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": "hidden", "width": null } }, "84fb8a30c8a74f40aa0778b2bfd24f51": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "336bfce9037546ee8ad6dcd002f2ea80": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "7557426d80dc46bfb4bb0f42b9abbd54": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "d3d5c35ad2da4f178830a05d266fd4bd": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "da7027c0abed4ffb91e9f4c33026541e": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "fdc178cc5752479cb4ccc250dce59cf0": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "5b259e307826421e936aa9797d1734e2": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_d75e165644b442a9833ff7df1e660fa0", "IPY_MODEL_47f1ee8713434829a258488497830c76", "IPY_MODEL_a764751b9dab498c903001b3b8cbfca1" ], "layout": "IPY_MODEL_f7203917f9f0416ab4c5823a322c1ec7" } }, "d75e165644b442a9833ff7df1e660fa0": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_8f08189c3d8b4e7880a3920ed6112069", "placeholder": "​", "style": "IPY_MODEL_39a04e2bbe684386ac6f70996bfb159d", "value": "Generating unsupervised examples...: 93%" } }, "47f1ee8713434829a258488497830c76": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_e89354fc164541c49be1143f8461aa93", "max": 50000, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_c5c875c724314844848cefd3dc1b22a4", "value": 50000 } }, "a764751b9dab498c903001b3b8cbfca1": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_ed231bd9e07d4b3f86678f74c1d53449", "placeholder": "​", "style": "IPY_MODEL_5715ac16177840fc8d9dcd6292a2e291", "value": " 46658/50000 [00:13<00:00, 4913.46 examples/s]" } }, "f7203917f9f0416ab4c5823a322c1ec7": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": "hidden", "width": null } }, "8f08189c3d8b4e7880a3920ed6112069": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "39a04e2bbe684386ac6f70996bfb159d": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "e89354fc164541c49be1143f8461aa93": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "c5c875c724314844848cefd3dc1b22a4": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "ed231bd9e07d4b3f86678f74c1d53449": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "5715ac16177840fc8d9dcd6292a2e291": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "acce8bd6116c456bb67a2c46935a1677": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_adfc506cb94c409f9c9cbcfbefd633b4", "IPY_MODEL_56dd294812194bc9beec1123b15987ee", "IPY_MODEL_ccf1530dc92d40089eef8a21f1745912" ], "layout": "IPY_MODEL_f95c5221e35046a7868154f366f86103" } }, "adfc506cb94c409f9c9cbcfbefd633b4": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_80c0b3db7afd4275a066c4ca635ad709", "placeholder": "​", "style": "IPY_MODEL_6ff3e49d7f7b4773aace4417d4e2ee42", "value": "Shuffling /root/tensorflow_datasets/imdb_reviews/plain_text/1.0.0.incompleteCHCH46/imdb_reviews-unsupervised.tfrecord*...: 65%" } }, "56dd294812194bc9beec1123b15987ee": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_5f9b855a3e3b4ed590f9000d1120767b", "max": 50000, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_7413010291c54ad990d2337dd7fd44b5", "value": 50000 } }, "ccf1530dc92d40089eef8a21f1745912": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_3101b05737c24dda963371c55f28fc03", "placeholder": "​", "style": "IPY_MODEL_6df18f3939654703a48ef564fa92a42a", "value": " 32741/50000 [00:00<00:00, 178803.52 examples/s]" } }, "f95c5221e35046a7868154f366f86103": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": "hidden", "width": null } }, "80c0b3db7afd4275a066c4ca635ad709": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "6ff3e49d7f7b4773aace4417d4e2ee42": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "5f9b855a3e3b4ed590f9000d1120767b": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "7413010291c54ad990d2337dd7fd44b5": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "3101b05737c24dda963371c55f28fc03": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "6df18f3939654703a48ef564fa92a42a": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } } } }, "gpuClass": "standard" }, "nbformat": 4, "nbformat_minor": 0 }