Skip to content

Commit 07f2721

Browse files
authored
Add cell for running on Colab in weeks 1-5 (#71)
When running in Colab, we automatically download corresponding week's resources, while in local execution, the resources should already be pulled with Git repository.
1 parent 93afd4b commit 07f2721

File tree

5 files changed

+63
-3
lines changed

5 files changed

+63
-3
lines changed

Diff for: project/week5-project.ipynb

+11
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@
3535
},
3636
"outputs": [],
3737
"source": [
38+
"try:\n",
39+
" import google.colab\n",
40+
" IN_COLAB = True\n",
41+
"except:\n",
42+
" IN_COLAB = False\n",
43+
"\n",
44+
"if IN_COLAB:\n",
45+
" ! wget https://raw.githubusercontent.com/hse-aml/natural-language-processing/master/setup_google_colab.py -O setup_google_colab.py\n",
46+
" import setup_google_colab\n",
47+
" setup_google_colab.setup_project()\n",
48+
"\n",
3849
"import sys\n",
3950
"sys.path.append(\"..\")\n",
4051
"from common.download_utils import download_project_resources\n",

Diff for: week1/week1-MultilabelClassification.ipynb

+12-3
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,20 @@
3434
{
3535
"cell_type": "code",
3636
"execution_count": null,
37-
"metadata": {
38-
"collapsed": true
39-
},
37+
"metadata": {},
4038
"outputs": [],
4139
"source": [
40+
"try:\n",
41+
" import google.colab\n",
42+
" IN_COLAB = True\n",
43+
"except:\n",
44+
" IN_COLAB = False\n",
45+
"\n",
46+
"if IN_COLAB:\n",
47+
" ! wget https://raw.githubusercontent.com/hse-aml/natural-language-processing/master/setup_google_colab.py -O setup_google_colab.py\n",
48+
" import setup_google_colab\n",
49+
" setup_google_colab.setup_week1() \n",
50+
" \n",
4251
"import sys\n",
4352
"sys.path.append(\"..\")\n",
4453
"from common.download_utils import download_week1_resources\n",

Diff for: week2/week2-NER.ipynb

+11
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@
5353
},
5454
"outputs": [],
5555
"source": [
56+
"try:\n",
57+
" import google.colab\n",
58+
" IN_COLAB = True\n",
59+
"except:\n",
60+
" IN_COLAB = False\n",
61+
"\n",
62+
"if IN_COLAB:\n",
63+
" ! wget https://raw.githubusercontent.com/hse-aml/natural-language-processing/master/setup_google_colab.py -O setup_google_colab.py\n",
64+
" import setup_google_colab\n",
65+
" setup_google_colab.setup_week2()\n",
66+
"\n",
5667
"import sys\n",
5768
"sys.path.append(\"..\")\n",
5869
"from common.download_utils import download_week2_resources\n",

Diff for: week3/week3-Embeddings.ipynb

+11
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@
4040
},
4141
"outputs": [],
4242
"source": [
43+
"try:\n",
44+
" import google.colab\n",
45+
" IN_COLAB = True\n",
46+
"except:\n",
47+
" IN_COLAB = False\n",
48+
"\n",
49+
"if IN_COLAB:\n",
50+
" ! wget https://raw.githubusercontent.com/hse-aml/natural-language-processing/master/setup_google_colab.py -O setup_google_colab.py\n",
51+
" import setup_google_colab\n",
52+
" setup_google_colab.setup_week3()\n",
53+
" \n",
4354
"import sys\n",
4455
"sys.path.append(\"..\")\n",
4556
"from common.download_utils import download_week3_resources\n",

Diff for: week4/week4-seq2seq.ipynb

+18
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,24 @@
2626
"If you have never worked with TensorFlow, you will probably want to read some tutorials during your work on this assignment, e.g. [Neural Machine Translation](https://www.tensorflow.org/tutorials/seq2seq) tutorial deals with very similar task and can explain some concepts to you. "
2727
]
2828
},
29+
{
30+
"cell_type": "code",
31+
"execution_count": null,
32+
"metadata": {},
33+
"outputs": [],
34+
"source": [
35+
"try:\n",
36+
" import google.colab\n",
37+
" IN_COLAB = True\n",
38+
"except:\n",
39+
" IN_COLAB = False\n",
40+
"\n",
41+
"if IN_COLAB:\n",
42+
" ! wget https://raw.githubusercontent.com/hse-aml/natural-language-processing/master/setup_google_colab.py -O setup_google_colab.py\n",
43+
" import setup_google_colab\n",
44+
" setup_google_colab.setup_week4()"
45+
]
46+
},
2947
{
3048
"cell_type": "markdown",
3149
"metadata": {},

0 commit comments

Comments
 (0)