def main(): parser = get_argument_parser() parser.add_argument( "-s", "--split", type=str, default="test", choices={"train", "valid", "test"}, required=False, help="which data to use", ) parser.add_argument( "-o", "--output-path", type=str, required=True, help="where to store the predictions", ) parser.add_argument( "--filelist-train", help= "name of filelist used for training (default, the same as `filelist`)", ) parser.add_argument( "-e", "--embedding", # choices={"mean", None}, help="what embedding to use", ) args = parser.parse_args() args.filelist_train = args.filelist_train or args.filelist predict(args)
def main(): parser = get_argument_parser() args = parser.parse_args() args.batch_size = BATCH_SIZE args.max_epochs = MAX_EPOCHS trial = SimpleNamespace(**{ "parameters": { "lr": 5e-4, }, }) print(args) print(trial) train(args, trial)
def main(): parser = get_argument_parser() parser.add_argument( "-s", "--split", type=str, default="test", choices={"train", "valid", "test"}, required=False, help="which data to use", ) parser.add_argument( "-o", "--output-path", type=str, help="where to store the visual features", ) args = parser.parse_args() print(args) extract_visual_features(args)
def main(): parser = get_argument_parser() args = parser.parse_args() args.batch_size = 8 args.max_epochs = 64 study = get_study() for i, trial in enumerate(study): print("trial id: {}".format(trial.id)) pprint.pprint(trial.parameters) loss = train(args, trial, is_train=False, study=study) study.add_observation(trial=trial, objective=loss) study.finalize(trial) print() print(study.get_best_result()) # save study model_name = f"{DATASET}_{args.filelist}_{args.model_type}" path = os.path.join("output/models/sherpa", model_name) os.makedirs(path, exist_ok=True) study.save(path)
initialize([hidden_to_output]) linear_output_e1 = hidden_to_output.apply(before_out_e1) linear_output_e2 = hidden_to_output.apply(before_out_e2) linear_output_e1.name = 'linear_output_e1' linear_output_e2.name = 'linear_output_e2' y_hat_e1 = Logistic(name='logistic1').apply(linear_output_e1) y_hat_e2 = Logistic(name='logistic2').apply(linear_output_e2) y_hat_e1.name = 'y_hat_e1' y_hat_e2.name = 'y_hat_e2' y_hat_e1 = debug_print(y_hat_e1, 'y_1', DEBUG) return y_hat_e1, y_hat_e2, before_out_e1, before_out_e2 if __name__ == '__main__': parser = get_argument_parser() args = parser.parse_args() logger.info('args: %s', args) if not args.config and (not args.samples or not args.embeddings): print( "Please provide either a config file (--config) or the paths " "to the samples and embeddings files. " "(--samples, --embeddings).") sys.exit(1) trainer = JointUnaryBinaryOldEntityTyping.from_config(args.config) trainer._config[ 'hidden_units'] = args.hidden_units if args.hidden_units else trainer._config[ 'hidden_units'] if args.max_len: trainer._config['max_len'] = args.max_len if args.apply: