diff --git a/tutorials/fastnlp_1_minute_tutorial.ipynb b/tutorials/fastnlp_1_minute_tutorial.ipynb index e584a405..24b569f6 100644 --- a/tutorials/fastnlp_1_minute_tutorial.ipynb +++ b/tutorials/fastnlp_1_minute_tutorial.ipynb @@ -19,16 +19,52 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 3, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/yh/miniconda2/envs/python3/lib/python3.6/site-packages/tqdm/autonotebook/__init__.py:14: TqdmExperimentalWarning: Using `tqdm.autonotebook.tqdm` in notebook mode. Use `tqdm.tqdm` instead to force console mode (e.g. in jupyter console)\n", + " \" (e.g. in jupyter console)\", TqdmExperimentalWarning)\n" + ] + } + ], "source": [ + "import sys\n", + "sys.path.append(\"../\")\n", + "\n", "from fastNLP import DataSet\n", + "\n", "# linux_path = \"../test/data_for_tests/tutorial_sample_dataset.csv\"\n", - "win_path = \"C:\\\\Users\\zyfeng\\Desktop\\FudanNLP\\\\fastNLP\\\\test\\\\data_for_tests\\\\tutorial_sample_dataset.csv\"\n", + "win_path = \"../test/data_for_tests/tutorial_sample_dataset.csv\"\n", "ds = DataSet.read_csv(win_path, headers=('raw_sentence', 'label'), sep='\\t')" ] }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'raw_sentence': this quiet , introspective and entertaining independent is worth seeking .,\n", + "'label': 4,\n", + "'label_seq': 4,\n", + "'words': ['this', 'quiet', ',', 'introspective', 'and', 'entertaining', 'independent', 'is', 'worth', 'seeking', '.']}" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ds[1]" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -42,7 +78,7 @@ }, { "cell_type": "code", - "execution_count": 52, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -58,65 +94,15 @@ }, { "cell_type": "code", - "execution_count": 60, - "metadata": { - "collapsed": false - }, + "execution_count": 5, + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Train size: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - " " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "54" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Test size: " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - " " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "23" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" + "Train size: 54\n", + "Test size: 23\n" ] } ], @@ -129,7 +115,7 @@ }, { "cell_type": "code", - "execution_count": 61, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -177,14 +163,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "training epochs started 2018-12-07 14:03:41" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" + "training epochs started 2018-12-07 14:03:41\n" ] }, { @@ -201,84 +180,10 @@ "name": "stdout", "output_type": "stream", "text": [ - "\r" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Epoch 1/3. Step:2/6. AccuracyMetric: acc=0.26087" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Epoch 2/3. Step:4/6. AccuracyMetric: acc=0.347826" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Epoch 3/3. Step:6/6. AccuracyMetric: acc=0.608696" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Train finished!" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" + "Epoch 1/3. Step:2/6. AccuracyMetric: acc=0.26087\n", + "Epoch 2/3. Step:4/6. AccuracyMetric: acc=0.347826\n", + "Epoch 3/3. Step:6/6. AccuracyMetric: acc=0.608696\n", + "Train finished!\n" ] } ], @@ -311,23 +216,23 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 2", + "display_name": "Python 3", "language": "python", - "name": "python2" + "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", - "version": 2 + "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.6" + "pygments_lexer": "ipython3", + "version": "3.6.7" } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 1 }