Skip to content

Commit e7e8220

Browse files
AVBelyyaborg-dev
authored andcommitted
Add separate requirements.txt for Colab
1 parent ec62bcc commit e7e8220

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

common/requirements_colab.txt

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
tqdm
2+
backports.weakref==1.0.post1
3+
ChatterBot==0.7.6
4+
enum34==1.1.6
5+
funcsigs==1.0.2
6+
gensim==3.8.0
7+
jedi==0.11.0
8+
libarchive==0.4.4
9+
mock==2.0.0
10+
parso==0.1.0
11+
pbr==3.1.1
12+
regex==2017.11.9

project/utils.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
def text_prepare(text):
2020
"""Performs tokenization and simple preprocessing."""
21-
21+
2222
replace_by_space_re = re.compile('[/(){}\[\]\|@,;]')
2323
bad_symbols_re = re.compile('[^0-9a-z #+_]')
2424
stopwords_set = set(stopwords.words('english'))
@@ -41,7 +41,7 @@ def load_embeddings(embeddings_path):
4141
embeddings - dict mapping words to vectors;
4242
embeddings_dim - dimension of the vectors.
4343
"""
44-
44+
4545
# Hint: you have already implemented a similar routine in the 3rd assignment.
4646
# Note that here you also need to know the dimension of the loaded embeddings.
4747
# When you load the embeddings, use numpy.float32 type as dtype
@@ -59,7 +59,7 @@ def load_embeddings(embeddings_path):
5959

6060
def question_to_vec(question, embeddings, dim):
6161
"""Transforms a string to an embedding by averaging word embeddings."""
62-
62+
6363
# Hint: you have already implemented exactly this function in the 3rd assignment.
6464

6565
########################

setup_google_colab.py

+4-13
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,15 @@ def download_github_code(path):
99

1010

1111
def setup_common():
12-
os.system("pip install tqdm")
13-
os.system("pip install backports.weakref==1.0.post1")
14-
os.system("pip install ChatterBot==0.7.6")
15-
os.system("pip install enum34==1.1.6")
16-
os.system("pip install funcsigs==1.0.2")
17-
os.system("pip install gensim==3.1.0")
18-
os.system("pip install jedi==0.11.0")
19-
os.system("pip install libarchive==0.4.4")
20-
os.system("pip install mock==2.0.0")
21-
os.system("pip install parso==0.1.0")
22-
os.system("pip install pbr==3.1.1")
23-
os.system("pip install regex==2017.11.9")
24-
12+
download_github_code("common/requirements_colab.txt")
2513
download_github_code("common/download_utils.py")
2614
download_github_code("common/tqdm_utils.py")
2715
download_github_code("common/__init__.py")
2816
os.system("mkdir common")
2917
os.system("mv download_utils.py tqdm_utils.py __init__.py common/")
18+
os.system("mv requirements_colab.txt common/")
19+
20+
os.system("pip install -r common/requirements_colab.txt --force-reinstall")
3021

3122

3223
def setup_starspace():

0 commit comments

Comments
 (0)