# HG changeset patch # User fsavard # Date 1271611281 14400 # Node ID ed1c0830681e27117f352e8ec1925228fe6944b6 # Parent 82dae7c4604684716077f2f5ca35a0af7c3d3346 Correcting bugs after trying to launch on cluster. Image dir must be created after workdir is changed. diff -r 82dae7c46046 -r ed1c0830681e deep/crbm/mnist_crbm.py --- a/deep/crbm/mnist_crbm.py Sun Apr 18 11:54:57 2010 -0400 +++ b/deep/crbm/mnist_crbm.py Sun Apr 18 13:21:21 2010 -0400 @@ -1,6 +1,7 @@ #!/usr/bin/python import sys +import os, os.path # do this before importing custom modules from mnist_config import * @@ -8,10 +9,9 @@ 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 + print "Running experiment isolation code" isolate_experiment() -import os, os.path - import numpy as N import theano @@ -32,10 +32,13 @@ import utils -if not (len(sys.argv) > 1 and sys.argv[1] in \ - ('jobman_insert',)): +def setup_workdir(): if not os.path.exists(IMAGE_OUTPUT_DIR): os.mkdir(IMAGE_OUTPUT_DIR) + if not os.path.exists(IMAGE_OUTPUT_DIR): + print "For some reason mkdir(IMAGE_OUTPUT_DIR) failed!" + sys.exit(1) + print "Created image output dir" elif os.path.isfile(IMAGE_OUTPUT_DIR): print "IMAGE_OUTPUT_DIR is not a directory!" sys.exit(1) @@ -49,6 +52,8 @@ pylearn.version.record_versions(state,[theano,ift6266,pylearn]) channel.save() + setup_workdir() + crbm = MnistCrbm(state) crbm.train() @@ -222,6 +227,7 @@ chanmock = DD({'COMPLETE':0,'save':(lambda:None)}) jobman_entrypoint(DEFAULT_STATE, chanmock) elif args[0] == 'run_default': + setup_workdir() mc = MnistCrbm(DEFAULT_STATE) mc.train()