{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Modify Display Utils" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Utilities for collecting/checking [`fastai`](/fastai.html#fastai) user environment" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from fastai.utils.mod_display import *" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [], "source": [ "from fastai.gen_doc.nbdoc import *\n", "from fastai.utils.collect_env import * " ] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [ { "data": { "text/markdown": [ "

class progress_disabled_ctx[source][test]

\n", "\n", "> progress_disabled_ctx(**`learn`**:[`Learner`](/basic_train.html#Learner))\n", "\n", "
×

Tests found for progress_disabled_ctx:

To run tests please refer to this guide.

\n", "\n", "Context manager to disable the progress update bar and Recorder print. " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "show_doc(progress_disabled_ctx)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [], "source": [ "from fastai.vision import *\n", "path = untar_data(URLs.MNIST_SAMPLE)\n", "data = ImageDataBunch.from_folder(path)\n", "learn = cnn_learner(data, models.resnet18, metrics=accuracy)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`learn.fit()` will display a progress bar and give the final results once completed:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/html": [ "Total time: 00:04

\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
epochtrain_lossvalid_lossaccuracytime
00.1463240.0824660.97154100:04
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "learn.fit(1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[`progress_disabled_ctx`](/utils.mod_display.html#progress_disabled_ctx) will remove all that update and only show the total time once completed." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Total time: 00:03\n" ] } ], "source": [ "with progress_disabled_ctx(learn) as learn:\n", " learn.fit(1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Undocumented Methods - Methods moved below this line will intentionally be hidden" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## New Methods - Please document or move to the undocumented section" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [ { "data": { "text/markdown": [ "

class progress_disabled_ctx[source][test]

\n", "\n", "> progress_disabled_ctx(**`learn`**:[`Learner`](/basic_train.html#Learner))\n", "\n", "
×

Tests found for progress_disabled_ctx:

  • pytest -sv tests/test_mod_display.py::test_progress_disabled_ctx [source]

To run tests please refer to this guide.

\n", "\n", "Context manager to disable the progress update bar and Recorder print. " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "show_doc(progress_disabled_ctx)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 2 }