Skip to content

Commit

Permalink
fastai
Browse files Browse the repository at this point in the history
  • Loading branch information
jph00 committed Aug 21, 2020
1 parent 5cf040c commit efff962
Show file tree
Hide file tree
Showing 34 changed files with 283 additions and 83 deletions.
39 changes: 32 additions & 7 deletions 01_intro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@
"#id first_training\n",
"#caption Results from the first training\n",
"# CLICK ME\n",
"from fastai2.vision.all import *\n",
"from fastai.vision.all import *\n",
"path = untar_data(URLs.PETS)/'images'\n",
"\n",
"def is_cat(x): return x[0].isupper()\n",
Expand Down Expand Up @@ -1473,7 +1473,7 @@
"The first line imports all of the fastai.vision library.\n",
"\n",
"```python\n",
"from fastai2.vision.all import *\n",
"from fastai.vision.all import *\n",
"```\n",
"\n",
"This gives us all of the functions and classes we will need to create a wide variety of computer vision models."
Expand Down Expand Up @@ -2156,7 +2156,7 @@
}
],
"source": [
"from fastai2.text.all import *\n",
"from fastai.text.all import *\n",
"\n",
"dls = TextDataLoaders.from_folder(untar_data(URLs.IMDB), valid='test')\n",
"learn = text_classifier_learner(dls, AWD_LSTM, drop_mult=0.5, metrics=accuracy)\n",
Expand All @@ -2171,7 +2171,7 @@
"If you hit a \"CUDA out of memory error\" after running this cell, click on the menu Kernel, then restart. Instead of executing the cell above, copy and paste the following code in it:\n",
"\n",
"```\n",
"from fastai2.text.all import *\n",
"from fastai.text.all import *\n",
"\n",
"dls = TextDataLoaders.from_folder(untar_data(URLs.IMDB), valid='test', bs=32)\n",
"learn = text_classifier_learner(dls, AWD_LSTM, drop_mult=0.5, metrics=accuracy)\n",
Expand Down Expand Up @@ -2241,7 +2241,7 @@
"In a Jupyter notebook, the order in which you execute each cell is very important. It's not like Excel, where everything gets updated as soon as you type something anywhere—it has an inner state that gets updated each time you execute a cell. For instance, when you run the first cell of the notebook (with the \"CLICK ME\" comment), you create an object called `learn` that contains a model and data for an image classification problem. If we were to run the cell just shown in the text (the one that predicts if a review is good or not) straight after, we would get an error as this `learn` object does not contain a text classification model. This cell needs to be run after the one containing:\n",
"\n",
"```python\n",
"from fastai2.text.all import *\n",
"from fastai.text.all import *\n",
"\n",
"dls = TextDataLoaders.from_folder(untar_data(URLs.IMDB), valid='test')\n",
"learn = text_classifier_learner(dls, AWD_LSTM, drop_mult=0.5, \n",
Expand Down Expand Up @@ -2307,7 +2307,7 @@
"metadata": {},
"outputs": [],
"source": [
"from fastai2.tabular.all import *\n",
"from fastai.tabular.all import *\n",
"path = untar_data(URLs.ADULT_SAMPLE)\n",
"\n",
"dls = TabularDataLoaders.from_csv(path/'adult.csv', path=path, y_names=\"salary\",\n",
Expand Down Expand Up @@ -2516,7 +2516,7 @@
}
],
"source": [
"from fastai2.collab import *\n",
"from fastai.collab import *\n",
"path = untar_data(URLs.ML_SAMPLE)\n",
"dls = CollabDataLoaders.from_csv(path/'ratings.csv')\n",
"learn = collab_learner(dls, y_range=(0.5,5.5))\n",
Expand Down Expand Up @@ -2932,6 +2932,31 @@
"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.7"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": false,
"sideBar": true,
"skip_h1_title": true,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
Expand Down
27 changes: 26 additions & 1 deletion 02_production.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"source": [
"#hide\n",
"from fastbook import *\n",
"from fastai2.vision.widgets import *"
"from fastai.vision.widgets import *"
]
},
{
Expand Down Expand Up @@ -1976,6 +1976,31 @@
"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.7"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": false,
"sideBar": true,
"skip_h1_title": true,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
Expand Down
25 changes: 25 additions & 0 deletions 03_ethics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,31 @@
"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.7"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": false,
"sideBar": true,
"skip_h1_title": true,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
Expand Down
27 changes: 26 additions & 1 deletion 04_mnist_basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"outputs": [],
"source": [
"#hide\n",
"from fastai2.vision.all import *\n",
"from fastai.vision.all import *\n",
"from fastbook import *\n",
"\n",
"matplotlib.rc('image', cmap='Greys')"
Expand Down Expand Up @@ -5856,6 +5856,31 @@
"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.7"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": false,
"sideBar": true,
"skip_h1_title": true,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit efff962

Please sign in to comment.