<s> import numpy as np <EOL> import cPickle as pickle <EOL> import cudamat as cm <EOL> import sgd <EOL> import rnnet as rnnet <EOL> import dataLoader as dl <EOL> import pdb <EOL> inFile = "<STR_LIT>" <EOL> np . random . seed ( <NUM_LIT> ) <EOL> import random <EOL> random . seed ( <NUM_LIT> ) <EOL> with open ( inFile , '<STR_LIT:r>' ) as fid : <EOL> opts = pickle . load ( fid ) <EOL> loader = dl . DataLoader ( opts . dataDir , opts . rawDim , opts . inputDim ) <EOL> nn = rnnet . NNet ( opts . inputDim , opts . outputDim , opts . layerSize , opts . numLayers , <EOL> opts . maxUttLen , temporalLayer = opts . temporalLayer ) <EOL> nn . initParams ( ) <EOL> SGD = sgd . SGD ( nn , opts . maxUttLen , alpha = opts . step , momentum = opts . momentum ) <EOL> SGD . expcost = pickle . load ( fid ) <EOL> SGD . it = <NUM_LIT:100> <EOL> nn . fromFile ( fid ) <EOL> velocity = pickle . load ( fid ) <EOL> for ( w , b ) , ( wv , bv ) in zip ( velocity , SGD . velocity ) : <EOL> wv . copy_to_host ( ) <EOL> bv . copy_to_host ( ) <EOL> wv . numpy_array [ : ] = w [ : ] <EOL> bv . numpy_array [ : ] = b [ : ] <EOL> wv . copy_to_device ( ) <EOL> bv . copy_to_device ( ) <EOL> pdb . set_trace ( ) <EOL> for i in np . random . permutation ( opts . numFiles ) + <NUM_LIT:1> : <EOL> print "<STR_LIT>" % i <EOL> if i != <NUM_LIT> : <EOL> nk = <NUM_LIT> <EOL> if i == <NUM_LIT> : <EOL> nk = <NUM_LIT> <EOL> random . shuffle ( np . arange ( nk ) . tolist ( ) ) <EOL> else : <EOL> data_dict , alis , keys , sizes = loader . loadDataFileDict ( i ) <EOL> SGD . run ( data_dict , alis , keys , sizes ) </s>
