diff deep/crbm/mnist_crbm.py @ 340:523e7b87c521

Corrected a few bugs, no new features. Supposedly ready to run on cluster.
author fsavard
date Sun, 18 Apr 2010 11:39:24 -0400
parents ffbf0e41bcee
children b25ad1670ff7
line wrap: on
line diff
--- a/deep/crbm/mnist_crbm.py	Sat Apr 17 20:29:18 2010 -0400
+++ b/deep/crbm/mnist_crbm.py	Sun Apr 18 11:39:24 2010 -0400
@@ -1,9 +1,15 @@
 #!/usr/bin/python
 
-# do this first
+import sys
+
+# do this before importing custom modules
 from mnist_config import *
 
-import sys
+if not (len(sys.argv) > 1 and sys.argv[1] in \
+            ('test_jobman_entrypoint', 'run_local')):
+    # in those cases don't use isolated code, use dev code
+    isolate_code()
+
 import os, os.path
 
 import numpy as N
@@ -13,6 +19,7 @@
 
 from crbm import CRBM, ConvolutionParams
 
+import pylearn, pylearn.version
 from pylearn.datasets import MNIST
 from pylearn.io.image_tiling import tile_raster_images
 
@@ -21,8 +28,16 @@
 from pylearn.io.seriestables import *
 import tables
 
+import ift6266
+
 import utils
 
+if not os.path.exists(IMAGE_OUTPUT_DIR):
+    os.mkdir(IMAGE_OUTPUT_DIR)
+elif os.path.isfile(IMAGE_OUTPUT_DIR):
+    print "IMAGE_OUTPUT_DIR is not a directory!"
+    sys.exit(1)
+
 #def filename_from_time(suffix):
 #    import datetime
 #    return str(datetime.datetime.now()) + suffix + ".png"
@@ -42,7 +57,11 @@
         self.state = state
 
         if TEST_CONFIG:
+            self.mnist = MNIST.first_1k()
+            print "Test config, so loaded MNIST first 1000"
+        else:
             self.mnist = MNIST.full()#first_10k()
+            print "Loaded MNIST full"
 
         self.cp = ConvolutionParams( \
                     num_filters=state.num_filters,