Update examples

This commit is contained in:
allegroai 2020-10-23 23:45:41 +03:00
parent 04b3fa809b
commit 912264bfa7
3 changed files with 213 additions and 207 deletions

View File

@ -7,11 +7,13 @@
"id": "wFJPLbY7w7Vj" "id": "wFJPLbY7w7Vj"
}, },
"source": [ "source": [
"# Allegro Trains Keras with Tensorboard example\n", "# Allegro Trains Keras with TensorBoard example\n",
"\n", "\n",
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/allegroai/trains/blob/master/examples/frameworks/keras/Allegro_Trains_keras_TB_example.ipynb)\n", "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/allegroai/trains/blob/master/examples/frameworks/keras/Allegro_Trains_keras_TB_example.ipynb)\n",
"\n", "\n",
"This tutorial introduce Trains with Keras and Tensorboard functionality. automatic logging model and Tensorboard outputs. You can find more frameworks examples [here](https://github.com/allegroai/trains/tree/master/examples/frameworks).\n" "This example introduces Trains with Keras and TensorBoard functionality, including automatic logging, models, and TensorBoard outputs. You can find more frameworks examples [here](https://github.com/allegroai/trains/tree/master/examples/frameworks).\n",
"\n",
"Note: This example is based on the Keras `mnist_mlp.py` example.\n"
] ]
}, },
{ {
@ -36,9 +38,9 @@
}, },
"source": [ "source": [
"### Create a new task.\n", "### Create a new task.\n",
"Task object should be provided `project_name` (the project name for the experiment) and `task_name` (the name of the experiment). A link to the newly generated task will be printed and the task will be updated real time in the Trains demo server.\n", "To create a new Task object, call the `Task.init` method providing it with `project_name` (the project name for the experiment) and `task_name` (the name of the experiment). When `Task.init` executes, a link to the Web UI Results page for the newly generated Task will be printed, and the Task will be updated in real time in the Trains demo server.\n",
"\n", "\n",
"You can read about task in the docs [here](https://allegro.ai/docs/task.html)" "You can read about the `Task` class in the docs [here](https://allegro.ai/docs/task.html)."
] ]
}, },
{ {
@ -64,16 +66,6 @@
"task = Task.init(project_name=\"Colab notebooks\", task_name=\"Keras with TensorBoard example\")\n" "task = Task.init(project_name=\"Colab notebooks\", task_name=\"Keras with TensorBoard example\")\n"
] ]
}, },
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "GPLPiHQ1ygTg"
},
"source": [
"*Based on https://github.com/keras-team/keras/blob/master/examples/mnist_mlp.py"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@ -231,7 +223,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.7.4" "version": "3.6.5"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -1,67 +1,59 @@
{ {
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Allegro Trains matplotlib example.ipynb",
"provenance": [],
"collapsed_sections": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [ "cells": [
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "NKas2cYws8F6", "colab_type": "text",
"colab_type": "text" "id": "NKas2cYws8F6"
}, },
"source": [ "source": [
"# Allegro Trains matplotlib example\n", "# Allegro Trains matplotlib example\n",
"\n", "\n",
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/allegroai/trains/blob/master/examples/frameworks/matplotlib/Allegro_Trains_matplotlib_example.ipynb)\n", "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/allegroai/trains/blob/master/examples/frameworks/matplotlib/Allegro_Trains_matplotlib_example.ipynb)\n",
"\n", "\n",
"This tutorial introduce Trains with matplotlib functionality. You can find more frameworks examples [here](https://github.com/allegroai/trains/tree/master/examples/frameworks)." "This example introduces Trains with matplotlib functionality. It also shows seaborn functionality. You can find more frameworks examples [here](https://github.com/allegroai/trains/tree/master/examples/frameworks).\n",
"\n",
"Note: This example is based on the Trains [matplotlib_example.py](https://github.com/allegroai/trains/blob/master/examples/frameworks/matplotlib/matplotlib_example.py) example."
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": { "metadata": {
"id": "72lCj7MJmRkQ", "colab": {},
"colab_type": "code", "colab_type": "code",
"colab": {} "id": "72lCj7MJmRkQ"
}, },
"outputs": [],
"source": [ "source": [
"!pip install trains\n", "!pip install trains\n",
"!pip install numpy\n", "!pip install numpy\n",
"!pip install seaborn" "!pip install seaborn"
], ]
"execution_count": null,
"outputs": []
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "b8jtq0iSt3-U", "colab_type": "text",
"colab_type": "text" "id": "b8jtq0iSt3-U"
}, },
"source": [ "source": [
"### Create a new task.\n", "## Create a new task.\n",
"Task object should be provided `project_name` (the project name for the experiment) and `task_name` (the name of the experiment). A link to the newly generated task will be printed and the task will be updated real time in the Trains demo server.\n",
"\n", "\n",
"You can read about task in the docs [here](https://allegro.ai/docs/task.html)" "To create a new Task object, call the `Task.init` method providing it with `project_name` (the project name for the experiment) and `task_name` (the name of the experiment). When `Task.init` executes, a link to the Web UI Results page for the newly generated Task will be printed, and the Task will be updated in real time in the Trains demo server.\n",
"\n",
"You can read about the `Task` class in the docs [here](https://allegro.ai/docs/task.html)."
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": { "metadata": {
"id": "ses67ulJkGPq", "colab": {},
"colab_type": "code", "colab_type": "code",
"colab": {} "id": "ses67ulJkGPq"
}, },
"outputs": [],
"source": [ "source": [
"import matplotlib.pyplot as plt\n", "import matplotlib.pyplot as plt\n",
"import numpy as np\n", "import numpy as np\n",
@ -71,39 +63,29 @@
"\n", "\n",
"# Start a new task\n", "# Start a new task\n",
"task = Task.init(project_name=\"Colab notebooks\", task_name=\"Matplotlib example\")\n" "task = Task.init(project_name=\"Colab notebooks\", task_name=\"Matplotlib example\")\n"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "whxX3Xjmy1PI",
"colab_type": "text"
},
"source": [
"This example was generated based on [trains matplotlib example](https://github.com/allegroai/trains/blob/master/examples/frameworks/matplotlib/matplotlib_example.py)"
] ]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "T2l-0WvJt_yo", "colab_type": "text",
"colab_type": "text" "id": "T2l-0WvJt_yo"
}, },
"source": [ "source": [
"### Matplotlib support\n", "## Matplotlib support\n",
"\n", "\n",
"Matplotlib plots are automatically logged. Data available in the task 'Results' section\n" "Trains automatically logs Matplotlib plots. They appear in the Web UI Results tab.\n"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": { "metadata": {
"id": "a-nOyg9xlxiR", "colab": {},
"colab_type": "code", "colab_type": "code",
"colab": {} "id": "a-nOyg9xlxiR"
}, },
"outputs": [],
"source": [ "source": [
"# create plot\n", "# create plot\n",
"N = 50\n", "N = 50\n",
@ -113,77 +95,77 @@
"area = (30 * np.random.rand(N))**2 # 0 to 15 point radii\n", "area = (30 * np.random.rand(N))**2 # 0 to 15 point radii\n",
"plt.scatter(x, y, s=area, c=colors, alpha=0.5)\n", "plt.scatter(x, y, s=area, c=colors, alpha=0.5)\n",
"plt.show()\n" "plt.show()\n"
], ]
"execution_count": null,
"outputs": []
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": { "metadata": {
"id": "iV4BtqRFmi0N", "colab": {},
"colab_type": "code", "colab_type": "code",
"colab": {} "id": "iV4BtqRFmi0N"
}, },
"outputs": [],
"source": [ "source": [
"# create another plot - with a name\n", "# create another plot - with a name\n",
"x = np.linspace(0, 10, 30)\n", "x = np.linspace(0, 10, 30)\n",
"y = np.sin(x)\n", "y = np.sin(x)\n",
"plt.plot(x, y, 'o', color='black')\n", "plt.plot(x, y, 'o', color='black')\n",
"plt.show()" "plt.show()"
], ]
"execution_count": null,
"outputs": []
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "yKT5UjDk6DGB", "colab_type": "text",
"colab_type": "text" "id": "yKT5UjDk6DGB"
}, },
"source": [ "source": [
"Notice imshow will cause the plot images to apear as Images in the debug sample section" "By calling the `imshow` method, Trains automatically reports plot images in Results tab."
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": { "metadata": {
"id": "IVzUScalmio-", "colab": {},
"colab_type": "code", "colab_type": "code",
"colab": {} "id": "IVzUScalmio-"
}, },
"outputs": [],
"source": [ "source": [
"# create unitlted image plot\n", "# create unitlted image plot\n",
"m = np.eye(256, 256, dtype=np.uint8)\n", "m = np.eye(256, 256, dtype=np.uint8)\n",
"plt.imshow(m)\n", "plt.imshow(m)\n",
"plt.show()" "plt.show()"
], ]
"execution_count": null,
"outputs": []
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": { "metadata": {
"id": "mioKlXpimib1", "colab": {},
"colab_type": "code", "colab_type": "code",
"colab": {} "id": "mioKlXpimib1"
}, },
"outputs": [],
"source": [ "source": [
"# create image plot - with a name\n", "# create image plot - with a name\n",
"m = np.eye(256, 256, dtype=np.uint8)\n", "m = np.eye(256, 256, dtype=np.uint8)\n",
"plt.imshow(m)\n", "plt.imshow(m)\n",
"plt.title('Image Title')\n", "plt.title('Image Title')\n",
"plt.show()" "plt.show()"
], ]
"execution_count": null,
"outputs": []
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": { "metadata": {
"id": "AE7Gbm3GfvvK", "colab": {},
"colab_type": "code", "colab_type": "code",
"colab": {} "id": "AE7Gbm3GfvvK"
}, },
"outputs": [],
"source": [ "source": [
"# create plot with savefig\n", "# create plot with savefig\n",
"N = 10\n", "N = 10\n",
@ -194,27 +176,27 @@
"plt.title('savefig Image')\n", "plt.title('savefig Image')\n",
"plt.scatter(x, y, s=area, c=colors, alpha=0.5)\n", "plt.scatter(x, y, s=area, c=colors, alpha=0.5)\n",
"plt.savefig(\"plot.png\")" "plt.savefig(\"plot.png\")"
], ]
"execution_count": null,
"outputs": []
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "jcRWq9Xc56fX", "colab_type": "text",
"colab_type": "text" "id": "jcRWq9Xc56fX"
}, },
"source": [ "source": [
"Seaborn example:" "## Seaborn support"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": { "metadata": {
"id": "j-usk2d_mqS4", "colab": {},
"colab_type": "code", "colab_type": "code",
"colab": {} "id": "j-usk2d_mqS4"
}, },
"outputs": [],
"source": [ "source": [
"sns.set(style=\"darkgrid\")\n", "sns.set(style=\"darkgrid\")\n",
"# Load an example dataset with long-form data\n", "# Load an example dataset with long-form data\n",
@ -224,9 +206,33 @@
" hue=\"region\", style=\"event\",\n", " hue=\"region\", style=\"event\",\n",
" data=fmri)\n", " data=fmri)\n",
"plt.show()" "plt.show()"
],
"execution_count": null,
"outputs": []
}
] ]
} }
],
"metadata": {
"colab": {
"collapsed_sections": [],
"name": "Allegro Trains matplotlib example.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.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 1
}

View File

@ -1,83 +1,61 @@
{ {
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"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.6.5"
},
"colab": {
"name": "Allegro Trains logging example.ipynb",
"provenance": [],
"collapsed_sections": []
}
},
"cells": [ "cells": [
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "RZiRah3QiR_G", "colab_type": "text",
"colab_type": "text" "id": "RZiRah3QiR_G"
}, },
"source": [ "source": [
"# Allegro Trains logging example\n", "# Allegro Trains logging example\n",
"\n", "\n",
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/allegroai/trains/blob/master/examples/reporting/Allegro_Trains_logging_example.ipynb)\n", "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/allegroai/trains/blob/master/examples/reporting/Allegro_Trains_logging_example.ipynb)\n",
"\n", "\n",
"This tutorial introduce [Trains](https://github.com/allegroai/trains) logger functionality. You can find more reporting examples [here](https://github.com/allegroai/trains/tree/master/examples/reporting)." "This example introduces Trains [Logger](https://allegro.ai/docs/logger.html) functionality. Logger is the Trains console log and metric interface.\n",
"\n",
"You can find more reporting examples [here](https://github.com/allegroai/trains/tree/master/examples/reporting)."
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": { "metadata": {
"id": "RbESVEV0jl3c", "colab": {},
"colab_type": "code", "colab_type": "code",
"colab": {} "id": "RbESVEV0jl3c"
}, },
"outputs": [],
"source": [ "source": [
"!pip install trains\n", "!pip install trains\n",
"!pip install numpy" "!pip install numpy"
], ]
"execution_count": null,
"outputs": []
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "8p9tkR5wue2x", "colab_type": "text",
"colab_type": "text" "id": "8p9tkR5wue2x"
}, },
"source": [ "source": [
"### Create a new task\n", "### Create a new Task\n",
"Create a new task and get the logger object for this task.\n", "Create a new Task and get a Logger object for the Task.\n",
"\n", "\n",
"Task object should be provided `project_name` (the project name for the experiment) and `task_name` (the name of the experiment).\n", "To create a new Task object, call the `Task.init` method providing it with `project_name` (the project name for the experiment) and `task_name` (the name of the experiment). When `Task.init` executes, a link to the Web UI Results page for the newly generated Task will be printed, and the Task will be updated in real time in the Trains demo server.\n",
"A link to the newly generated task will be printed and the task will be updated real time in the Trains demo server.\n",
"\n", "\n",
"Logger is the Trains console log and metric interface.\n", "You can read about the `Task` class in the docs [here](https://allegro.ai/docs/task.html).\n",
"You can read about the logger in the [docs](https://allegro.ai/docs/logger.html)\n" "\n",
"After the Task is created, get a Logger for it."
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": { "metadata": {
"id": "885DHN5SjsHy", "colab": {},
"colab_type": "code", "colab_type": "code",
"colab": {} "id": "885DHN5SjsHy"
}, },
"outputs": [],
"source": [ "source": [
"import numpy as np\n", "import numpy as np\n",
"\n", "\n",
@ -89,29 +67,28 @@
"# Get the task logger,\n", "# Get the task logger,\n",
"# You can also call Task.current_task().get_logger() from anywhere in your code.\n", "# You can also call Task.current_task().get_logger() from anywhere in your code.\n",
"logger = task.get_logger()" "logger = task.get_logger()"
], ]
"execution_count": null,
"outputs": []
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "SADmtLH8uwhw", "colab_type": "text",
"colab_type": "text" "id": "SADmtLH8uwhw"
}, },
"source": [ "source": [
"### Explicit scalar logging\n", "### Explicit scalar logging\n",
"Explicit scalar logging. Data available in the task 'Results' section.\n", "Use the [Logger.report_scalar](https://allegro.ai/docs/logger.html#trains.logger.Logger.report_scalar) method to explicitly log scalars. Scalar plots appear in the Web UI, Results > Scalars tab."
"For more [usage examples](https://allegro.ai/docs/logger.html#trains.logger.Logger.report_scalar)"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": { "metadata": {
"id": "E6YH4lNLjLs8", "colab": {},
"colab_type": "code", "colab_type": "code",
"colab": {} "id": "E6YH4lNLjLs8"
}, },
"outputs": [],
"source": [ "source": [
"# report two scalar series on the same graph\n", "# report two scalar series on the same graph\n",
"for i in range(10):\n", "for i in range(10):\n",
@ -122,30 +99,31 @@
"for i in range(10):\n", "for i in range(10):\n",
" logger.report_scalar(\"graph A\", \"series A\", iteration=i, value=1./(i+1))\n", " logger.report_scalar(\"graph A\", \"series A\", iteration=i, value=1./(i+1))\n",
" logger.report_scalar(\"graph B\", \"series B\", iteration=i, value=10./(i+1))" " logger.report_scalar(\"graph B\", \"series B\", iteration=i, value=10./(i+1))"
], ]
"execution_count": null,
"outputs": []
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "8iqvizEzwRtk", "colab_type": "text",
"colab_type": "text" "id": "8iqvizEzwRtk"
}, },
"source": [ "source": [
"### Explicit histogram logging\n", "### Explicit logging of other data\n",
"Explicit histogram logging. Data available in the task 'Results' section.\n", "\n",
"You can report histograms, matrix, 3D scatter diagrams and surface.\n", "You can log other data and report the data in a variety of plot types, including histograms, confusion matrices, 2D and 3D scatter diagrams, and surface diagrams. They appear in the Results > Plots tab.\n",
"For more examples check [here](https://allegro.ai/docs/logger.html#trains.logger.Logger.report_histogram)\n" "\n",
"For information about the methods to report each type of plot, see the [Logger](https://allegro.ai/docs/logger.html) module.\n"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": { "metadata": {
"id": "_rWW7HTYjLtK", "colab": {},
"colab_type": "code", "colab_type": "code",
"colab": {} "id": "_rWW7HTYjLtK"
}, },
"outputs": [],
"source": [ "source": [
"iteration = 100\n", "iteration = 100\n",
"\n", "\n",
@ -228,34 +206,40 @@
" yaxis=\"title y\",\n", " yaxis=\"title y\",\n",
" zaxis=\"title z\",\n", " zaxis=\"title z\",\n",
")" ")"
], ]
"execution_count": null,
"outputs": []
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "OZqPEaFRwcVY", "colab_type": "text",
"colab_type": "text" "id": "OZqPEaFRwcVY"
}, },
"source": [ "source": [
"### Explicit debug samples reporting\n", "### Explicit debug samples reporting\n",
"Explicit debug samples reporting. Data available in the task 'Results' section\n",
"\n", "\n",
"We are using StorageManager to download a local copy of the files. \n", "Explicitly report debug samples, including images, audio, and video."
"You can use the StorageManager immediately, you only need to provide the url. \n", ]
"Cache is enabled by default for all downloaded remote urls/files.\n", },
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Downloading the files\n",
"\n", "\n",
"For more information, you can read about the storage manager [here](https://allegro.ai/docs/storage.html#trains.storage.manager.StorageManager)\n" "We use StorageManager to download a local copy of the files. You can use it immediately. Just provide the URL. Cache is enabled by default for all downloaded remote URLs/files.\n",
"\n",
"For more information, you can read about the storage manager [here](https://allegro.ai/docs/storage_manager_storagemanager.html)."
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": { "metadata": {
"id": "s4rf0ap0jLtb", "colab": {},
"colab_type": "code", "colab_type": "code",
"colab": {} "id": "s4rf0ap0jLtb"
}, },
"outputs": [],
"source": [ "source": [
"from trains.storage import StorageManager\n", "from trains.storage import StorageManager\n",
"image_local_copy = StorageManager.get_local_copy(\n", "image_local_copy = StorageManager.get_local_copy(\n",
@ -278,28 +262,29 @@
")\n", ")\n",
"\n", "\n",
"print(\"Audio location: {}\".format(audio_local_copy))\n" "print(\"Audio location: {}\".format(audio_local_copy))\n"
], ]
"execution_count": null,
"outputs": []
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "vydmi7HWw0gS", "colab_type": "text",
"colab_type": "text" "id": "vydmi7HWw0gS"
}, },
"source": [ "source": [
"### Report images and media\n", "#### Report images and media\n",
"Reporting the downloaded samples. Data available in the task 'Results' section.\n" "\n",
"Use [Logger.report_image](https://allegro.ai/docs/logger.html?highlight=report_image#trains.logger.Logger.report_image) and [Logger.report_media](https://allegro.ai/docs/logger.html?highlight=report_media#trains.logger.Logger.report_media) to report the downloaded samples. The debug samples appear in the Results > Debug Samples tab."
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": { "metadata": {
"id": "MtEhbE4S_P66", "colab": {},
"colab_type": "code", "colab_type": "code",
"colab": {} "id": "MtEhbE4S_P66"
}, },
"outputs": [],
"source": [ "source": [
"logger.report_image(\"image\", \"image from url\", iteration=100, local_path=image_local_copy)\n", "logger.report_image(\"image\", \"image from url\", iteration=100, local_path=image_local_copy)\n",
"\n", "\n",
@ -321,62 +306,85 @@
"\n", "\n",
"# reporting html from url to debug samples section\n", "# reporting html from url to debug samples section\n",
"logger.report_media(\"html\", \"url_html\", iteration=1, url=\"https://allegro.ai/docs/index.html\")" "logger.report_media(\"html\", \"url_html\", iteration=1, url=\"https://allegro.ai/docs/index.html\")"
], ]
"execution_count": null,
"outputs": []
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "uDrcRCJxxCQP", "colab_type": "text",
"colab_type": "text" "id": "uDrcRCJxxCQP"
}, },
"source": [ "source": [
"### Explicit text logging\n", "### Explicit text logging\n",
"Explicit text logging. Data available in the task 'Results' section.\n", "Use [Logger.report_text](https://allegro.ai/docs/logger.html?highlight=report_text#trains.logger.Logger.report_text) to log text message. They appear in Results > Log."
"For more examples check [here](https://allegro.ai/docs/logger.html?highlight=report_text#trains.logger.Logger.report_text)\n"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": { "metadata": {
"id": "a2UlIETAjLtk", "colab": {},
"colab_type": "code", "colab_type": "code",
"colab": {} "id": "a2UlIETAjLtk"
}, },
"outputs": [],
"source": [ "source": [
"# report text\n", "# report text\n",
"logger.report_text(\"hello, this is plain text\")\n" "logger.report_text(\"hello, this is plain text\")\n"
], ]
"execution_count": null,
"outputs": []
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "aNFDbjZ7xNco", "colab_type": "text",
"colab_type": "text" "id": "aNFDbjZ7xNco"
}, },
"source": [ "source": [
"### Flushing the reports\n", "### Flushing the reports\n",
"If flush is not called, reports are flushed in the background every couple of seconds, \n",
"and at the end of the process execution.\n",
"\n", "\n",
"More information can be found [here](https://allegro.ai/docs/logger.html?highlight=report_text#trains.logger.Logger.flush)\n" "Reports are flushed in the background every couple of seconds, and at the end of the process execution.\n",
"\n",
"Or, flush the Logger by calling [Logger.flush](https://allegro.ai/docs/logger.html?highlight=report_text#trains.logger.Logger.flush)."
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": { "metadata": {
"id": "SSyGUskJjLtr", "colab": {},
"colab_type": "code", "colab_type": "code",
"colab": {} "id": "SSyGUskJjLtr"
}, },
"outputs": [],
"source": [ "source": [
"logger.flush()" "logger.flush()"
],
"execution_count": null,
"outputs": []
}
] ]
} }
],
"metadata": {
"colab": {
"collapsed_sections": [],
"name": "Allegro Trains logging example.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.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 1
}