{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2\n", "\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from exp.nb_08 import *" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "path = datasets.untar_data(datasets.URLs.IMAGENETTE_320)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "tfms = [make_rgb, ResizeFixed(224), to_byte_tensor, to_float_tensor]\n", "\n", "il = ImageList.from_files(path, tfms=tfms)\n", "sd = SplitData.split_by_func(il, partial(grandparent_splitter, valid_name='val'))\n", "ll = label_by_func(sd, parent_labeler, proc_y=CategoryProcessor())" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "bs=256" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "train_dl,valid_dl = get_dls(ll.train,ll.valid,bs, num_workers=4)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 12.5 ms, sys: 169 ms, total: 182 ms\n", "Wall time: 1.99 s\n" ] } ], "source": [ "%time x,y = next(iter(train_dl))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 1.31 s, sys: 1.8 s, total: 3.11 s\n", "Wall time: 11.5 s\n" ] } ], "source": [ "%time for x,y in train_dl: x,y = x.cuda(),y.cuda()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 2 }