text: """
  
  """
  from dberta_base_functions import *
  
  
  if __name__ == '__main__':
  
      def get_result(oof_df):
          labels = create_labels_for_scoring(oof_df)
          predictions = oof_df[[i for i in range(CFG.max_len)]].values
          char_probs = get_char_probs(oof_df['pn_history'].values, predictions, CFG.tokenizer)
          results = get_results(char_probs, th=0.5)
          preds = get_predictions(results)
          score = get_score(labels, preds)
          LOGGER.info(f'Score: {score:<.4f}')
  
  
      if CFG.train:
          oof_df = pd.DataFrame()
          for fold in range(CFG.n_fold):
              if fold in CFG.trn_fold:
                  _oof_df = train_loop(train, fold)
                  oof_df = pd.concat([oof_df, _oof_df])
                  LOGGER.info(f"========== fold: {fold} result ==========")
                  get_result(_oof_df)
          oof_df = oof_df.reset_index(drop=True)
          LOGGER.info(f"========== CV ==========")
          get_result(oof_df)
          oof_df.to_pickle(OUTPUT_DIR + 'oof_df.pkl')
  
      if CFG.wandb:
          wandb.finish()