Skip to content

Commit

Permalink
Update example-notebook (explosion#590)
Browse files Browse the repository at this point in the history
* Changed version names, no more alpha and dev versions

* Changed version number in first markdown

* Changed version number in first markdown

* Had to change ray stuff because it throws an error otherwise

* Changed mathy to mathy_core

* Cleared output of notebook 06

* Cleared notebook 5

* Checking notebooks 0 to 2 again - minor changes; deleted notebook 04-ray as agreed on slack

* Reviewed examples 04 and 03_textcat a second time

* Last check, deleted empty call in notebook 5

* Checked notebook 00 again, changed install tensorflow to tensorflow-gpu as it was before
  • Loading branch information
Jette16 authored Feb 16, 2022
1 parent 731816a commit c327a31
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 853 deletions.
46 changes: 18 additions & 28 deletions examples/00_intro_to_thinc.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"outputs": [],
"source": [
"!pip install \"thinc==8.0.0rc6.dev0\" \"ml_datasets>=0.2.0a0\" \"tqdm>=4.41\"\n"
"!pip install \"thinc>=8.0.0\" \"ml_datasets>=0.2.0\" \"tqdm>=4.41\""
]
},
{
Expand All @@ -39,21 +39,23 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "l310yc2IawXM"
"id": "l310yc2IawXM",
"scrolled": false
},
"outputs": [],
"source": [
"import thinc.util\n",
"# If you want to run this notebook on GPU, you'll need to install cupy.\n",
"if not thinc.util.has_cupy:\n",
" !pip install \"cupy-cuda101\""
" !pip install \"cupy-cuda101\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "a23GlJVJa0T-"
"id": "a23GlJVJa0T-",
"scrolled": true
},
"outputs": [],
"source": [
Expand All @@ -62,7 +64,7 @@
"# You'll either need to do tensorflow or tensorflow-gpu, depending on your\n",
"# requirements.\n",
"if not thinc.util.has_tensorflow:\n",
" !pip install \"tensorflow-gpu>=2\""
" !pip install \"tensorflow-gpu>=2\""
]
},
{
Expand All @@ -76,7 +78,7 @@
"import thinc.util\n",
"# If you want to try out the PyTorch integration, you'll need to install it.\n",
"if not thinc.util.has_torch:\n",
" !pip install \"torch\""
" !pip install \"torch\""
]
},
{
Expand All @@ -90,7 +92,7 @@
"import thinc.util\n",
"# If you want to try out the MxNet integration, you'll need to install it.\n",
"if not thinc.util.has_mxnet:\n",
" !pip install \"mxnet\""
" !pip install \"mxnet>=1.5.1,<1.6.0\""
]
},
{
Expand Down Expand Up @@ -119,8 +121,8 @@
"print(\"Thinc GPU?\", prefer_gpu())\n",
"\n",
"if thinc.util.has_tensorflow:\n",
" import tensorflow as tf\n",
" print(\"Tensorflow GPU?\", bool(tf.config.experimental.list_physical_devices('GPU')))"
" import tensorflow as tf\n",
" print(\"Tensorflow GPU?\", bool(tf.config.experimental.list_physical_devices('GPU')))"
]
},
{
Expand Down Expand Up @@ -871,7 +873,8 @@
"base_uri": "https://localhost:8080/"
},
"id": "suiQ2psrGcjT",
"outputId": "4e72a0dc-b33b-4c5e-90f1-1dfa8f311b65"
"outputId": "4e72a0dc-b33b-4c5e-90f1-1dfa8f311b65",
"scrolled": true
},
"outputs": [],
"source": [
Expand Down Expand Up @@ -1194,7 +1197,8 @@
"base_uri": "https://localhost:8080/"
},
"id": "rBiDnLGhGcjW",
"outputId": "a208e5b6-8dc9-460a-f98a-b3d14186c4dc"
"outputId": "a208e5b6-8dc9-460a-f98a-b3d14186c4dc",
"scrolled": true
},
"outputs": [],
"source": [
Expand Down Expand Up @@ -1332,7 +1336,8 @@
]
},
"id": "OCXFDVIHGcjX",
"outputId": "8fad70f4-c323-46b0-de52-2d4b65aed7b1"
"outputId": "8fad70f4-c323-46b0-de52-2d4b65aed7b1",
"scrolled": true
},
"outputs": [],
"source": [
Expand All @@ -1355,21 +1360,6 @@
"MXNet doesn't provide a `Softmax` layer but a `.softmax()` operation/method for prediction and it integrates an internal softmax during training. So to be able to integrate it with the rest of the components, you combine it with a `Softmax()` Thinc layer using the `chain` combinator. Make sure you `initialize()` the MXNet model *and* the Thinc model."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "v5NkAEDCGcjX",
"outputId": "439e42a3-4178-48f4-d63e-08b499a1c1d6"
},
"outputs": [],
"source": [
"!pip install \"mxnet>=1.5.1,<1.6.0\""
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -1473,7 +1463,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.0"
"version": "3.8.10"
},
"mimetype": "text/x-python",
"name": "python",
Expand Down
6 changes: 3 additions & 3 deletions examples/01_intro_model_definition_methods.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"metadata": {},
"outputs": [],
"source": [
"!pip install \"thinc>=8.0.0a0\""
"!pip install \"thinc>=8.0.0\""
]
},
{
Expand Down Expand Up @@ -394,7 +394,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -408,7 +408,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.6"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
10 changes: 6 additions & 4 deletions examples/02_transformers_tagger_bert.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"!pip install \"thinc>=8.0.0a0\" transformers torch \"ml_datasets>=0.2.0a0\" \"tqdm>=4.41\""
"!pip install \"thinc>=8.0.0\" transformers torch \"ml_datasets>=0.2.0\" \"tqdm>=4.41\""
]
},
{
Expand Down Expand Up @@ -476,7 +478,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -490,7 +492,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.0"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
8 changes: 4 additions & 4 deletions examples/03_pos_tagger_basic_cnn.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"metadata": {},
"outputs": [],
"source": [
"!pip install \"thinc>=8.0.0a0\" \"ml_datasets>=0.2.0a0\" \"tqdm>=4.41\""
"!pip install \"thinc>=8.0.0\" \"ml_datasets>=0.2.0\" \"tqdm>=4.41\""
]
},
{
Expand Down Expand Up @@ -371,9 +371,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.7.2 64-bit ('.env': venv)",
"display_name": "Python 3",
"language": "python",
"name": "python37"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -385,7 +385,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions examples/03_textcat_basic_neural_bow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"# Basic neural bag-of-words text classifier with Thinc\n",
"\n",
"This notebook shows how to implement a simple neural text classification model in Thinc. Last tested with `thinc==8.0.0a9`."
"This notebook shows how to implement a simple neural text classification model in Thinc. Last tested with `thinc==8.0.13`."
]
},
{
Expand All @@ -15,7 +15,7 @@
"metadata": {},
"outputs": [],
"source": [
"!pip install thinc syntok \"ml_datasets>=0.2.0a0\" tqdm"
"!pip install thinc syntok \"ml_datasets>=0.2.0\" tqdm"
]
},
{
Expand Down Expand Up @@ -265,7 +265,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
9 changes: 2 additions & 7 deletions examples/04_configure_gpu_memory.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"metadata": {},
"outputs": [],
"source": [
"!pip install \"thinc>=8.0.0a0\" torch \"tensorflow>=2.0\""
"!pip install \"thinc>=8.0.0\" torch \"tensorflow>=2.0\" "
]
},
{
Expand Down Expand Up @@ -113,11 +113,6 @@
"for _ in range(100):\n",
" arr2 = allocate_cupy_tensor(900000)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
Expand All @@ -136,7 +131,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit c327a31

Please sign in to comment.