def load_all():
 print config.paths['decmodel']
 print 'Loading skip-thoughts...'
 stv = skipthoughts.load_model(config.paths['skmodels'], config.paths['sktables'])
 print 'Loading decoder...'
 dec = decoder.load_model(config.paths['decmodel'], config.paths['dictionary'])
 print 'Loading image-sentence embedding...'
 vse = embedding.load_model(config.paths['vsemodel'])
 print 'Loading and initializing ConvNet...'
 if config.FLAG_CPU_MODE:
  sys.path.insert(0, config.paths['pycaffe'])
  import caffe
  caffe.set_mode_cpu()
  net = caffe.Net(config.paths['vgg_proto_caffe'], config.paths['vgg_model_caffe'], caffe.TEST)
 else:
  net = build_convnet(config.paths['vgg'])
 print 'Loading captions...'
 cap = []
 with open(config.paths['captions'], 'rb') as f:
  for line in f:
   cap.append(line.strip())
 print 'Embedding captions...'
 cvec = embedding.encode_sentences(vse, cap, verbose=False)
 print 'Loading biases...'
 bneg = numpy.load(config.paths['negbias'])
 bpos = numpy.load(config.paths['posbias'])
 z = {}
 z['stv'] = stv
 z['dec'] = dec
 z['vse'] = vse
 z['net'] = net
 z['cap'] = cap
 z['cvec'] = cvec
 z['bneg'] = bneg
 z['bpos'] = bpos
 return z

def load_all ( ) : print config . paths [ 'decmodel' ] print 'Loading skip-thoughts...' stv = skipthoughts . load_model ( config . paths [ 'skmodels' ] , config . paths [ 'sktables' ] ) print 'Loading decoder...' dec = decoder . load_model ( config . paths [ 'decmodel' ] , config . paths [ 'dictionary' ] ) print 'Loading image-sentence embedding...' vse = embedding . load_model ( config . paths [ 'vsemodel' ] ) print 'Loading and initializing ConvNet...' if config . FLAG_CPU_MODE : sys . path . insert ( 0 , config . paths [ 'pycaffe' ] ) import caffe caffe . set_mode_cpu ( ) net = caffe . Net ( config . paths [ 'vgg_proto_caffe' ] , config . paths [ 'vgg_model_caffe' ] , caffe . TEST ) else : net = build_convnet ( config . paths [ 'vgg' ] ) print 'Loading captions...' cap = [ ] with open ( config . paths [ 'captions' ] , 'rb' ) as f : for line in f : cap . append ( line . strip ( ) ) print 'Embedding captions...' cvec = embedding . encode_sentences ( vse , cap , verbose = False ) print 'Loading biases...' bneg = numpy . load ( config . paths [ 'negbias' ] ) bpos = numpy . load ( config . paths [ 'posbias' ] ) z = { } z [ 'stv' ] = stv z [ 'dec' ] = dec z [ 'vse' ] = vse z [ 'net' ] = net z [ 'cap' ] = cap z [ 'cvec' ] = cvec z [ 'bneg' ] = bneg z [ 'bpos' ] = bpos return z
parse all yaml documents in a stream and produce corresponding python objects .