GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — use the not compressed version of imdb. This take 1s to load instead … · lidapang/DeepLearningTutorials@1d12bee

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • code
    • imdb.py
    • lstm.py
  • data
    • download.sh
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎code/imdb.py‎

Copy file name to clipboardExpand all lines: code/imdb.py
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def get_dataset_file(dataset, default_dataset, origin):
7777
return dataset
7878

7979

80-
def load_data(path="imdb.pkl.gz", n_words=100000, valid_portion=0.1):
80+
def load_data(path="imdb.pkl", n_words=100000, valid_portion=0.1):
8181
''' Loads the dataset
8282
8383
:type dataset: string
@@ -91,9 +91,13 @@ def load_data(path="imdb.pkl.gz", n_words=100000, valid_portion=0.1):
9191
# Load the dataset
9292
path = get_dataset_file(
9393
path, "imdb.pkl.gz",
94-
"http://www.iro.umontreal.ca/~lisa/deep/data/imdb.pkl.gz")
94+
"http://www.iro.umontreal.ca/~lisa/deep/data/imdb.pkl")
95+
96+
if path.endswith(".gz"):
97+
f = gzip.open(path, 'rb')
98+
else:
99+
f = open(path, 'rb')
95100

96-
f = gzip.open(path, 'rb')
97101
train_set = cPickle.load(f)
98102
test_set = cPickle.load(f)
99103
f.close()
Collapse file

‎code/lstm.py‎

Copy file name to clipboardExpand all lines: code/lstm.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ def train(dim_proj=100,
471471
else:
472472
params = unzip(tparams)
473473
numpy.savez(saveto, history_errs=history_errs, **params)
474-
pkl.dump(model_options, open('%s.pkl' % saveto, 'wb'))
474+
pkl.dump(model_options, open('%s.pkl' % saveto, 'wb'), -1)
475475
print 'Done'
476476

477477
if numpy.mod(uidx, validFreq) == 0:
Collapse file

‎data/download.sh‎

Copy file name to clipboardExpand all lines: data/download.sh
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fi
1515

1616
$DL_CMD http://www.iro.umontreal.ca/~lisa/deep/data/mnist/mnist.pkl.gz
1717
$DL_CMD http://www.iro.umontreal.ca/~lisa/deep/data/mnist/mnist_py3k.pkl.gz
18-
$DL_CMD http://www.iro.umontreal.ca/~lisa/deep/data/imdb.pkl.gz
18+
$DL_CMD http://www.iro.umontreal.ca/~lisa/deep/data/imdb.pkl.gz && gunzip imdb.pkl.gz
1919
$DL_CMD http://www.iro.umontreal.ca/~lisa/deep/data/Nottingham.zip && unzip -u Nottingham.zip
2020
$DL_CMD http://www.iro.umontreal.ca/~lisa/deep/midi.zip && unzip -u midi.zip -d ../code && echo "extracted Modified Python MIDI package (GPL)"
2121
$DL_CMD http://www-etud.iro.umontreal.ca/~mesnilgr/atis/atis.fold0.pkl.gz

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.