diff --git a/examples/hans/test_hans.py b/examples/hans/test_hans.py index 315ad2b2e4..40c2a1bd3a 100644 --- a/examples/hans/test_hans.py +++ b/examples/hans/test_hans.py @@ -19,7 +19,6 @@ from __future__ import absolute_import, division, print_function import argparse import glob -import json import logging import os import random @@ -56,18 +55,14 @@ from transformers import ( XLNetTokenizer, get_linear_schedule_with_warmup, ) -from transformers import glue_compute_metrics as compute_metrics try: from torch.utils.tensorboard import SummaryWriter -except: +except ImportError: from tensorboardX import SummaryWriter - - - logger = logging.getLogger(__name__) ALL_MODELS = sum( @@ -374,7 +369,7 @@ def load_and_cache_examples(args, task, tokenizer, evaluate=False): def main(): parser = argparse.ArgumentParser() - ## Required parameters + # Required parameters parser.add_argument( "--data_dir", default=None, @@ -411,7 +406,7 @@ def main(): help="The output directory where the model predictions and checkpoints will be written.", ) - ## Other parameters + # Other parameters parser.add_argument( "--config_name", default="", type=str, help="Pretrained config name or path if not the same as model_name" ) diff --git a/examples/hans/utils_hans.py b/examples/hans/utils_hans.py index a0f908b5ba..8d0b42165c 100644 --- a/examples/hans/utils_hans.py +++ b/examples/hans/utils_hans.py @@ -17,7 +17,6 @@ import copy import csv import json -import sys class InputExample(object): @@ -118,7 +117,5 @@ class DataProcessor(object): reader = csv.reader(f, delimiter="\t", quotechar=quotechar) lines = [] for line in reader: - if sys.version_info[0] == 2: - line = list(unicode(cell, "utf-8") for cell in line) lines.append(line) return lines