bert_max_doc_str_max_str_pos_clean_doc_noise_doc/run_doc_qa.py
def validate_flags_or_throw(bert_config):
    """Validate the input FLAGS or throw an exception."""
    if not FLAGS.do_train and not FLAGS.do_predict:
        raise ValueError(
            "At least one of `do_train` or `do_predict` must be True.")

    if FLAGS.do_train and not FLAGS.train_file:
        raise ValueError(
            "If `do_train` is True, then `train_file` must be specified.")

    if FLAGS.do_predict and not FLAGS.predict_file:
        raise ValueError(
            "If `do_predict` is True, then `predict_file` must be specified.")

    if FLAGS.max_seq_length > bert_config.max_position_embeddings:
        raise ValueError(
            "Cannot use sequence length %d because the BERT model "
            "was only trained up to sequence length %d" %
            (FLAGS.max_seq_length, bert_config.max_position_embeddings))

    if FLAGS.max_seq_length <= FLAGS.max_query_length + 3:
        raise ValueError(
            "The max_seq_length (%d) must be greater than max_query_length "
            "(%d) + 3" % (FLAGS.max_seq_length, FLAGS.max_query_length))

    if FLAGS.max_num_answer_strings < FLAGS.max_short_answers:
        raise ValueError(
            "The max_num_answer_strings (%d) must be bigger than "
            "max_short_answers (%d)" % (FLAGS.max_num_answer_strings,
                                        FLAGS.max_short_answers)
        )

    if FLAGS.local_obj_alpha > 0.0:
        tf.logging.info("Using local_obj_alpha=%f" % FLAGS.local_obj_alpha)

    if not FLAGS.label_cleaning and FLAGS.local_obj_alpha < 1e-6:
        raise ValueError("When not label cleaning, local_obj_alpha = 1.0")
Validate the input FLAGS or throw an exception.
Validate the input FLAGS or throw an exception.
Validate the input FLAGS or throw an exception .
def validate_flags_or_throw(bert_config):
    if not FLAGS.do_train and not FLAGS.do_predict:
        raise ValueError(
            "At least one of `do_train` or `do_predict` must be True.")
    if FLAGS.do_train and not FLAGS.train_file:
        raise ValueError(
            "If `do_train` is True, then `train_file` must be specified.")
    if FLAGS.do_predict and not FLAGS.predict_file:
        raise ValueError(
            "If `do_predict` is True, then `predict_file` must be specified.")
    if FLAGS.max_seq_length > bert_config.max_position_embeddings:
        raise ValueError(
            "Cannot use sequence length %d because the BERT model "
            "was only trained up to sequence length %d" %
            (FLAGS.max_seq_length, bert_config.max_position_embeddings))
    if FLAGS.max_seq_length <= FLAGS.max_query_length + 3:
        raise ValueError(
            "The max_seq_length (%d) must be greater than max_query_length "
            "(%d) + 3" % (FLAGS.max_seq_length, FLAGS.max_query_length))
    if FLAGS.max_num_answer_strings < FLAGS.max_short_answers:
        raise ValueError(
            "The max_num_answer_strings (%d) must be bigger than "
            "max_short_answers (%d)" % (FLAGS.max_num_answer_strings,
                                        FLAGS.max_short_answers)
        )
    if FLAGS.local_obj_alpha > 0.0:
        tf.logging.info("Using local_obj_alpha=%f" % FLAGS.local_obj_alpha)
    if not FLAGS.label_cleaning and FLAGS.local_obj_alpha < 1e-6:
        raise ValueError("When not label cleaning, local_obj_alpha = 1.0")
def validate_flags_or_throw ( bert_config ) : if not FLAGS . do_train and not FLAGS . do_predict : raise ValueError ( "At least one of `do_train` or `do_predict` must be True." ) if FLAGS . do_train and not FLAGS . train_file : raise ValueError ( "If `do_train` is True, then `train_file` must be specified." ) if FLAGS . do_predict and not FLAGS . predict_file : raise ValueError ( "If `do_predict` is True, then `predict_file` must be specified." ) if FLAGS . max_seq_length > bert_config . max_position_embeddings : raise ValueError ( "Cannot use sequence length %d because the BERT model " "was only trained up to sequence length %d" % ( FLAGS . max_seq_length , bert_config . max_position_embeddings ) ) if FLAGS . max_seq_length <= FLAGS . max_query_length + 3 : raise ValueError ( "The max_seq_length (%d) must be greater than max_query_length " "(%d) + 3" % ( FLAGS . max_seq_length , FLAGS . max_query_length ) ) if FLAGS . max_num_answer_strings < FLAGS . max_short_answers : raise ValueError ( "The max_num_answer_strings (%d) must be bigger than " "max_short_answers (%d)" % ( FLAGS . max_num_answer_strings , FLAGS . max_short_answers ) ) if FLAGS . local_obj_alpha > 0.0 : tf . logging . info ( "Using local_obj_alpha=%f" % FLAGS . local_obj_alpha ) if not FLAGS . label_cleaning and FLAGS . local_obj_alpha < 1e-6 : raise ValueError ( "When not label cleaning, local_obj_alpha = 1.0" )
Validate the input FLAGS or throw an exception.
Validate the input FLAGS or throw an exception .
"""Validate the input FLAGS or throw an exception."""
bert_config