<s> """<STR_LIT>""" <EOL> from deepnet import util <EOL> from google . protobuf import text_format <EOL> import os . path <EOL> import sys <EOL> def MakeDataPbtxt ( data_pbtxt_file , data_path ) : <EOL> data_pbtxt = util . ReadData ( '<STR_LIT>' ) <EOL> for data in data_pbtxt . data : <EOL> fname = os . path . basename ( data . file_pattern ) <EOL> data . file_pattern = os . path . join ( data_path , fname ) <EOL> util . WritePbtxt ( data_pbtxt_file , data_pbtxt ) <EOL> def MakeTrainers ( trainer_file , data_pbtxt_file , output_path ) : <EOL> trainer = util . ReadOperation ( trainer_file ) <EOL> trainer . data_proto = data_pbtxt_file <EOL> trainer . checkpoint_directory = output_path <EOL> util . WritePbtxt ( trainer_file , trainer ) <EOL> def EditPretrainedModels ( p , output_path ) : <EOL> pm = [ ] <EOL> for m in p . pretrained_model : <EOL> fname = os . path . basename ( m ) <EOL> pm . append ( os . path . join ( output_path , fname ) ) <EOL> if pm : <EOL> del p . pretrained_model [ : ] <EOL> p . pretrained_model . extend ( pm ) <EOL> def MakeModels ( model_file , output_path ) : <EOL> model = util . ReadModel ( model_file ) <EOL> for l in model . layer : <EOL> for p in l . param : <EOL> EditPretrainedModels ( p , output_path ) <EOL> for e in model . edge : <EOL> for p in e . param : <EOL> EditPretrainedModels ( p , output_path ) <EOL> util . WritePbtxt ( model_file , model ) <EOL> def main ( ) : <EOL> data_path = os . path . abspath ( sys . argv [ <NUM_LIT:1> ] ) <EOL> output_path = os . path . abspath ( sys . argv [ <NUM_LIT:2> ] ) <EOL> data_pbtxt_file = os . path . join ( data_path , '<STR_LIT>' ) <EOL> MakeDataPbtxt ( data_pbtxt_file , data_path ) <EOL> for model in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> trainer_file = os . path . join ( model , '<STR_LIT>' ) <EOL> MakeTrainers ( trainer_file , data_pbtxt_file , output_path ) <EOL> for model in [ '<STR_LIT>' ] : <EOL> trainer_file = os . path . join ( model , '<STR_LIT>' ) <EOL> MakeTrainers ( trainer_file , data_pbtxt_file , output_path ) <EOL> model_files = [ <EOL> os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ] <EOL> for model_file in model_files : <EOL> MakeModels ( model_file , output_path ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
